Skip to content

Commit

Permalink
Added regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Dec 13, 2022
1 parent 7f0c7c7 commit 733ae87
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions glue/core/tests/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import numpy as np
from unittest.mock import MagicMock

from astropy.wcs import WCS

from glue import core
from glue.tests.helpers import requires_astropy

Expand Down Expand Up @@ -386,3 +388,18 @@ def test_update_cid_used_in_derived():
np.testing.assert_equal(data['b'], [4, 5, 2])
data.update_id(data.id['a'], ComponentID('x'))
np.testing.assert_equal(data['b'], [4, 5, 2])


def test_coordinate_component_1d_coord():

# Regression test for a bug that caused incorrect world coordinate values
# for 1D coordinates.

wcs = WCS(naxis=1)
wcs.wcs.ctype = ['FREQ']
wcs.wcs.crpix = [1]
wcs.wcs.crval = [1]
wcs.wcs.cdelt = [1]

data = Data(flux=np.random.random(5), coords=wcs, label='data')
np.testing.assert_equal(data['Frequency'], [1, 2, 3, 4, 5])

0 comments on commit 733ae87

Please sign in to comment.