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

JP-3624: Fix a source of errors in resampled spec WCS #8511

Merged
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
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ resample_spec

- Change `fillval` parameter default from INDEF to NaN [#8488]

- Fix a bug resulting in large WCS errors in the resampled image's WCS
when the slit was closely aligned with the RA direction
sky. [#8511]

residual_fringe
---------------

Expand Down
4 changes: 2 additions & 2 deletions jwst/resample/resample_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def build_interpolated_output_wcs(self, refmodel=None):
undist2sky1 = tan | native2celestial
# Filter out RuntimeWarnings due to computed NaNs in the WCS
with warnings.catch_warnings():
warnings.simplefilter("ignore", RuntimeWarning) #was ignore. need to make more specific
warnings.simplefilter("ignore", RuntimeWarning) # was ignore. need to make more specific
# at this center of slit find x,y tangent projection - x_tan, y_tan
x_tan, y_tan = undist2sky1.inverse(ra, dec)

Expand Down Expand Up @@ -498,7 +498,7 @@ def build_interpolated_output_wcs(self, refmodel=None):
# mapping.inverse uses pix_to_ytan.inverse. The auto definition
# of mapping.inverse is to use the 2nd spatial coordinate, i.e. Dec.

swap_xy = np.isclose(pix_to_xtan.slope, 0, atol=1e-8)
swap_xy = abs(pix_to_xtan.slope) < abs(pix_to_ytan.slope)
if swap_xy:
# Account for vertical or horizontal dispersion on detector
mapping.inverse = Mapping((2, 1) if spatial_axis else (1, 2))
Expand Down