Skip to content

Commit

Permalink
do not deepcopy wcs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Dec 19, 2024
1 parent 1c2f9a8 commit a183598
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 3 additions & 9 deletions jwst/resample/resample_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,8 @@ def calc_gwcs_pixmap(in_wcs, out_wcs, shape=None):

grid = gwcs.wcstools.grid_from_bounding_box(bb)

if hasattr(out_wcs, "bounding_box"):
orig_bbox = getattr(out_wcs, "bounding_box", None)
out_wcs.bounding_box = None
else:
orig_bbox = None
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:
Expand Down Expand Up @@ -178,13 +175,10 @@ def reproject(wcs1, wcs2):
# keyword arguments and `with_bounding_box=False` cannot be passsed.
# We delete the bounding box on a copy of the WCS - yes, inefficient.
forward_transform = wcs1.pixel_to_world_values
wcs_no_bbox = deepcopy(wcs2)
wcs_no_bbox.bounding_box = None
backward_transform = wcs_no_bbox.world_to_pixel_values
backward_transform = wcs2.world_to_pixel_values
except AttributeError as err:
raise TypeError("Input should be a WCS") from err


def _reproject(x, y):
sky = forward_transform(x, y)
flat_sky = []
Expand Down
1 change: 0 additions & 1 deletion jwst/skymatch/skymatch_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def _imodel2skyim(self, image_model, index):
.format(image_model.meta.filename))

wcs = deepcopy(image_model.meta.wcs)
wcs.bounding_box = None

sky_im = SkyImage(
image=image_model.data,
Expand Down

0 comments on commit a183598

Please sign in to comment.