diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a7dd66e33..fa966c2a2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,11 @@ `Unreleased `_ + +- Bug fixes + + - Fixed an error loading QpointPhononModes from JSON when there is a + single q-point in the data + + ------------------------------------------------------------------------------- `v1.3.1 `_ diff --git a/euphonic/io.py b/euphonic/io.py index c4d0366fd..e89a09580 100644 --- a/euphonic/io.py +++ b/euphonic/io.py @@ -38,7 +38,7 @@ def _from_json_dict(dictionary: Dict[str, Any], dictionary[key] = [tuple(x) for x in val] elif key in type_dict and type_dict[key] == np.complex128: dictionary[key] = np.array( - val, dtype=np.float64).view(np.complex128).squeeze() + val, dtype=np.float64).view(np.complex128).squeeze(axis=-1) else: dictionary[key] = np.array(val) elif isinstance(val, dict): diff --git a/tests_and_analysis/test/euphonic_test/test_qpoint_phonon_modes.py b/tests_and_analysis/test/euphonic_test/test_qpoint_phonon_modes.py index f4e98f8be..5255a0fcb 100644 --- a/tests_and_analysis/test/euphonic_test/test_qpoint_phonon_modes.py +++ b/tests_and_analysis/test/euphonic_test/test_qpoint_phonon_modes.py @@ -382,6 +382,8 @@ class TestQpointPhononModesSerialisation: @pytest.mark.parametrize('qpt_ph_modes', [ get_qpt_ph_modes('quartz'), + get_qpt_ph_modes_from_json('quartz', + 'quartz_single_qpoint_phonon_modes.json'), get_qpt_ph_modes('Si2-sc-skew'), get_qpt_ph_modes('NaCl')]) def test_serialise_to_json_file(self, qpt_ph_modes, tmpdir):