Skip to content

Commit

Permalink
Fix a source of errors in resampled spec WCS
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed May 27, 2024
1 parent 6fe0ef3 commit ef531f5
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 @@ -137,6 +137,10 @@ resample_spec

- Populate the wavelength array in resampled `Slit` and `MultiSlit` models. [#8374]

- Fix a bug resulting in large WCS errors in the resampled image's WCS
under certain circumstances (depending on the orientation of the slit on the
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 ef531f5

Please sign in to comment.