NSCleanStep

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

Bases: JwstStep

Perform 1/f noise correction.

NSCleanStep: This step performs 1/f noise correction (“cleaning”) of NIRSpec images, using the “NSClean” method.

NOTE: This step is a deprecated alias to the clean_flicker_noise step.

fit_method

The background fit algorithm to use. Options are ‘fft’ and ‘median’; ‘fft’ performs the original NSClean implementation.

Type:

str, optional

fit_by_channel

If set, flicker noise is fit independently for each detector channel. Ignored 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.

Type:

tuple of int, optional

mask_spectral_regions

Mask regions of the image defined by WCS bounding boxes for slits/slices.

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

spec

Methods Summary

process(input_data)

Fit and subtract 1/f background noise from a NIRSpec image.

Attributes Documentation

class_alias = 'nsclean'
spec
fit_method = option('fft', 'median', default='fft')  # Noise fitting algorithm
fit_by_channel = boolean(default=False)  # Fit noise separately by amplifier
background_method = option('median', 'model', None, default=None) # Background fit
background_box_size = int_list(min=2, max=2, default=None)  # Background box size
mask_spectral_regions = boolean(default=True)  # Mask WCS-defined spectral regions
n_sigma = float(default=5.0)  # Clipping level for outliers
fit_histogram = boolean(default=False)  # Fit a value histogram to derive sigma
single_mask = boolean(default=False)  # 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 NIRSpec image.

Parameters:

input_data (ImageModel, IFUImageModel) – Input datamodel to be corrected.

Returns:

output_model – The 1/f corrected datamodel.

Return type:

ImageModel, IFUImageModel