BadpixSelfcalStep
- class jwst.badpix_selfcal.BadpixSelfcalStep(name=None, parent=None, config_file=None, _validate_kwds=True, **kws)[source]
Bases:
JwstStep
Flag residual artifacts as bad pixels using a median filter and percentile cutoffs.
All input exposures in the association file (or manually-provided bkg_list) are combined into a single background model using a MIN operation. The bad pixels are then identified using a median filter and percentile cutoffs, and applied to the science data by setting the flagged pixels, errors, and variances to NaN, and the DQ flag to DO_NOT_USE + OTHER_BAD_PIXEL.
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
Methods Summary
process
(input_data[, selfcal_list, bkg_list])Flag residual artifacts as bad pixels in the DQ array of a JWST exposure.
save_bkg
(bkg_list[, suffix])Save the background exposures to file with correct indexing.
save_model
(model, *args, **kwargs)Override save_model to suppress index 0 when save_model is True.
Attributes Documentation
- class_alias = 'badpix_selfcal'
- spec
flagfrac_lower = float(default=0.001, min=0.0, max=0.5) # fraction of pixels to flag on the low-flux end flagfrac_upper = float(default=0.001, min=0.0, max=0.5) # fraction of pixels to flag on the high-flux end kernel_size = integer(default=15, min=1) # size of kernel for median filter force_single = boolean(default=False) # force single input exposure save_flagged_bkg = boolean(default=False) # save flagged background exposures to file skip = boolean(default=True)
Methods Documentation
- process(input_data, selfcal_list=None, bkg_list=None)[source]
Flag residual artifacts as bad pixels in the DQ array of a JWST exposure.
- Parameters:
input_data (JWST data model or association) – Input science data to be corrected, or tuple of (sci, bkg, selfcal)
selfcal_list (list of ImageModels or filenames, default None) – Exposures to include as part of median background model used to find bad pixels, but that are not flagged and returned as background exposures.
bkg_list (list of ImageModels or filenames, default None) – Exposures to include as part of median background model used to find bad pixels, and that are flagged and returned as background exposures.
- Returns:
output – Data model with CRs flagged
- Return type:
JWST data model or association
Notes
If an association file is read in, all exposures in the association file, including science, background, and selfcal exposures, are included in the MIN frame from which outliers are detected. If selfcal_list and/or bkg_list are specified manually, they are appended to any selfcal or background exposures found in the input association file. If selfcal_list and bkg_list are both set to None and input is a single science exposure, the step will be skipped with a warning unless the force_single parameter is set True. In that case, the input exposure will be used as the sole background exposure, i.e., true self-calibration.
- save_bkg(bkg_list, suffix='badpix_selfcal_bkg')[source]
Save the background exposures to file with correct indexing.