Skip to content

Commit

Permalink
Add a test demonstrating the coord frame bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Nov 4, 2020
1 parent 3ebaaa3 commit a35ff2c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gwcs/tests/test_coordinate_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from astropy.time import Time
from astropy import coordinates as coord
from astropy.tests.helper import assert_quantity_allclose
from astropy.modeling import models as m

from .. import WCS
from .. import coordinate_frames as cf

import astropy
Expand Down Expand Up @@ -96,6 +98,20 @@ def test_coordinates_composite_order():
assert u.allclose(result[1], 0*u.m)


def test_bare_baseframe():
# This is a regression test for the following call:
frame = cf.CoordinateFrame(1, "SPATIAL", (0,), unit=(u.km,))
assert u.allclose(frame.coordinate_to_quantity((1*u.m,)), 1*u.m)

# Now also setup the same situation through the whole call stack to be safe.
w = WCS(forward_transform=m.Tabular1D(points=np.arange(10)*u.pix,
lookup_table=np.arange(10)*u.km),
output_frame=frame,
input_frame=cf.CoordinateFrame(1, "PIXEL", (0,), unit=(u.pix,))
)
assert u.allclose(w.world_to_pixel(0*u.km), 0)


@pytest.mark.parametrize(('frame'), coord_frames)
def test_celestial_attributes_length(frame):
"""
Expand Down

0 comments on commit a35ff2c

Please sign in to comment.