Skip to content

Commit

Permalink
Merge pull request #87 from astrofrog/spectral-coordinates-unit
Browse files Browse the repository at this point in the history
Fix world_axis_units for SpectralCoordinates
  • Loading branch information
astrofrog authored Mar 2, 2023
2 parents f7b389c + 2125340 commit 478451f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions glue_astronomy/spectral_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def spectral_axis(self):
"""
return self._values

@property
def world_axis_units(self):
return (self._values.unit.to_string('vounit'),)

def world_to_pixel_values(self, *world):
"""
Parameters
Expand Down
2 changes: 2 additions & 0 deletions glue_astronomy/tests/test_spectral_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def test_basic():
assert_allclose(sc.world_to_pixel_values(10), 0)
assert_allclose(sc.world_to_pixel_values([10, 15, 20]), [0, 0.5, 1.0])

assert sc.world_axis_units == ('Hz',)


def test_invalid_init():

Expand Down

0 comments on commit 478451f

Please sign in to comment.