fix 1d and all False mask cases
@@ -237,9 +237,14 @@ class SkyModel(Model):
Selected models contributing inside the region where mask==True
"""
- if len(mask.data.squeeze().shape)>2:
+ mask_shape = len(mask.data.squeeze().shape)
+ if mask_shape>2:
mask = mask.sum_over_axes()
mask.data = mask.data.astype(bool)
+ elif mask_shape<2:
+ return True
+ if not np.any(mask.data):
+ return False
# check center only first
ind = self.position.to_pixel(mask.geom.wcs)
