do_correction

jwst.clean_flicker_noise.clean_flicker_noise.do_correction(input_model, input_dir=None, fit_method='median', fit_by_channel=False, background_method='median', background_box_size=None, mask_science_regions=False, flat_filename=None, pastasoss_filename=None, n_sigma=2.0, fit_histogram=False, single_mask=True, user_mask=None, save_mask=False, save_background=False, save_noise=False)[source]

Apply the 1/f noise correction.

Parameters:
input_modelJwstDataModel

Science data to be corrected. Updated in place.

input_dirstr

Path to the input directory. Used by sub-steps (e.g., assign_wcs for NIRSpec MOS data) to find auxiliary data.

fit_method{‘fft’, ‘median’}, optional

The algorithm to use to fit background noise.

fit_by_channelbool, optional

If set, flicker noise is fit independently for each detector channel. Ignored for MIRI, for subarray data, and for fit_method = 'fft'.

background_method{‘median’, ‘model’, ‘median_image’, 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 ‘median_image’ and the input has multiple integrations, a median image across integrations will be computed and subtracted as the background. 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.

mask_science_regionsbool, optional

For NIRSpec, mask regions of the image defined by WCS bounding boxes for slits/slices, as well as any regions known to be affected by failed-open MSA shutters. For MIRI imaging, mask regions of the detector not used for science. For NIRISS SOSS, mask the expected spectral traces.

flat_filenamestr, optional

Path to a flat field image to apply to the data before fitting noise/background.

pastasoss_filenamestr or None, optional

Path to a pastasoss reference file name. Used for NIS_SOSS only. If None, a default model will be retrieved if needed.

n_sigmafloat, optional

N-sigma rejection level for finding outliers. Set to 0 to skip outlier rejection.

fit_histogrambool, optional

If set, the ‘sigma’ used with n_sigma for clipping outliers is derived from a Gaussian fit to a histogram of values. Otherwise, a simple iterative sigma clipping is performed.

single_maskbool, optional

If set, a single mask will be created, regardless of the number of input integrations. Otherwise, the mask will be a 3D cube, with one plane for each integration.

user_maskstr or None, optional

Path to user-supplied mask image.

save_maskbool, optional

Switch to indicate whether the mask should be saved.

save_backgroundbool, optional

Switch to indicate whether the fit background should be saved.

save_noisebool, optional

Switch to indicate whether the fit noise should be saved.

Returns:
output_modelJwstDataModel

Corrected data.

mask_modelJwstDataModel

Pixel mask to be saved or None.

background_modelJwstDataModel

Background model to be saved or None.

noise_modelJwstDataModel

Background model to be saved or None.

status{‘COMPLETE’, ‘SKIPPED’}

Completion status. If errors were encountered, status is set to ‘SKIPPED’ and the output data matches the input data. Otherwise, status is set to ‘COMPLETE’.