Skip to content

Commit

Permalink
JP-3624: Fix a source of errors in resampled spec WCS (#8511)
Browse files Browse the repository at this point in the history
Co-authored-by: Ned Molter <[email protected]>
  • Loading branch information
mcara and emolter authored May 31, 2024
1 parent 7bae12b commit 743160a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 743160a

Please sign in to comment.