bug in yaml archive file processing
Given the following:
definitions:
name: 'IR cameras data'
sections:
IR_camera:
quantities:
image:
type: str
description: png visualization of heat map matrix
m_annotations:
browser:
adaptor: RawFileAdaptor
eln:
component: FileEditQuantity
heat_map:
type: str
description: heat map matrix
m_annotations:
browser:
adaptor: RawFileAdaptor
eln:
component: FileEditQuantity
IR_cameras:
base_sections:
- nomad.datamodel.data.EntryData
m_annotations:
eln:
dict()
sub_sections:
ir_camera:
repeats: true
section: '#/IR_camera'
data:
m_def: IR_cameras
ir_camera:
- image: test.csv
- image: zioccan.png
if I open the data within the eln, I add another instance of ir_camera and save again, I got the following error:
Traceback (most recent call last):
File "/home/andrea/NOMAD/nomad/nomad/processing/data.py", line 1089, in parsing
parser.parse(self.mainfile_file.os_path, self._parser_results, logger=logger, **kwargs)
File "/home/andrea/NOMAD/nomad/nomad/parsing/parser.py", line 417, in parse
self.parse_file(mainfile, f, archive, logger)
File "/home/andrea/NOMAD/nomad/nomad/parsing/parser.py", line 399, in parse_file
errors, warnings = archive.definitions.m_all_validate()
File "/home/andrea/NOMAD/nomad/nomad/metainfo/metainfo.py", line 2580, in m_all_validate
more_errors, more_warnings = section.m_validate()
File "/home/andrea/NOMAD/nomad/nomad/metainfo/metainfo.py", line 2523, in m_validate
constraint()
File "/home/andrea/NOMAD/nomad/nomad/metainfo/metainfo.py", line 3210, in annotations_are_valid
validate_eln_quantity_annotations(self)
File "/home/andrea/NOMAD/nomad/nomad/datamodel/metainfo/eln/annotations.py", line 55, in validate_eln_quantity_annotations
component = quantity.m_annotations['eln'].get('component', False)
AttributeError: 'list' object has no attribute 'get'
If I generate a data archive from the eln and I add instances and save, I don't get errors and the json file looks exactly as my yaml:
{
"data": {
"m_def": "../upload/raw/IRcameras.archive.yaml#/definitions/section_definitions/1",
"ir_camera": [
{
"image": "aaa"
},
{
"image": "bbb"
},
{
"image": "ccc"
},
{
"image": "ggg"
}
]
},
"m_ref_archives": {}
}