generate_background_masks

jwst.background.background_sub_soss.generate_background_masks(background, n_repeats, for_fitting)[source]

Generate background masks for the two distinct background regions.

Using the discontinuity in the background template as a separation, build selection masks which flag the left and right background regions.

The mask right of the discontinuity is also truncated rightward of a cutoff value set by BACKGROUND_MASK_CUTOFF - the NIRISS team found that template matching using pixels on the right side of the detector led to poorer fits due to source contamination.

Parameters:
backgroundndarray

The 2-D background template.

n_repeatsint

The number of integrations in the science data, used to broadcast the mask into a 3-D array.

for_fittingbool

If True, the right_mask will be truncated to only use pixels left of the BACKGROUND_MASK_CUTOFF value, by default column 950. If False, every pixel will belong to either left_mask or right_mask.

Returns:
bool ndarray, bool ndarray

The left and right background masks.