diff --git a/jwst/assign_wcs/assign_wcs.py b/jwst/assign_wcs/assign_wcs.py index c8426ce7c52..e5a6956a6c7 100644 --- a/jwst/assign_wcs/assign_wcs.py +++ b/jwst/assign_wcs/assign_wcs.py @@ -76,6 +76,8 @@ def load_wcs(input_model, reference_files=None, nrs_slit_y_range=None): wcs = WCS(pipeline) output_model.meta.wcs = wcs output_model.meta.cal_step.assign_wcs = "COMPLETE" + if output_model.meta.exposure.type.lower() == "nis_soss": + output_model.meta.wcs.bounding_box = mod.niriss_bounding_box(output_model) exclude_types = [ "nrc_wfss", "nrc_tsgrism", diff --git a/jwst/assign_wcs/niriss.py b/jwst/assign_wcs/niriss.py index 69698ffad6c..ce905cf678f 100644 --- a/jwst/assign_wcs/niriss.py +++ b/jwst/assign_wcs/niriss.py @@ -102,12 +102,8 @@ def _niriss_order_bounding_box(input_model, order): bbox_y = np.array([-0.5, input_model.meta.subarray.ysize - 0.5]) bbox_x = np.array([-0.5, input_model.meta.subarray.xsize - 0.5]) - if order == 1: - return tuple(bbox_y), tuple(bbox_x) - elif order == 2: - return tuple(bbox_y), tuple(bbox_x) - elif order == 3: - return tuple(bbox_y), tuple(bbox_x) + if order in (1, 2, 3): + return tuple(bbox_x), tuple(bbox_y) else: raise ValueError( f"Invalid spectral order: {order} provided. Spectral order must be 1, 2, or 3." @@ -131,7 +127,7 @@ def niriss_bounding_box(input_model): bbox = {(order,): _niriss_order_bounding_box(input_model, order) for order in [1, 2, 3]} model = input_model.meta.wcs.forward_transform return CompoundBoundingBox.validate( - model, bbox, slice_args=[("spectral_order", True)], order="F" + model, bbox, selector_args=[("spectral_order", True)], order="F" )