You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest version of the materials data from the PNNL Compendium cannot be parsed by the current version of becquerel.
Downloading the latest JSON and placing it into becquerel/tools and calling bq.tools.force_load_and_write_materials_csv() causes the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../becquerel/tools/materials.py", line 196, in force_load_and_write_materials_csv
materials = _load_and_compile_materials()
File ".../becquerel/tools/materials.py", line 26, in _load_and_compile_materials
data_comp = fetch_compendium_data()
File ".../becquerel/tools/materials_compendium.py", line 63, in fetch_compendium_data
names = [datum["Name"] for datum in data]
File ".../becquerel/tools/materials_compendium.py", line 63, in <listcomp>
names = [datum["Name"] for datum in data]
TypeError: string indices must be integers
It seems from looking at a JSON from a few months ago and a JSON downloaded today that the difference is that the older JSON has a structure that parses into a list of dicts:
The latest version of the materials data from the PNNL Compendium cannot be parsed by the current version of
becquerel
.Downloading the latest JSON and placing it into
becquerel/tools
and callingbq.tools.force_load_and_write_materials_csv()
causes the following error:It seems from looking at a JSON from a few months ago and a JSON downloaded today that the difference is that the older JSON has a structure that parses into a
list
ofdict
s:whereas the new format parses as a
dict
and the list of material data are inside of it:So the solution is easy: to check for the data that get loaded and use
data["data"]
if it is the new format.Both versions appear to contain 411 materials, but I have not checked whether any of the data for individual materials differ.
The text was updated successfully, but these errors were encountered: