NSCleanSubarray

class jwst.clean_flicker_noise.nsclean.NSCleanSubarray(data, mask, fc=(1061, 1211, 49943, 49957), exclude_outliers=True, weights_kernel_sigma=None)[source]

Bases: object

Background modeling and subtraction for generic JWST near-IR subarrays.

Fit and remove 1/f noise in NIR detector subarrayss in frequency space.

NSCleanSubarray is the base class for removing residual correlated read noise from generic JWST near-IR Subarray images. It is intended for use on Level 2a pipeline products, i.e., slope images.

Parameters:
datandarray of float

The 2D input image data array to be operated on.

maskndarray of bool

The background model is fitted to pixels set to True. Pixels set to False are ignored.

fctuple

Apodizing filter definition. These parameters are tunable. They happen to work well for NIRSpec BOTS exposures:

  1. Unity gain for f < fc[0]

  2. Cosine roll-off from fc[0] to fc[1]

  3. Zero gain from fc[1] to fc[2]

  4. Cosine roll-on from fc[2] to fc[3]

exclude_outliersbool

Exclude statistical outliers and their nearest neighbors from the background pixels mask.

weights_kernel_sigmafloat

Standard deviation of the 1-dimensional Gaussian kernel that is used to approximate background sample density. This is ad-hoc. See the NSClean journal article for more information. The default for subarrays results in nearly equal weighting of all background samples.

Notes

NSCleanSubarray works in detector coordinates. Both the data and mask need to be transposed and flipped so that slow-scan runs from bottom to top as displayed in SAOImage DS9. The fast scan direction is required to run from left to right.

Attributes Summary

nloh

sigrej

tpix

Methods Summary

clean([weight_fit, return_model])

Clean the data.

fit([return_fit, weight_fit])

Fit a background model to the data.

Attributes Documentation

nloh = np.int32(12)
sigrej = np.float32(4.0)
tpix = np.float32(1e-05)

Methods Documentation

clean(weight_fit=True, return_model=False)[source]

Clean the data.

Parameters:
weight_fitbool

Use weighted least squares as described in the NSClean paper (see References). Otherwise, it is a simple unweighted fit.

return_modelbool

Return the fitted model rather than the corrected data? Default: False (return the corrected data, not the model).

Returns:
datandarray of float

The cleaned data array.

fit(return_fit=False, weight_fit=False)[source]

Fit a background model to the data.

Parameters:
return_fitbool

Return the Fourier transform.

weight_fitbool

Use weighted least squares as described in the NSClean paper (see References). False by default. For subarrays it is TBD if this is necessary.

Returns:
rfftndarray

The computed Fourier transform.