Skip to content

Commit

Permalink
Fixes for devdeps
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jun 18, 2024
1 parent cb34065 commit 44f3ed7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion changelog/257.breaking.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Increased the minimum version of Python to 3.10.0
Increased the minimum version of Python to 3.10.0
2 changes: 1 addition & 1 deletion docs/data_types/spectrogram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The `~sunraster.SpectrogramCube.dimensions` and `~sunraster.SpectrogramCube.arra

.. code-block:: python
>>> my_spectrograms.shape
>>> my_spectrograms.dimensions
<Quantity [3., 4., 5.] pix>
>>> my_spectrograms.array_axis_physical_types
[(np.str_('custom:pos.helioprojective.lat'), np.str_('custom:pos.helioprojective.lon')), (np.str_('custom:pos.helioprojective.lat'), np.str_('custom:pos.helioprojective.lon')), (np.str_('em.wl'),)]
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ addopts = --doctest-rst --doctest-ignore-import-errors -p no:unraisableexception
markers =
online: marks this test function as needing online connectivity.
remote_data_strict = True
doctest_subpackage_requires =
docs/* = ndcube<2.3.0
filterwarnings =
error
# Do not fail on pytest config issues (i.e. missing plugins) but do show them
Expand Down
4 changes: 3 additions & 1 deletion sunraster/instr/spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def read_spice_l2_fits(filenames, windows=None, memmap=True, read_dumbbells=Fals
first_sequence = window_sequences[0][1]
first_spectral_window = first_sequence[0].meta.spectral_window
if all(window[1][0].meta.spectral_window == first_spectral_window for window in window_sequences):
aligned_axes = tuple(range(len(first_sequence.dimensions)))
aligned_axes = tuple(
range(len(first_sequence.shape if hasattr(first_sequence, "shape") else first_sequence.dimensions))
)
else:
aligned_axes = tuple(
i for i, phys_type in enumerate(first_sequence.array_axis_physical_types) if "em.wl" not in phys_type
Expand Down
24 changes: 16 additions & 8 deletions sunraster/instr/tests/test_spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,10 @@ def test_read_spice_l2_fits_multiple_rasters_multiple_windows(spice_rasdb_filena
assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE)
assert set(result.aligned_axes.values()) == {(0, 2, 3)}
assert len(result) == 2
assert all(window.dimensions[0].value == len(filenames) for window in result.values())
assert all(isinstance(window, RasterSequence) for window in result.values())
for window in result.values():
assert isinstance(window, RasterSequence)
data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value
assert data_length == len(filenames)


def test_read_spice_l2_fits_multiple_rasters_single_window(spice_rasdb_filename):
Expand All @@ -310,8 +312,10 @@ def test_read_spice_l2_fits_multiple_rasters_single_window(spice_rasdb_filename)
assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE)
assert result.aligned_axes is None
assert len(result) == 1
assert all(window.dimensions[0].value == len(filenames) for window in result.values())
assert all(isinstance(window, RasterSequence) for window in result.values())
for window in result.values():
assert isinstance(window, RasterSequence)
data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value
assert data_length == len(filenames)


def test_read_spice_l2_fits_multiple_sns_multiple_windows(spice_sns_filename):
Expand All @@ -320,8 +324,10 @@ def test_read_spice_l2_fits_multiple_sns_multiple_windows(spice_sns_filename):
assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE)
assert set(result.aligned_axes.values()) == {(0, 2, 3)}
assert len(result) == 2
assert all(window.dimensions[0].value == len(filenames) for window in result.values())
assert all(isinstance(window, SpectrogramSequence) for window in result.values())
for window in result.values():
assert isinstance(window, SpectrogramSequence)
data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value
assert data_length == len(filenames)


def test_read_spice_l2_fits_multiple_files_dumbbells(spice_rasdb_filename):
Expand All @@ -330,8 +336,10 @@ def test_read_spice_l2_fits_multiple_files_dumbbells(spice_rasdb_filename):
assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE)
assert all(window[0].meta.contains_dumbbell for window in result.values())
assert set(result.aligned_axes.values()) == {tuple(range(4))}
assert all(window.dimensions[0].value == len(filenames) for window in result.values())
assert all(isinstance(window, SpectrogramSequence) for window in result.values())
for window in result.values():
assert isinstance(window, SpectrogramSequence)
data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value
assert data_length == len(filenames)


def test_read_spice_l2_fits_incompatible_files(spice_rasdb_filename, spice_sns_filename):
Expand Down
2 changes: 1 addition & 1 deletion sunraster/spectrogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def __str__(self):
{"".join(["-"] * len(self.__class__.__name__))}
Time Period: {time_period}
Instrument axes: {self.instrument_axes}
Pixel dimensions: {self.dimensions.astype(int)}
Pixel dimensions: {self.shape if hasattr(self, "shape") else self.dimensions.astype(int)}
Longitude range: {lon_range}
Latitude range: {lat_range}
Spectral range: {spectral_range}
Expand Down
5 changes: 4 additions & 1 deletion sunraster/spectrogram_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ def __init__(self, data_list, common_axis, meta=None):
self._spectral_axis_name = SPECTRAL_AXIS_NAME
self._set_single_scan_instrument_axes_types()

raster_dimensions = SpectrogramSequence.shape
# TODO: Compatibility with upcoming ndcube 2.3
raster_dimensions = (
SpectrogramSequence.shape if hasattr(SpectrogramSequence, "shape") else SpectrogramSequence.dimensions
)
sns_dimensions = SpectrogramSequence.cube_like_dimensions
raster_array_axis_physical_types = SpectrogramSequence.array_axis_physical_types
sns_array_axis_physical_types = SpectrogramSequence.cube_like_array_axis_physical_types
Expand Down

0 comments on commit 44f3ed7

Please sign in to comment.