CleanFlickerNoiseStep

class jwst.clean_flicker_noise.CleanFlickerNoiseStep(name=None, parent=None, config_file=None, _validate_kwds=True, **kws)[source]

Bases: JwstStep

Perform flicker noise correction.

Input data is expected to be a ramp file (RampModel), in between jump and ramp fitting steps, or a rate file (ImageModel or CubeModel).

Correction algorithms implemented are:
  • fft: Background noise is fit in frequency space.

    Implementation is based on the NSClean algorithm, developed by Bernard Rauscher.

  • median: Background noise is characterized by a median along the detector slow axis. Implementation is based on the image1overf algorithm, developed by Chris Willott.

fit_method

The noise fitting algorithm to use. Options are ‘fft’ and ‘median’.

Type:

str, optional

fit_by_channel

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

Type:

bool, optional

background_method

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.

Type:

{‘median’, ‘model’, None}

background_box_size

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. If None, the largest value between 1 and 32 that evenly divides the image dimension is used.

Type:

tuple of int or None, optional

mask_science_regions

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.

Type:

bool, optional

apply_flat_field

If set, images are flat-corrected prior to fitting background and noise levels. A full-frame flat field image (reference type FLAT) is required. For modes that do not provide FLAT files via CRDS, including all NIRSpec spectral modes, a manually generated override flat is required to enable this option. Use the override_flat parameter to provide an alternate flat image as needed.

Type:

bool, optional

n_sigma

Sigma clipping threshold to be used in detecting outliers in the image.

Type:

float, optional

fit_histogram

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.

Type:

bool, optional

single_mask

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.

Type:

bool, optional

user_mask

Optional user-supplied mask image; path to file or opened datamodel.

Type:

None, str, or ImageModel

save_mask

Save the computed mask image.

Type:

bool, optional

save_background

Save the computed background image.

Type:

bool, optional

save_noise

Save the computed noise image.

Type:

bool, optional

Create a Step instance.

Parameters:
  • name (str, optional) – The name of the Step instance. Used in logging messages and in cache filenames. If not provided, one will be generated based on the class name.

  • parent (Step instance, optional) – The parent step of this step. Used to determine a fully-qualified name for this step, and to determine the mode in which to run this step.

  • config_file (str or pathlib.Path, optional) – The path to the config file that this step was initialized with. Use to determine relative path names of other config files.

  • **kws (dict) – Additional parameters to set. These will be set as member variables on the new Step instance.

Attributes Summary

class_alias

reference_file_types

spec

Methods Summary

process(input_data)

Fit and subtract 1/f background noise from a ramp data set.

Attributes Documentation

class_alias = 'clean_flicker_noise'
reference_file_types: ClassVar = ['flat']
spec
fit_method = option('fft', 'median', default='median')  # Noise fitting algorithm
fit_by_channel = boolean(default=False)  # Fit noise separately by amplifier (NIR only)
background_method = option('median', 'model', None, default='median') # Background fit
background_box_size = int_list(min=2, max=2, default=None)  # Background box size
mask_science_regions = boolean(default=False)  # Mask known science regions
apply_flat_field = boolean(default=False)  # Apply a flat correction before fitting
n_sigma = float(default=2.0)  # Clipping level for non-background signal
fit_histogram = boolean(default=False)  # Fit a value histogram to derive sigma
single_mask = boolean(default=True)  # Make a single mask for all integrations
user_mask = string(default=None)  # Path to user-supplied mask
save_mask = boolean(default=False)  # Save the created mask
save_background = boolean(default=False)  # Save the fit background
save_noise = boolean(default=False)  # Save the fit noise
skip = boolean(default=True)  # By default, skip the step

Methods Documentation

process(input_data)[source]

Fit and subtract 1/f background noise from a ramp data set.

Parameters:

input_data (DataModel) – Input datamodel to be corrected

Returns:

output_model – The flicker noise corrected datamodel

Return type:

DataModel