background_level

jwst.clean_flicker_noise.clean_flicker_noise.background_level(image, mask, background_method='median', background_box_size=None)[source]

Fit a low-resolution background level.

Parameters:
imagendarray of float

The 2D image containing the background to fit.

maskndarray of bool

The mask that indicates which pixels are to be used in fitting. True indicates a background pixel.

background_method{‘median’, ‘model’, None}, optional

If ‘median’, the preliminary background to remove and restore is a simple median of the background data. If ‘model’, the background data is fit with a low-resolution model via Background2D. If None, the background value is 0.0.

background_box_sizetuple of int, optional

Box size for the data grid used by Background2D when background_method = 'model'. For best results, use a box size that evenly divides the input image shape. Defaults to 32x32 if not provided.

Returns:
backgroundfloat or ndarray of float

The background level: a single value, if background_method is ‘median’ or None, or an array matching the input image size if background_method is ‘model’.