Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Test import of future versions of files. #3241

Merged
merged 2 commits into from Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion hyperspy/axes.py
Expand Up @@ -318,7 +318,10 @@ def __init__(self,
obj : The {} that the event belongs to.
value : The new value
""".format(_name, _name, _name), arguments=["obj", 'value'])

if name is None:
name = t.Undefined
if units is None:
units = t.Undefined
self._suppress_value_changed_trigger = False
self._suppress_update_value = False
self.name = name
Expand Down
Binary file added hyperspy/tests/io/hdf5_files/future.hspy
Binary file not shown.
15 changes: 15 additions & 0 deletions hyperspy/tests/io/test_hdf5.py
Expand Up @@ -997,3 +997,18 @@ def test_more_recent_version_warning(tmp_path):
with pytest.warns(UserWarning):
s2 = load(filename)
np.testing.assert_allclose(s.data, s2.data)


def test_load_future():
"""Code for creating future.hspy with hyperspy version 2.0.0

import hyperspy.api as hs
import numpy as np
s = hs.signals.Signal2D(np.ones((10,10,10,10)))
pos = np.array([[np.random.randint(0,10, (np.random.randint(1,10),2)) for i in range(10)]for j in range(10)], dtype=object)
p = hs.plot.markers.Points(offsets = pos)
s.add_marker(p, permanent=True)
s.save("future.hspy")
"""
with pytest.warns(UserWarning):
future = load(filenames=my_path / "hdf5_files" / "future.hspy")
2 changes: 2 additions & 0 deletions upcoming_changes/3241.bugfix.rst
@@ -0,0 +1,2 @@
Allows for loading of ``.hspy`` files saved with version 2.0.0 and greater and no unit or name set
for some axis.