Skip to content

Commit

Permalink
Better name for meta attribute, add test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Jan 23, 2024
1 parent c54a30e commit c8159d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions specutils/spectra/spectrum_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ def with_spectral_axis_unit(self, unit, velocity_convention=None,
# Store the original unit information and WCS for posterity
meta = self._meta.copy()

if 'original_unit' not in self._meta:
if 'original_spectral_axis_unit' not in self._meta:
orig_unit = self.wcs.unit[0] if hasattr(self.wcs, 'unit') else self.spectral_axis.unit
meta['original_unit'] = orig_unit
meta['original_spectral_axis_unit'] = orig_unit

if 'original_wcs' not in self.meta:
meta['original_wcs'] = self.wcs.deepcopy()
Expand Down
1 change: 1 addition & 0 deletions specutils/tests/test_spectrum1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def test_spectral_axis_conversions():
assert new_spec.wcs.world_axis_units[0] == "km.s**-1"
# Make sure meta stored the old WCS correctly
assert new_spec.meta["original_wcs"].world_axis_units[0] == "nm"
assert new_spec.meta["original_spectral_axis_unit"] == "nm"


def test_spectral_slice():
Expand Down

0 comments on commit c8159d2

Please sign in to comment.