Skip to content

Commit

Permalink
Add a bounding box, but don't use it in romanisim. (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
schlafly authored May 23, 2024
1 parent 99851b8 commit e8185a7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions romanisim/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def get_wcs(image, usecrds=True, distortion=None):
v2_ref=image_mod.meta.wcsinfo.v2_ref,
v3_ref=image_mod.meta.wcsinfo.v3_ref,
roll_ref=image_mod.meta.wcsinfo.roll_ref)
shape = image_mod.data.shape
wcs.bounding_box = ((-0.5, shape[-1] - 0.5), (-0.5, shape[-2] - 0.5))
wcs = GWCS(wcs)
else:
# use galsim.roman
Expand Down Expand Up @@ -260,8 +262,8 @@ def _radec(self, x, y, color=None):
x1 = np.atleast_1d(x)
y1 = np.atleast_1d(y)

coord = self.wcs.pixel_to_world(x1, y1)
r, d = coord.ra.to(u.rad).value, coord.dec.to(u.rad).value
coord = self.wcs(x1, y1, with_bounding_box=False)
r, d = (np.radians(c) for c in coord)

if np.ndim(x) == np.ndim(y) == 0:
return r[0], d[0]
Expand All @@ -282,7 +284,7 @@ def _xy(self, ra, dec, color=None):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# x, y = self.wcs.world_to_pixel(r1, d1)
x, y = self.wcs.numerical_inverse(r1, d1)
x, y = self.wcs.numerical_inverse(r1, d1, with_bounding_box=False)

if np.ndim(ra) == np.ndim(dec) == 0:
return x[0], y[0]
Expand Down

0 comments on commit e8185a7

Please sign in to comment.