Skip to content

Commit

Permalink
Move fixture to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair authored and WilliamJamieson committed Dec 11, 2024
1 parent cbdbe8a commit 1ac7aea
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
25 changes: 25 additions & 0 deletions gwcs/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,28 @@ def gwcs_7d_complex_mapping():
w.pixel_shape = (16, 32, 21, 11, 11, 2)

return w


def gwcs_with_pipeline_celestial():
input_frame = cf.CoordinateFrame(2, ["PIXEL"]*2,
axes_order=list(range(2)),
unit=[u.pix]*2,
name="input")

spatial = models.Multiply(20*u.arcsec/u.pix) & models.Multiply(15*u.deg/u.pix)

celestial_frame = cf.CelestialFrame(axes_order=(0, 1), unit=(u.arcsec, u.deg),
reference_frame=coord.ICRS(), name="celestial")

custom = models.Shift(1*u.deg) & models.Shift(2*u.deg)

output_frame = cf.CoordinateFrame(2, ["CUSTOM"]*2,
axes_order=list(range(2)), unit=[u.arcsec]*2, name="output")

pipeline = [
(input_frame, spatial),
(celestial_frame, custom),
(output_frame, None),
]

return wcs.WCS(pipeline)
5 changes: 5 additions & 0 deletions gwcs/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,8 @@ def spher_to_cart():
@pytest.fixture
def cart_to_spher():
return geometry.CartesianToSpherical()


@pytest.fixture
def gwcs_with_pipeline_celestial():
return examples.gwcs_with_pipeline_celestial()
26 changes: 0 additions & 26 deletions gwcs/tests/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,32 +1516,6 @@ def test_reordered_celestial():
assert_allclose(obj_pixel, u.Quantity(input_pixel).to_value(u.pix))


@pytest.fixture
def gwcs_with_pipeline_celestial():
input_frame = cf.CoordinateFrame(2, ["PIXEL"]*2,
axes_order=list(range(2)),
unit=[u.pix]*2,
name="input")

spatial = models.Multiply(20*u.arcsec/u.pix) & models.Multiply(15*u.deg/u.pix)

celestial_frame = cf.CelestialFrame(axes_order=(0, 1), unit=(u.arcsec, u.deg),
reference_frame=coord.ICRS(), name="celestial")

custom = models.Shift(1*u.deg) & models.Shift(2*u.deg)

output_frame = cf.CoordinateFrame(2, ["CUSTOM"]*2,
axes_order=list(range(2)), unit=[u.arcsec]*2, name="output")

pipeline = [
(input_frame, spatial),
(celestial_frame, custom),
(output_frame, None),
]

return wcs.WCS(pipeline)


def test_high_level_objects_in_pipeline_forward(gwcs_with_pipeline_celestial):
"""
This test checks that high level objects still work with a multi-stage
Expand Down

0 comments on commit 1ac7aea

Please sign in to comment.