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 issues in outlier det. due to GWCS.inverse enforcing bbox #324

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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/324.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated ``outlier_detection`` to work with the upcoming GWCS release that by default enables filtering of world coordinates by footprint of the bounding box on the sky for inverse transformations (world->detector).
13 changes: 12 additions & 1 deletion src/stcal/outlier_detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,18 @@
log.debug("Bounding box from data shape: {}".format(bb))

grid = gwcs.wcstools.grid_from_bounding_box(bb)
return np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1]))

# temporarily disable the bounding box:
orig_bbox = out_wcs.bounding_box
out_wcs.bounding_box = None
try:
pixmap = np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1]))
finally:
# restore bounding box:
if orig_bbox is not None:
out_wcs.bounding_box = orig_bbox

Check warning on line 296 in src/stcal/outlier_detection/utils.py

View check run for this annotation

Codecov / codecov/patch

src/stcal/outlier_detection/utils.py#L296

Added line #L296 was not covered by tests

return pixmap


def reproject(wcs1, wcs2):
Expand Down
Loading