FAIRmat-NFDI / data-modeling

3 stars 1 forks source link

Check for xps container error in NORTH #132

Closed sanbrock closed 3 months ago

domna commented 1 year ago

This seems to be picked up by CI/CD now, too: https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-remote-tools-hub/-/jobs/2122024

Here is the error trace:

=================================== FAILURES ===================================
_ /builds/nomad-lab/nomad-remote-tools-hub/docker/xps/example/XPS workflow and fitting example.ipynb _
---------------------------------------------------------------------------
convert(input_file=["In-situ PBTTT XPS (SPECS).xml", "eln_data.yaml", "config_file.json"],
        reader='xps',
        nxdl='NXmpes',
        output='PBTTT.nxs')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_29/3962228810.py in <cell line: 1>()
----> 1 convert(input_file=["In-situ PBTTT XPS (SPECS).xml", "eln_data.yaml", "config_file.json"],
      2         reader='xps',
      3         nxdl='NXmpes',
      4         output='PBTTT.nxs')
/opt/conda/lib/python3.10/site-packages/nexusutils/dataconverter/convert.py in convert(input_file, reader, nxdl, output, generate_template, fair, **kwargs)
    106         raise Exception("The chosen NXDL isn't supported by the selected reader.")
    107 
--> 108     data = data_reader().read(  # type: ignore[operator]
    109         template=Template(template),
    110         file_paths=input_file,
/opt/conda/lib/python3.10/site-packages/nexusutils/dataconverter/readers/xps/reader.py in read(self, template, file_paths, objects)
    392                                     ENTRY_SET)
    393         if eln_data_dict:
--> 394             fill_template_with_eln_data(eln_data_dict,
    395                                         config_dict,
    396                                         template,
/opt/conda/lib/python3.10/site-packages/nexusutils/dataconverter/readers/xps/reader.py in fill_template_with_eln_data(eln_data_dict, config_dict, template, entry_set)
    343     for key, val in config_dict.items():
    344         if ELN_TOCKEN in val:
--> 345             fill_from_file(key)
    346         elif key in list(eln_data_dict.keys()):
    347             fill_from_value(key)
/opt/conda/lib/python3.10/site-packages/nexusutils/dataconverter/readers/xps/reader.py in fill_from_file(key)
    307     def fill_from_file(key):
    308         atom_types: List = []
--> 309         field_value = eln_data_dict[key]
    310 
    311         if "chemical_formula" in key:
KeyError: '/ENTRY[entry]/SAMPLE[sample]/chemical_formula'
domna commented 1 year ago

@sanbrock and @RubelMozumder I think this is solved with the fix I did in the ci-cd branch of the north repository.