Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GWCS failures due to the API spring cleaning PR #8965

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/8965.assign_wcs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix use of a string name for the WCS coordinate frame for nirspec ifu.
14 changes: 9 additions & 5 deletions jwst/assign_wcs/nirspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def ifu(input_model, reference_files, slit_y_range=[-.55, .55]):
# SLICER to MSA Entrance
slicer2msa = slicer_to_msa(reference_files)

det, sca, gwa, slit_frame, msa_frame, oteip, v2v3, v2v3vacorr, world = create_frames()
det, sca, gwa, slit_frame, slicer_frame, msa_frame, oteip, v2v3, v2v3vacorr, world = create_frames()

exp_type = input_model.meta.exposure.type.upper()

Expand All @@ -241,7 +241,7 @@ def ifu(input_model, reference_files, slit_y_range=[-.55, .55]):
(sca, det2gwa.rename('detector2gwa')),
(gwa, gwa2slit.rename('gwa2slit')),
(slit_frame, slit2slicer),
('slicer', slicer2msa),
(slicer_frame, slicer2msa),
(msa_frame, None)]
else:
# MSA to OTEIP transform
Expand Down Expand Up @@ -271,7 +271,7 @@ def ifu(input_model, reference_files, slit_y_range=[-.55, .55]):
(sca, det2gwa.rename('detector2gwa')),
(gwa, gwa2slit.rename('gwa2slit')),
(slit_frame, slit2slicer),
('slicer', slicer2msa),
(slicer_frame, slicer2msa),
(msa_frame, msa2oteip.rename('msa2oteip')),
(oteip, oteip2v23.rename('oteip2v23')),
(v2v3, va_corr),
Expand Down Expand Up @@ -352,7 +352,8 @@ def slitlets_wcs(input_model, reference_files, open_slits_id):

# Create coordinate frames in the NIRSPEC WCS pipeline"
# "detector", "gwa", "slit_frame", "msa_frame", "oteip", "v2v3", "v2v3vacorr", "world"
det, sca, gwa, slit_frame, msa_frame, oteip, v2v3, v2v3vacorr, world = create_frames()
# _ would be the slicer_frame that is not used
det, sca, gwa, slit_frame, _, msa_frame, oteip, v2v3, v2v3vacorr, world = create_frames()

exp_type = input_model.meta.exposure.type.upper()

Expand Down Expand Up @@ -1593,6 +1594,8 @@ def create_frames():
axes_names=('x_msa', 'y_msa'))
slit_spatial = cf.Frame2D(name='slit_spatial', axes_order=(0, 1), unit=("", ""),
axes_names=('x_slit', 'y_slit'))
slicer_spatial = cf.Frame2D(name='slicer_spatial', axes_order=(0, 1), unit=("", ""),
axes_names=('x_slicer', 'y_slicer'))
sky = cf.CelestialFrame(name='sky', axes_order=(0, 1), reference_frame=coord.ICRS())
v2v3_spatial = cf.Frame2D(name='v2v3_spatial', axes_order=(0, 1),
unit=(u.arcsec, u.arcsec), axes_names=('v2', 'v3'))
Expand All @@ -1606,12 +1609,13 @@ def create_frames():
v2v3 = cf.CompositeFrame([v2v3_spatial, spec], name='v2v3')
v2v3vacorr = cf.CompositeFrame([v2v3vacorr_spatial, spec], name='v2v3vacorr')
slit_frame = cf.CompositeFrame([slit_spatial, spec], name='slit_frame')
slicer_frame = cf.CompositeFrame([slicer_spatial, spec], name='slicer')
msa_frame = cf.CompositeFrame([msa_spatial, spec], name='msa_frame')
oteip_spatial = cf.Frame2D(name='oteip', axes_order=(0, 1), unit=(u.deg, u.deg),
axes_names=('X_OTEIP', 'Y_OTEIP'))
oteip = cf.CompositeFrame([oteip_spatial, spec], name='oteip')
world = cf.CompositeFrame([sky, spec], name='world')
return det, sca, gwa, slit_frame, msa_frame, oteip, v2v3, v2v3vacorr, world
return det, sca, gwa, slit_frame, slicer_frame, msa_frame, oteip, v2v3, v2v3vacorr, world


def create_imaging_frames():
Expand Down
3 changes: 2 additions & 1 deletion jwst/assign_wcs/tests/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def test_frame_from_model_3d(tmp_path, create_model_3d):
# Test CompositeFrame initialization (celestial and spectral)
im = create_model_3d
frame = pointing.frame_from_model(im)
radec, lam = frame.coordinates(1, 2, 3)

radec, lam = frame.to_high_level_coordinates(1, 2, 3)

assert_allclose(radec.spherical.lon.value, 1)
assert_allclose(radec.spherical.lat.value, 2)
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ dependencies = [
"BayesicFitting>=3.0.1",
"crds>=12.0.3",
"drizzle>=2.0.0",
"gwcs>=0.22.0,<0.23.0",
# "gwcs>=0.22.0,<0.23.0",
"gwcs @ git+https://github.com/spacetelescope/gwcs.git@master",
"numpy>=1.25,<2.0",
"opencv-python-headless>=4.6.0.66",
"photutils>=1.5.0",
Expand Down
Loading