background_subtract

jwst.wfss_contam.observations.background_subtract(data, box_size=None, filter_size=(3, 3), sigma=3.0, exclude_percentile=30.0)[source]

Apply a simple astropy background subtraction.

Parameters:
datandarray

2D array of pixel values

box_sizetuple

Size of box in pixels to use for background estimation. If not set, defaults to 1/5 of the image size.

filter_sizetuple

Size of filter to use for background estimation

sigmafloat

Sigma threshold for background clipping

exclude_percentilefloat

Percentage of masked pixels above which box is excluded from background estimation

Returns:
datandarray

2D array of pixel values with background subtracted

Notes

Improper background subtraction in input _i2d image leads to extra flux in the simulated dispersed image, and was one cause of flux scaling issues in a previous version.