OutlierDetectionIFU

class jwst.outlier_detection.outlier_detection_ifu.OutlierDetectionIFU(input_models, reffiles=None, **pars)[source]

Bases: OutlierDetection

Sub-class defined for performing outlier detection on IFU data.

This is the controlling routine for the outlier detection process. It loads and sets the various input data and parameters needed to flag outliers. Pixel are flagged as outliers based on the MINIMUM difference a pixel has with its neighbor across all the input cal files.

Notes

This routine performs the following operations:

1. Extracts parameter settings from input ModelContainer and merges
   them with any user-provided values
2. Loop over cal files
   a. read in science data
   b. Store computed neighbor differences for all the pixels.
      The neighbor pixel  differences are defined by the dispersion axis.
      For MIRI, with the dispersion axis along the y axis, the neighbors that are used to
      to find the differences are to the left and right of each pixel being examined.
      For NIRSpec, with the dispersion along the x axis, the neighbors that are used to
      find the differences are above and below the pixel being examined.
3. For each input file store the  minimum of the pixel neighbor differences
4. Comparing all the differences from all the input data find the minimum neighbor difference
5. Normalize minimum difference to local median of difference array
6. select outliers by flagging those normailzed minimum values > threshold_percent
7. Updates input ImageModel DQ arrays with mask of detected outliers.

Initialize class for IFU data processing.

Parameters:
  • input_models (ModelContainer, str) – list of data models as ModelContainer or ASN file, one data model for each input 2-D ImageModel

  • reffiles (dict of JwstDataModel) – Dictionary of datamodels. Keys are reffile_types.

Methods Summary

create_optional_results_model(opt_info)

Creates an OutlierOutputModel from the computed arrays from outlier detection on IFU data.

do_detection()

Split data by detector to find outliers.

flag_outliers(idet, uq_det, ndet_files, ...)

Flag outlier pixels on IFU.

Methods Documentation

create_optional_results_model(opt_info)[source]

Creates an OutlierOutputModel from the computed arrays from outlier detection on IFU data.

Parameter

input_model: ~stdatamodels.jwst.datamodels.RampModel

opt_info: tuple The output arrays needed for the OultierOutputModel.

returns:

opt_model – The optional OutlierIFUOutputModel to be returned from the outlier_detection_ifu step.

rtype:

OutlierIFUOutputModel

do_detection()[source]

Split data by detector to find outliers.

flag_outliers(idet, uq_det, ndet_files, diffaxis, nx, ny, kern_size, threshold_percent, save_intermediate_results, ifu_second_check)[source]

Flag outlier pixels on IFU. In general we are searching for pixels that are a form of a bad pixel but not in bad pixel mask, because the bad pixels vary with time. This program will flag the DQ of input images as DO_NOT_USE and OUTLIER and set the associated science pixel to a Nan. This routine only works on data from one detector.

Parameters:
  • idet (int) – Integer indicating which detector we are working with

  • uq_det (string array) – Array of (unique) detector names found input data

  • n_det_files (int) – Number of files for the detector we are working on

  • diffaxis (int) – The axis to form the adjacent pixel differences

  • nx (int) – Size of input data on x axis

  • ny (int) – Since of inut data on y axis

  • threshold_percent (float) – Percent for flagging outliers. Flags pixels where the minimum difference between adjacent pixels for all the input data for a detector is above this percentage. The percentage is based on using all the pixels except a 4 X 4 row and column region around the detector that is often noisy.

  • save_intermediate_results (boolean) – If True then save intermediate output data

  • ifu_second_check (boolean) – If True then perform a secondary check searching for outliers. This will set outliers where ever the difference array of adjacent pixels is a Nan.