Skip to content

Commit 1142959

Browse files
committed
addressing UnitConversionError for list of scalar inputs converted to pixel units
1 parent 27ec44f commit 1142959

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

astroquery/mast/cutouts.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ def _parse_cutout_size(size, timeout=None, mission=None):
7171
# This local variable will change to True if input cutout size exceeds recommended limits for TESS
7272
limit_reached = False
7373

74+
# Checking 2d size inputs for the recommended cutout size
75+
if isinstance(size, list) & (mission == 'TESS'):
76+
if len(size) == 2:
77+
if np.isscalar(size[0]):
78+
size = [size[0] * u.pixel, size[1] * u.pixel]
79+
80+
with u.set_enabled_equivalencies(u.pixel_scale(21 * u.arcsec / u.pixel)):
81+
limit_reached = (size * size[0].unit > 30 * u.pixel).any()
82+
7483
# Making size into an array [ny, nx]
7584
if np.isscalar(size):
7685
size = np.repeat(size, 2)
@@ -95,16 +104,6 @@ def _parse_cutout_size(size, timeout=None, mission=None):
95104
warnings.warn("Too many dimensions in cutout size, only the first two will be used.",
96105
InputWarning)
97106

98-
# Checking 2d size inputs for the recommended cutout size
99-
if (len(size) == 2) & (mission == 'TESS'):
100-
101-
if np.isscalar(size[0]):
102-
print(size)
103-
size = size * u.pixel
104-
105-
with u.set_enabled_equivalencies(u.pixel_scale(21 * u.arcsec / u.pixel)):
106-
limit_reached = (size * size[0].unit > 30 * u.pixel).any()
107-
108107
# Getting x and y out of the size
109108

110109
if np.isscalar(size[0]):

0 commit comments

Comments
 (0)