Stage 1
Created on Thurs Jul 21 17:30 2022
@author: MCR
Custom JWST DMS pipeline steps for Stage 1 (detector level processing).
- class exotedrf.stage1.DQInitStep(input_data, output_dir, deepframe=None)
Wrapper around default calwebb_detector1 Data Quality Initialization step.
- run(save_results=True, force_redo=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.DarkCurrentStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Dark Current Subtraction step.
- run(save_results=True, force_redo=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.GainScaleStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Gain Scale Correction step.
- run(save_results=True, force_redo=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.JumpStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Jump Detection step with some custom modifications.
- run(save_results=True, force_redo=False, flag_up_ramp=False, rejection_threshold=15, flag_in_time=True, time_rejection_threshold=10, time_window=5, do_plot=False, show_plot=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.LinearityStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Linearity Correction step.
- run(save_results=True, force_redo=False, do_plot=False, show_plot=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.OneOverFStep(input_data, baseline_ints, output_dir, method='scale-achromatic', timeseries=None, timeseries_o2=None, pixel_masks=None, background=None, centroids=None)
Wrapper around custom 1/f Correction Step.
- run(inner_mask_width=40, outer_mask_width=70, save_results=True, force_redo=False, do_plot=False, show_plot=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.RampFitStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Ramp Fit step.
- run(save_results=True, force_redo=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.RefPixStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Reference Pixel Correction step.
- run(save_results=True, force_redo=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.SaturationStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Saturation Detection step.
- run(save_results=True, force_redo=False, **kwargs)
Method to run the step.
- class exotedrf.stage1.SuperBiasStep(input_data, output_dir)
Wrapper around default calwebb_detector1 Super Bias Subtraction step.
- run(save_results=True, force_redo=False, do_plot=False, show_plot=False, **kwargs)
Method to run the step.
- exotedrf.stage1.flag_hot_pixels(result, deepframe, box_size=10, thresh=15, hot_pix=None)
Identify and flag additional hot pixels in a SOSS TSO which are not already in the default pipeline flags.
- Parameters:
result (jwst.datamodel, str) – Input datamodel, or path to.
deepframe (array-like(float), str) – Deep stack of the time series, or path to.
box_size (int) – Size of box around each pixel to consider.
thresh (int) – Sigma threshhold above which a pixel will be flagged.
hot_pix (array-like(bool), None) – Map of pixels to flag.
- Returns:
result (jwst.datamodel) – Input datamodel with newly flagged pixels added to pixeldq extension.
hot_pix (np.array(bool)) – Map of new flagged pixels.
- exotedrf.stage1.jumpstep_in_time(datafile, window=5, thresh=10, fileroot=None, save_results=True, output_dir=None)
Jump detection step in the temporal domain. This algorithm is based off of Nikolov+ (2014) and identifies cosmic ray hits in the temporal domain. All jumps for ngroup<=2 are replaced with the median of surrounding integrations, whereas jumps for ngroup>3 are flagged.
- Parameters:
datafile (str, RampModel) – Path to data file, or RampModel itself for a segment of the TSO. Should be 4D ramp.
window (int) – Number of integrations to use for cosmic ray flagging. Must be odd.
thresh (int) – Sigma threshold for a pixel to be flagged.
output_dir (str) – Directory to which to save results.
save_results (bool) – If True, save results to disk.
fileroot (str, None) – Root name for output file.
- Returns:
datafile – Data file corrected for cosmic ray hits.
- Return type:
RampModel
- exotedrf.stage1.oneoverfstep_scale(datafiles, baseline_ints, inner_mask_width=40, outer_mask_width=70, even_odd_rows=True, background=None, timeseries=None, timeseries_o2=None, output_dir=None, save_results=True, pixel_masks=None, fileroots=None, method='achromatic', centroids=None)
Custom 1/f correction routine to be applied at the group or integration level. A median stack is constructed using all out-of-transit integrations and subtracted from each individual integration. The column-wise median of this difference image is then subtracted from the original frame to correct 1/f noise. Outlier pixels, background contaminants, and the target trace itself can (should) be masked to improve the estimation.
- Parameters:
datafiles (array-like[str], array-like[RampModel], array-like[CubeModel]) – List of paths to data files, or datamodels themselves for each segment of the TSO. Should be 4D ramps, but 3D rate files are also accepted.
baseline_ints (array-like[int]) – Integration numbers of ingress and egress.
inner_mask_width (int) – Width around the trace to mask. For windowed methods, defines the inner window edge.
outer_mask_width (int) – For windowed methods, the outer edge of the window.
even_odd_rows (bool) – If True, calculate 1/f noise seperately for even and odd numbered rows.
background (str, array-like[float], None) – Model of background flux.
timeseries (array-like[float], str, None) – Estimate of normalized light curve(s), or path to file.
timeseries_o2 (array-like[float], str, None) – Estimate of normalized light curve(s) for order 2, or path to file. Only necessary if method is chromatic.
output_dir (str, None) – Directory to which to save results. Only necessary if saving results.
save_results (bool) – If True, save results to disk.
pixel_masks (array-like[str], None) – List of paths to maps of pixels to mask for each data segment. Should be 3D (nints, dimy, dimx).
fileroots (array-like[str], None) – Root names for output files. Only necessary if saving results.
method (str) – Options are “chromatic”, “achromatic”, or “achromatic-window”.
centroids (str, None) – File containing trace positions for each order.
- Returns:
results – RampModels for each segment, corrected for 1/f noise.
- Return type:
array-like[CubeModel]
- exotedrf.stage1.oneoverfstep_solve(datafiles, baseline_ints, trace_width=70, background=None, output_dir=None, save_results=True, pixel_masks=None, fileroots=None, do_plot=False, show_plot=False, centroids=None)
Custom 1/f correction routine to be applied at the group or integration level. 1/f noise level and median frame scaling is calculated independently for each pixel column. Outlier pixels and background contaminants can (should) be masked to improve the estimation.
- Parameters:
datafiles (array-like[str], array-like[RampModel], array-like[CubeModel]) – List of paths to data files, or datamodels themselves for each segment of the TSO. Should be 4D ramps, but 3D rate files are also accepted.
baseline_ints (array-like[int]) – Integration numbers of ingress and egress.
trace_width (int) – Defines the width around the trace to consider for MLE solving.
background (str, array-like[float], None) – Model of background flux.
output_dir (str, None) – Directory to which to save results. Only necessary if saving results.
save_results (bool) – If True, save results to disk.
pixel_masks (array-like[str], None) – List of paths to maps of pixels to mask for each data segment. Can be 3D (nints, dimy, dimx), or 2D (dimy, dimx).
fileroots (array-like[str], None) – Root names for output files. Only necessary if saving results.
do_plot (bool) – If True, do the step diagnostic plot.
show_plot (bool) – If True, show the step diagnostic plot instead of/in addition to saving it to file.
centroids (str, None) – Path to file containing trace positions for each order.
- Returns:
corrected_rampmodels – RampModels for each segment, corrected for 1/f noise.
- Return type:
array-like[CubeModel]
- exotedrf.stage1.run_stage1(results, background_model, baseline_ints=None, oof_method='scale-achromatic', timeseries=None, timeseries_o2=None, save_results=True, pixel_masks=None, force_redo=False, deepframe=None, flag_up_ramp=False, rejection_threshold=15, flag_in_time=True, time_rejection_threshold=10, root_dir='./', output_tag='', skip_steps=None, do_plot=False, show_plot=False, inner_mask_width=40, outer_mask_width=70, centroids=None, **kwargs)
Run the exoTEDRF Stage 1 pipeline: detector level processing, using a combination of official STScI DMS and custom steps. Documentation for the official DMS steps can be found here: https://jwst-pipeline.readthedocs.io/en/latest/jwst/pipeline/calwebb_detector1.html
- Parameters:
results (array-like[str]) – List of paths to input uncalibrated datafiles for all segments in an exposure.
background_model (array-like[float]) – SOSS background model.
baseline_ints (array-like[int]) – Integration numbers for transit ingress and egress.
oof_method (str) – 1/f correction method. Options are “scale-chromatic”, “scale-achromatic”, “scale-achromatic-window”, or “solve”.
timeseries (array-like[float], None) – Estimate of the normalized light curve, either 1D or 2D.
timeseries_o2 (array-like[float], None) – Estimate of the normalized light curve for order 2, either 1D or 2D.
save_results (bool) – If True, save results of each step to file.
pixel_masks (array-like[str], None) – For improved 1/f noise corecton. List of paths to outlier maps for each data segment. Can be 3D (nints, dimy, dimx), or 2D (dimy, dimx) files.
force_redo (bool) – If True, redo steps even if outputs files are already present.
deepframe (str, None) – Path to deep stack, such as one produced by BadPixStep.
flag_up_ramp (bool) – Whether to flag jumps up the ramp. This is the default flagging in the STScI pipeline. Note that this is broken as of jwst v1.12.5.
rejection_threshold (int) – For jump detection; sigma threshold for a pixel to be considered an outlier.
flag_in_time (bool) – If True, flag cosmic rays temporally in addition to the default up-the-ramp jump detection.
time_rejection_threshold (int) – Sigma threshold to flag outliers in temporal flagging.
root_dir (str) – Directory from which all relative paths are defined.
output_tag (str) – Name tag to append to pipeline outputs directory.
skip_steps (array-like[str], None) – Step names to skip (if any).
do_plot (bool) – If True, make step diagnostic plots.
show_plot (bool) – Only necessary if do_plot is True. Show the diagnostic plots in addition to/instead of saving to file.
inner_mask_width (int) – For 1/f correction. For scale-achromatic, defines the width around the trace to mask. For windowed methods, defines the inner edge of the window.
outer_mask_width (int) – For 1/f correction. For windowed methods, defines the outer edge of the window. For solve, defines the width around the trace to use.
centroids (str, None) – Path to file containing trace positions for each order.
- Returns:
results – Datafiles for each segment processed through Stage 1.
- Return type:
array-like[RampModel]