File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -236,12 +236,12 @@ def get_fov_moc_from_wcs(wcs: WCS) -> MOC | None:
236
236
y_px = np .append (y_px , y [1 :, 0 ][::- 1 ])
237
237
238
238
# Disable the output of warnings when encoutering NaNs.
239
- warnings .filterwarnings ( "ignore" )
240
- # Inverse projection from pixel coordinate space to the world coordinate space
241
- viewport = pixel_to_skycoord ( x_px , y_px , wcs )
242
- # If one coordinate is a NaN we exit the function and do not go further
243
- ra_deg , dec_deg = viewport . icrs . ra . deg , viewport . icrs . dec . deg
244
- warnings . filterwarnings ( "default" )
239
+ with warnings .catch_warnings ():
240
+ warnings . simplefilter ( "ignore" )
241
+ # Inverse projection from pixel coordinate space to the world coordinate space
242
+ viewport = pixel_to_skycoord ( x_px , y_px , wcs )
243
+ # If one coordinate is a NaN we exit the function and do not go further
244
+ ra_deg , dec_deg = viewport . icrs . ra . deg , viewport . icrs . dec . deg
245
245
246
246
if np .isnan (ra_deg ).any () or np .isnan (dec_deg ).any ():
247
247
return None
You can’t perform that action at this time.
0 commit comments