Skip to content

Commit 6c70743

Browse files
Add unit test demonstrating the bug
1 parent e3b8ad1 commit 6c70743

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

gwcs/tests/test_wcs.py

+22
Original file line numberDiff line numberDiff line change
@@ -1813,3 +1813,25 @@ def test_direct_numerical_inverse(gwcs_romanisim):
18131813
out = gwcs_romanisim.numerical_inverse(*ra_dec)
18141814

18151815
assert_allclose(xy, out)
1816+
1817+
1818+
def test_array_high_level_output():
1819+
"""
1820+
Test that we don't loose array values when requesting a high-level output
1821+
from a WCS object.
1822+
"""
1823+
input_frame = cf.CoordinateFrame(
1824+
naxes=1,
1825+
axes_type=("SPATIAL",),
1826+
axes_order=(0,),
1827+
name="pixels",
1828+
unit=(u.pix,),
1829+
axes_names=("x",),
1830+
)
1831+
output_frame = cf.SpectralFrame(unit=(u.nm,), axes_names=("lambda",))
1832+
wave_model = models.Scale(0.1) | models.Shift(500)
1833+
gwcs = wcs.WCS([(input_frame, wave_model), (output_frame, None)])
1834+
assert (
1835+
gwcs(np.array([0, 1, 2]), with_units=True)
1836+
== coord.SpectralCoord([500, 500.1, 500.2] * u.nm)
1837+
).all()

0 commit comments

Comments
 (0)