Skip to content

Instantly share code, notes, and snippets.

@domna
Created June 21, 2022 06:16
Show Gist options
  • Save domna/cf754cc04e6aa17b50883945b42dfa0a to your computer and use it in GitHub Desktop.
Save domna/cf754cc04e6aa17b50883945b42dfa0a to your computer and use it in GitHub Desktop.
nexus-ellips-reader-docker-stacktrace
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 convert(input_file=["test.yaml"],
2 reader='ellips',
3 nxdl='NXellipsometry',
4 output='ellips.test.nxs')
File ~/nomad-parser-nexus/nexusparser/tools/dataconverter/convert.py:108, in convert(input_file, reader, nxdl, output, generate_template, fair, objects)
104 data = data_reader().read(template=Template(template),
105 file_paths=input_file,
106 objects=objects) # type: ignore[operator]
107 else:
--> 108 data = data_reader().read(template=Template(template),
109 file_paths=input_file) # type: ignore[operator]
111 helpers.validate_data_dict(template, data, nxdl_root)
113 if fair and data.undocumented.keys():
File ~/nomad-parser-nexus/nexusparser/tools/dataconverter/readers/ellips/reader.py:227, in EllipsometryReader.read(self, template, file_paths)
224 raise Exception("No input files were given to Ellipsometry Reader.")
226 # The header dictionary is filled with entries.
--> 227 header, psilist, deltalist = self.populate_header_dict_with_datasets(file_paths)
229 # The template dictionary is filled
230 template = populate_template_dict(header, template)
File ~/nomad-parser-nexus/nexusparser/tools/dataconverter/readers/ellips/reader.py:153, in EllipsometryReader.populate_header_dict_with_datasets(self, file_paths)
140 def populate_header_dict_with_datasets(self, file_paths):
141 """This is an ellipsometry-specific processing of data.
142
143 The procedure is the following:
(...)
151
152 """
--> 153 header, data_file = populate_header_dict(file_paths)
155 if os.path.isfile(data_file):
156 whole_data = load_as_pandas_array(data_file, header)
File ~/nomad-parser-nexus/nexusparser/tools/dataconverter/readers/ellips/reader.py:101, in populate_header_dict(file_paths)
99 for file_path in file_paths:
100 if os.path.splitext(file_path)[1].lower() in [".yaml", ".yml"]:
--> 101 header = load_header(file_path, header)
102 if "filename" not in header:
103 raise KeyError("filename is missing from", file_path)
File ~/nomad-parser-nexus/nexusparser/tools/dataconverter/readers/ellips/reader.py:44, in load_header(filename, default)
41 with open(filename, 'rt', encoding='utf8') as file:
42 header = yaml.yaml.safe_load(file)
---> 44 for attr in header:
45 if "@" in attr:
46 header[attr.replace("\\@", "@")] = header.pop(attr)
RuntimeError: dictionary keys changed during iteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment