|
3 | 3 | from stdatamodels.jwst import datamodels |
4 | 4 | from stdatamodels.jwst.datamodels import ImageModel, MultiSlitModel |
5 | 5 |
|
6 | | -from jwst.assign_wcs.util import update_s_region_spectral |
| 6 | +from jwst.assign_wcs.util import is_sky_like, update_s_region_spectral |
7 | 7 | from jwst.datamodels import ModelContainer, ModelLibrary |
8 | 8 | from jwst.exp_to_source import multislit_to_container |
9 | 9 | from jwst.lib.pipe_utils import match_nans_and_flags |
@@ -169,7 +169,11 @@ def _process_multislit(self, input_models): |
169 | 169 | with drizzled_library: |
170 | 170 | for i, model in enumerate(drizzled_library): |
171 | 171 | self.update_slit_metadata(model) |
172 | | - update_s_region_spectral(model) |
| 172 | + if not is_sky_like(model.meta.wcs.output_frame): |
| 173 | + # Output WCS is not celestial: unset the S_REGION |
| 174 | + model.meta.wcsinfo.s_region = None |
| 175 | + else: |
| 176 | + update_s_region_spectral(model) |
173 | 177 | result.slits.append(model) |
174 | 178 | drizzled_library.shelve(model, i, modify=False) |
175 | 179 | del drizzled_library |
@@ -278,7 +282,11 @@ def _process_slit(self, input_models): |
278 | 282 | input_wcs = input_models[0].meta.wcs |
279 | 283 | self._transform_sourcepos(input_wcs, result) |
280 | 284 | else: |
281 | | - update_s_region_spectral(result) |
| 285 | + if not is_sky_like(result.meta.wcs.output_frame): |
| 286 | + # Output WCS is not celestial: unset the S_REGION |
| 287 | + result.meta.wcsinfo.s_region = None |
| 288 | + else: |
| 289 | + update_s_region_spectral(result) |
282 | 290 |
|
283 | 291 | return result |
284 | 292 |
|
|
0 commit comments