Skip to content

Commit

Permalink
fix _get_wcs_pixel_scale() descriptor for ARCs
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-simpson committed Apr 10, 2024
1 parent bee8e73 commit 1141d2c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gemini_instruments/gemini/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2154,10 +2154,15 @@ def _get_wcs_pixel_scale(self, mean=True):
"""
def empirical_pixel_scale(ext):
"""Brute-force calculation of pixel scale"""
if ext.wcs is None:
if ext.wcs is None or len(ext.shape) > 2: # for now, no cubes
return None
yc, xc = [0.5 * l for l in ext.shape]
ra, dec = ext.wcs([xc, xc, xc+1], [yc, yc+1, yc])[-2:]
axes = tuple(i for i, unit in enumerate(ext.wcs.output_frame.unit)
if str(unit) == "deg")
if len(axes) != 2:
return None
world_coords = ext.wcs([xc, xc, xc+1], [yc, yc+1, yc])
ra, dec = [world_coords[ax] for ax in axes]
cosdec = math.cos(dec[0] * np.pi / 180)
a = (ra[2] - ra[0]) * cosdec
b = (ra[1] - ra[0]) * cosdec
Expand Down

0 comments on commit 1141d2c

Please sign in to comment.