diff --git a/CHANGES.rst b/CHANGES.rst index 9d880a2c49..196295b6f8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,12 @@ background - Ensure that WFSS background mask does not leave only pixels with DO_NOT_USE flagged. [#8070] +cube_build +---------- + +- Fix bug that was causing cube_build to crash when no valid data is found + on the detector in the input image(s). [#8001] + documentation ------------- diff --git a/jwst/cube_build/ifu_cube.py b/jwst/cube_build/ifu_cube.py index 3a5abdbd4b..959112f9cc 100644 --- a/jwst/cube_build/ifu_cube.py +++ b/jwst/cube_build/ifu_cube.py @@ -1506,6 +1506,8 @@ def map_detector_to_outputframe(self, this_par1, weight_det = None softrad_det = None scalerad_det = None + x_det = None + y_det = None if self.instrument == 'MIRI': sky_result = self.map_miri_pixel_to_sky(input_model, this_par1, subtract_background) @@ -1576,7 +1578,7 @@ def map_detector_to_outputframe(self, this_par1, return coord1, coord2, corner_coord, wave, dwave, flux, err, \ slice_no, rois_det, roiw_det, weight_det, \ - softrad_det, scalerad_det + softrad_det, scalerad_det, x_det, y_det # good data holds the location of pixels we want to map to cube # define variables as numpy arrays (numba needs this defined) @@ -1593,8 +1595,8 @@ def map_detector_to_outputframe(self, this_par1, err[:] = err_all[good_data] wave[:] = wave_all[good_data] slice_no[:] = slice_no_all[good_data] - x_all = x_all[good_data] - y_all = y_all[good_data] + x_det = x_all[good_data] + y_det = y_all[good_data] log.debug(f'After removing pixels based on criteria min and max wave: {np.min(wave)}, {np.max(wave)}') @@ -1680,7 +1682,7 @@ def map_detector_to_outputframe(self, this_par1, corner_coord = [xi1, eta1, xi2, eta2, xi3, eta3, xi4, eta4] return coord1, coord2, corner_coord, wave, dwave, flux, err, \ slice_no, rois_det, roiw_det, weight_det, \ - softrad_det, scalerad_det, x_all, y_all + softrad_det, scalerad_det, x_det, y_det # ______________________________________________________________________ def map_miri_pixel_to_sky(self, input_model, this_par1, subtract_background):