From 7ce8014cbea6a865ced3c6560fee6cf63300df37 Mon Sep 17 00:00:00 2001 From: Haoyu Yang Date: Fri, 6 Dec 2024 21:46:40 +0800 Subject: [PATCH] fix alchemy and anlysis --- tests/alchemy/test_filters.py | 4 ++-- tests/alchemy/test_materials.py | 2 +- .../connectivity/test_connected_components.py | 2 +- .../connectivity/test_structure_connectivity.py | 2 +- .../test_coordination_geometry_finder.py | 2 +- .../coordination_environments/test_read_write.py | 14 +++++++------- .../test_structure_environments.py | 4 ++-- .../coordination_environments/test_weights.py | 8 ++++---- tests/analysis/elasticity/test_elastic.py | 10 +++++----- .../test_substitution_probability.py | 2 +- .../structure_prediction/test_substitutor.py | 2 +- tests/analysis/test_graphs.py | 2 +- tests/analysis/test_molecule_matcher.py | 4 ++-- tests/analysis/test_structure_matcher.py | 2 +- tests/analysis/test_surface_analysis.py | 16 ++++++++-------- tests/analysis/test_transition_state.py | 2 +- tests/analysis/test_wulff.py | 2 +- tests/analysis/xas/test_spectrum.py | 12 ++++++------ 18 files changed, 46 insertions(+), 46 deletions(-) diff --git a/tests/alchemy/test_filters.py b/tests/alchemy/test_filters.py index 16737ae67fa..9d023291ba4 100644 --- a/tests/alchemy/test_filters.py +++ b/tests/alchemy/test_filters.py @@ -72,7 +72,7 @@ def test_as_from_dict(self): class TestRemoveDuplicatesFilter(TestCase): def setUp(self): - with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json") as file: + with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json", encoding="utf-8") as file: entries = json.load(file, cls=MontyDecoder) self._struct_list = [entry.structure for entry in entries] self._sm = StructureMatcher() @@ -91,7 +91,7 @@ def test_as_from_dict(self): class TestRemoveExistingFilter(TestCase): def setUp(self): - with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json") as file: + with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json", encoding="utf-8") as file: entries = json.load(file, cls=MontyDecoder) self._struct_list = [entry.structure for entry in entries] self._sm = StructureMatcher() diff --git a/tests/alchemy/test_materials.py b/tests/alchemy/test_materials.py index 25b8cc74ad2..e1b198f008a 100644 --- a/tests/alchemy/test_materials.py +++ b/tests/alchemy/test_materials.py @@ -64,7 +64,7 @@ def test_final_structure(self): assert isinstance(deepcopy(self.trans), TransformedStructure) def test_from_dict(self): - with open(f"{TEST_DIR}/transformations.json") as file: + with open(f"{TEST_DIR}/transformations.json", encoding="utf-8") as file: dct = json.load(file) dct["other_parameters"] = {"tags": ["test"]} t_struct = TransformedStructure.from_dict(dct) diff --git a/tests/analysis/chemenv/connectivity/test_connected_components.py b/tests/analysis/chemenv/connectivity/test_connected_components.py index fc9e561c57e..1abe37bbeac 100644 --- a/tests/analysis/chemenv/connectivity/test_connected_components.py +++ b/tests/analysis/chemenv/connectivity/test_connected_components.py @@ -838,7 +838,7 @@ def test_real_systems(self): def test_coordination_sequences(self): BaTiO3_se_fpath = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments/se_mp-5020.json" - with open(BaTiO3_se_fpath) as file: + with open(BaTiO3_se_fpath, encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) lse = LightStructureEnvironments.from_structure_environments( diff --git a/tests/analysis/chemenv/connectivity/test_structure_connectivity.py b/tests/analysis/chemenv/connectivity/test_structure_connectivity.py index 37f8da4b98a..bb1ddffdc39 100644 --- a/tests/analysis/chemenv/connectivity/test_structure_connectivity.py +++ b/tests/analysis/chemenv/connectivity/test_structure_connectivity.py @@ -17,7 +17,7 @@ class TestStructureConnectivity(PymatgenTest): def test_serialization(self): BaTiO3_se_fpath = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments/se_mp-5020.json" - with open(BaTiO3_se_fpath) as file: + with open(BaTiO3_se_fpath, encoding="utf-8") as file: dd = json.load(file) struct_envs = StructureEnvironments.from_dict(dd) lse = LightStructureEnvironments.from_structure_environments( diff --git a/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py b/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py index 01aedf2d245..1b04a69016c 100644 --- a/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py +++ b/tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py @@ -142,7 +142,7 @@ def _strategy_test(self, strategy): for json_file in files: with self.subTest(json_file=json_file): - with open(f"{json_dir}/{json_file}") as file: + with open(f"{json_dir}/{json_file}", encoding="utf-8") as file: dct = json.load(file) atom_indices = dct["atom_indices"] diff --git a/tests/analysis/chemenv/coordination_environments/test_read_write.py b/tests/analysis/chemenv/coordination_environments/test_read_write.py index 640770fccad..f3aafdfdac0 100644 --- a/tests/analysis/chemenv/coordination_environments/test_read_write.py +++ b/tests/analysis/chemenv/coordination_environments/test_read_write.py @@ -37,7 +37,7 @@ def setUpClass(cls): cls.lgf.setup_parameters(centering_type="standard") def test_read_write_structure_environments(self): - with open(f"{json_dir}/test_T--4_FePO4_icsd_4266.json") as file: + with open(f"{json_dir}/test_T--4_FePO4_icsd_4266.json", encoding="utf-8") as file: dd = json.load(file) atom_indices = dd["atom_indices"] @@ -51,7 +51,7 @@ def test_read_write_structure_environments(self): with open(f"{self.tmp_path}/se.json", mode="w") as file: json.dump(se.as_dict(), file) - with open(f"{self.tmp_path}/se.json") as file: + with open(f"{self.tmp_path}/se.json", encoding="utf-8") as file: dd = json.load(file) se2 = StructureEnvironments.from_dict(dd) @@ -70,13 +70,13 @@ def test_read_write_structure_environments(self): default=lambda obj: getattr(obj, "tolist", lambda: obj)(), ) - with open(f"{self.tmp_path}/lse.json") as file: + with open(f"{self.tmp_path}/lse.json", encoding="utf-8") as file: LightStructureEnvironments.from_dict(json.load(file)) # assert lse == lse2 def test_structure_environments_neighbors_sets(self): - with open(f"{struct_env_dir}/se_mp-7000.json") as file: + with open(f"{struct_env_dir}/se_mp-7000.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) @@ -221,7 +221,7 @@ def test_strategies(self): assert multi_weights_strategy_2 != multi_weights_strategy_3 def test_read_write_voronoi(self): - with open(f"{json_dir}/test_T--4_FePO4_icsd_4266.json") as file: + with open(f"{json_dir}/test_T--4_FePO4_icsd_4266.json", encoding="utf-8") as file: dd = json.load(file) struct = Structure.from_dict(dd["structure"]) @@ -230,10 +230,10 @@ def test_read_write_voronoi(self): detailed_voronoi_container = DetailedVoronoiContainer(structure=struct, valences=valences) - with open(f"{self.tmp_path}/se.json", mode="w") as file: + with open(f"{self.tmp_path}/se.json", mode="w", encoding="utf-8") as file: json.dump(detailed_voronoi_container.as_dict(), file) - with open(f"{self.tmp_path}/se.json") as file: + with open(f"{self.tmp_path}/se.json", encoding="utf-8") as file: dd = json.load(file) detailed_voronoi_container2 = DetailedVoronoiContainer.from_dict(dd) diff --git a/tests/analysis/chemenv/coordination_environments/test_structure_environments.py b/tests/analysis/chemenv/coordination_environments/test_structure_environments.py index 3f8bde41636..1aa09656c6f 100644 --- a/tests/analysis/chemenv/coordination_environments/test_structure_environments.py +++ b/tests/analysis/chemenv/coordination_environments/test_structure_environments.py @@ -26,7 +26,7 @@ class TestStructureEnvironments(PymatgenTest): def test_structure_environments(self): - with open(f"{TEST_DIR}/se_mp-7000.json") as file: + with open(f"{TEST_DIR}/se_mp-7000.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) @@ -143,7 +143,7 @@ def test_structure_environments(self): assert ce != ce2 def test_light_structure_environments(self): - with open(f"{TEST_DIR}/se_mp-7000.json") as file: + with open(f"{TEST_DIR}/se_mp-7000.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) diff --git a/tests/analysis/chemenv/coordination_environments/test_weights.py b/tests/analysis/chemenv/coordination_environments/test_weights.py index 6a5b2ffe50a..a645c90fce8 100644 --- a/tests/analysis/chemenv/coordination_environments/test_weights.py +++ b/tests/analysis/chemenv/coordination_environments/test_weights.py @@ -240,7 +240,7 @@ def test_CN_bias_weight(self): def test_self_csms_weight(self): # Get the StructureEnvironments for K2NaNb2Fe7Si8H4O31 (mp-743972) - with open(f"{struct_env_dir}/se_mp-743972.json") as file: + with open(f"{struct_env_dir}/se_mp-743972.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) @@ -316,7 +316,7 @@ def test_self_csms_weight(self): assert abs(self_w - 0.14204073172729198) < 1e-8 # Get the StructureEnvironments for SiO2 (mp-7000) - with open(f"{struct_env_dir}/se_mp-7000.json") as file: + with open(f"{struct_env_dir}/se_mp-7000.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) @@ -360,7 +360,7 @@ def test_self_csms_weight(self): def test_delta_csms_weight(self): # Get the StructureEnvironments for K2NaNb2Fe7Si8H4O31 (mp-743972) - with open(f"{struct_env_dir}/se_mp-743972.json") as file: + with open(f"{struct_env_dir}/se_mp-743972.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) @@ -492,7 +492,7 @@ def test_delta_csms_weight(self): assert abs(delta_w - 0.103515625) < 1e-8 # Get the StructureEnvironments for SiO2 (mp-7000) - with open(f"{struct_env_dir}/se_mp-7000.json") as file: + with open(f"{struct_env_dir}/se_mp-7000.json", encoding="utf-8") as file: dct = json.load(file) struct_envs = StructureEnvironments.from_dict(dct) diff --git a/tests/analysis/elasticity/test_elastic.py b/tests/analysis/elasticity/test_elastic.py index 699f97d4061..32ac9eedea7 100644 --- a/tests/analysis/elasticity/test_elastic.py +++ b/tests/analysis/elasticity/test_elastic.py @@ -67,9 +67,9 @@ def setUp(self): self.elastic_tensor_1 = ElasticTensor(self.ft) filepath = f"{TEST_DIR}/Sn_def_stress.json" - with open(filepath) as file: + with open(filepath, encoding="utf-8") as file: self.def_stress_dict = json.load(file) - with open(f"{TEST_DIR}/test_toec_data.json") as file: + with open(f"{TEST_DIR}/test_toec_data.json", encoding="utf-8") as file: self.toec_dict = json.load(file) self.structure = self.get_structure("Sn") @@ -265,7 +265,7 @@ def test_energy_density(self): class TestElasticTensorExpansion(PymatgenTest): def setUp(self): - with open(f"{TEST_DIR}/test_toec_data.json") as file: + with open(f"{TEST_DIR}/test_toec_data.json", encoding="utf-8") as file: self.data_dict = json.load(file) self.strains = [Strain(sm) for sm in self.data_dict["strains"]] self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]] @@ -366,7 +366,7 @@ def test_get_yield_stress(self): class TestNthOrderElasticTensor(PymatgenTest): def setUp(self): - with open(f"{TEST_DIR}/test_toec_data.json") as file: + with open(f"{TEST_DIR}/test_toec_data.json", encoding="utf-8") as file: self.data_dict = json.load(file) self.strains = [Strain(sm) for sm in self.data_dict["strains"]] self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]] @@ -405,7 +405,7 @@ class TestDiffFit(PymatgenTest): """Test various functions related to diff fitting.""" def setUp(self): - with open(f"{TEST_DIR}/test_toec_data.json") as file: + with open(f"{TEST_DIR}/test_toec_data.json", encoding="utf-8") as file: self.data_dict = json.load(file) self.strains = [Strain(sm) for sm in self.data_dict["strains"]] self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]] diff --git a/tests/analysis/structure_prediction/test_substitution_probability.py b/tests/analysis/structure_prediction/test_substitution_probability.py index e6c5f9786d0..bd0fce0c386 100644 --- a/tests/analysis/structure_prediction/test_substitution_probability.py +++ b/tests/analysis/structure_prediction/test_substitution_probability.py @@ -22,7 +22,7 @@ def get_table(): default lambda table. """ json_path = f"{TEST_DIR}/test_lambda.json" - with open(json_path) as file: + with open(json_path, encoding="utf-8") as file: return json.load(file) diff --git a/tests/analysis/structure_prediction/test_substitutor.py b/tests/analysis/structure_prediction/test_substitutor.py index 6965408afcc..62690d436bd 100644 --- a/tests/analysis/structure_prediction/test_substitutor.py +++ b/tests/analysis/structure_prediction/test_substitutor.py @@ -16,7 +16,7 @@ def get_table(): default lambda table. """ json_path = f"{TEST_DIR}/test_lambda.json" - with open(json_path) as file: + with open(json_path, encoding="utf-8") as file: return json.load(file) diff --git a/tests/analysis/test_graphs.py b/tests/analysis/test_graphs.py index ad42533435c..071bb965033 100644 --- a/tests/analysis/test_graphs.py +++ b/tests/analysis/test_graphs.py @@ -86,7 +86,7 @@ def setUp(self): # MoS2 example, structure graph obtained from critic2 # (not ground state, from mp-1023924, single layer) stdout_file = f"{TEST_FILES_DIR}/command_line/critic2/MoS2_critic2_stdout.txt" - with open(stdout_file) as txt_file: + with open(stdout_file, encoding="utf-8") as txt_file: reference_stdout = txt_file.read() self.structure = Structure.from_file(f"{TEST_FILES_DIR}/command_line/critic2/MoS2.cif") c2o = Critic2Analysis(self.structure, reference_stdout) diff --git a/tests/analysis/test_molecule_matcher.py b/tests/analysis/test_molecule_matcher.py index 36a5db2c4c0..3a7f433e1be 100644 --- a/tests/analysis/test_molecule_matcher.py +++ b/tests/analysis/test_molecule_matcher.py @@ -164,12 +164,12 @@ def test_get_rmsd(self): @pytest.mark.skipif(platform.system() == "Windows", reason="Tests for openbabel failing on Win") def test_group_molecules(self): mol_matcher = MoleculeMatcher(tolerance=0.001) - with open(f"{TEST_DIR}/mol_list.txt") as file: + with open(f"{TEST_DIR}/mol_list.txt", encoding="utf-8") as file: filename_list = [line.strip() for line in file] mol_list = [Molecule.from_file(f"{TEST_DIR}/{file}") for file in filename_list] mol_groups = mol_matcher.group_molecules(mol_list) filename_groups = [[filename_list[mol_list.index(m)] for m in g] for g in mol_groups] - with open(f"{TEST_DIR}/grouped_mol_list.txt") as file: + with open(f"{TEST_DIR}/grouped_mol_list.txt", encoding="utf-8") as file: grouped_text = file.read().strip() assert str(filename_groups) == grouped_text diff --git a/tests/analysis/test_structure_matcher.py b/tests/analysis/test_structure_matcher.py index 5a71019ebe2..8850edede70 100644 --- a/tests/analysis/test_structure_matcher.py +++ b/tests/analysis/test_structure_matcher.py @@ -24,7 +24,7 @@ class TestStructureMatcher(PymatgenTest): def setUp(self): - with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json") as file: + with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json", encoding="utf-8") as file: entries = json.load(file, cls=MontyDecoder) self.struct_list = [ent.structure for ent in entries] self.oxi_structs = [ diff --git a/tests/analysis/test_surface_analysis.py b/tests/analysis/test_surface_analysis.py index 5492d9aefa6..42a102b74ca 100644 --- a/tests/analysis/test_surface_analysis.py +++ b/tests/analysis/test_surface_analysis.py @@ -24,7 +24,7 @@ class TestSlabEntry(PymatgenTest): def setUp(self): - with open(f"{TEST_DIR}/ucell_entries.txt") as file: + with open(f"{TEST_DIR}/ucell_entries.txt", encoding="utf-8") as file: ucell_entries = json.loads(file.read()) self.ucell_entries = ucell_entries @@ -58,7 +58,7 @@ def test_properties(self): assert ads.Nsurfs_ads_in_slab == 1 # Determine the correct binding energy - with open(f"{TEST_DIR}/isolated_O_entry.txt") as txt_file: + with open(f"{TEST_DIR}/isolated_O_entry.txt", encoding="utf-8") as txt_file: isolated_O_entry = json.loads(txt_file.read()) O_cse = ComputedStructureEntry.from_dict(isolated_O_entry) g_bind = (ads.energy - ml * clean.energy) / Nads - O_cse.energy_per_atom @@ -122,7 +122,7 @@ class TestSurfaceEnergyPlotter(PymatgenTest): def setUp(self): entry_dict = get_entry_dict(f"{TEST_DIR}/Cu_entries.txt") self.Cu_entry_dict = entry_dict - with open(f"{TEST_DIR}/ucell_entries.txt") as file: + with open(f"{TEST_DIR}/ucell_entries.txt", encoding="utf-8") as file: ucell_entries = json.loads(file.read()) self.Cu_ucell_entry = ComputedStructureEntry.from_dict(ucell_entries["Cu"]) @@ -314,7 +314,7 @@ def setUp(self): # Load all entries La_hcp_entry_dict = get_entry_dict(f"{TEST_DIR}/La_hcp_entries.txt") La_fcc_entry_dict = get_entry_dict(f"{TEST_DIR}/La_fcc_entries.txt") - with open(f"{TEST_DIR}/ucell_entries.txt") as txt_file: + with open(f"{TEST_DIR}/ucell_entries.txt", encoding="utf-8") as txt_file: ucell_entries = json.loads(txt_file.read()) La_hcp_ucell_entry = ComputedStructureEntry.from_dict(ucell_entries["La_hcp"]) La_fcc_ucell_entry = ComputedStructureEntry.from_dict(ucell_entries["La_fcc"]) @@ -365,7 +365,7 @@ def get_entry_dict(filename): # helper to generate an entry_dict entry_dict = {} - with open(filename) as file: + with open(filename, encoding="utf-8") as file: entries = json.loads(file.read()) for entry in entries: sub_str = entry[25:] @@ -392,7 +392,7 @@ def load_O_adsorption(): # Loads the dictionary for clean and O adsorbed Rh, Pt, and Ni entries # Load the adsorbate as an entry - with open(f"{TEST_DIR}/isolated_O_entry.txt") as file: + with open(f"{TEST_DIR}/isolated_O_entry.txt", encoding="utf-8") as file: isolated_O_entry = json.loads(file.read()) O_entry = ComputedStructureEntry.from_dict(isolated_O_entry) @@ -403,7 +403,7 @@ def load_O_adsorption(): "Rh": {(1, 0, 0): {}}, } - with open(f"{TEST_DIR}/cs_entries_slabs.json") as file: + with open(f"{TEST_DIR}/cs_entries_slabs.json", encoding="utf-8") as file: entries = json.loads(file.read()) for key in entries: entry = ComputedStructureEntry.from_dict(entries[key]) @@ -419,7 +419,7 @@ def load_O_adsorption(): clean = SlabEntry(entry.structure, entry.energy, (1, 0, 0), label=f"{key}_clean") metals_O_entry_dict[el][1, 0, 0][clean] = [] - with open(f"{TEST_DIR}/cs_entries_o_ads.json") as file: + with open(f"{TEST_DIR}/cs_entries_o_ads.json", encoding="utf-8") as file: entries = json.loads(file.read()) for key in entries: entry = ComputedStructureEntry.from_dict(entries[key]) diff --git a/tests/analysis/test_transition_state.py b/tests/analysis/test_transition_state.py index 96841bc482a..9e03e7a988c 100644 --- a/tests/analysis/test_transition_state.py +++ b/tests/analysis/test_transition_state.py @@ -48,7 +48,7 @@ def test_run(self): neb_analysis1.setup_spline(spline_options={"saddle_point": "zero_slope"}) assert_allclose(neb_analysis1.get_extrema()[1][0], (0.50023335723480078, 325.20003984140203)) - with open(f"{TEST_DIR}/neb2/neb_analysis2.json") as file: + with open(f"{TEST_DIR}/neb2/neb_analysis2.json", encoding="utf-8") as file: neb_analysis2_dict = json.load(file) neb_analysis2 = NEBAnalysis.from_dict(neb_analysis2_dict) assert_allclose(neb_analysis2.get_extrema()[1][0], (0.37255257367467326, 562.40825334519991)) diff --git a/tests/analysis/test_wulff.py b/tests/analysis/test_wulff.py index 768d079e2da..0579d09f72a 100644 --- a/tests/analysis/test_wulff.py +++ b/tests/analysis/test_wulff.py @@ -23,7 +23,7 @@ class TestWulffShape(PymatgenTest): def setUp(self): - with open(f"{TEST_DIR}/surface_samples.json") as data_file: + with open(f"{TEST_DIR}/surface_samples.json", encoding="utf-8") as data_file: surface_properties = json.load(data_file) surface_energies, miller_indices = {}, {} diff --git a/tests/analysis/xas/test_spectrum.py b/tests/analysis/xas/test_spectrum.py index 92a04879dc3..f6c258a5f30 100644 --- a/tests/analysis/xas/test_spectrum.py +++ b/tests/analysis/xas/test_spectrum.py @@ -14,17 +14,17 @@ TEST_DIR = f"{TEST_FILES_DIR}/analysis/spectrum_test" -with open(f"{TEST_DIR}/LiCoO2_k_xanes.json") as file: +with open(f"{TEST_DIR}/LiCoO2_k_xanes.json", encoding="utf-8") as file: k_xanes_dict = json.load(file, cls=MontyDecoder) -with open(f"{TEST_DIR}/LiCoO2_k_exafs.json") as file: +with open(f"{TEST_DIR}/LiCoO2_k_exafs.json", encoding="utf-8") as file: k_exafs_dict = json.load(file, cls=MontyDecoder) -with open(f"{TEST_DIR}/ZnO_l2_xanes.json") as file: +with open(f"{TEST_DIR}/ZnO_l2_xanes.json", encoding="utf-8") as file: l2_xanes_dict = json.load(file, cls=MontyDecoder) -with open(f"{TEST_DIR}/ZnO_l3_xanes.json") as file: +with open(f"{TEST_DIR}/ZnO_l3_xanes.json", encoding="utf-8") as file: l3_xanes_dict = json.load(file, cls=MontyDecoder) -with open(f"{TEST_DIR}/site1_k_xanes.json") as file: +with open(f"{TEST_DIR}/site1_k_xanes.json", encoding="utf-8") as file: site1_xanes_dict = json.load(file, cls=MontyDecoder) -with open(f"{TEST_DIR}/site2_k_xanes.json") as file: +with open(f"{TEST_DIR}/site2_k_xanes.json", encoding="utf-8") as file: site2_xanes_dict = json.load(file, cls=MontyDecoder)