Extract1dStep

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

Bases: JwstStep

Extract a 1-d spectrum from 2-d data

smoothing_length

If not None, the background regions (if any) will be smoothed with a boxcar function of this width along the dispersion direction. This should be an odd integer.

Type:

int or None

bkg_fit

A string indicating the type of fitting to be applied to background values in each column (or row, if the dispersion is vertical). Allowed values are poly, mean, and median. Default is None.

Type:

str

bkg_order

If not None, a polynomial with order bkg_order will be fit to each column (or row, if the dispersion direction is vertical) of the background region or regions. For a given column (row), one polynomial will be fit to all background regions. The polynomial will be evaluated at each pixel of the source extraction region(s) along the column (row), and the fitted value will be subtracted from the data value at that pixel. If both smoothing_length and bkg_order are not None, the boxcar smoothing will be done first.

Type:

int or None

bkg_sigma_clip

Background sigma clipping value to use on background to remove outliers and maximize the quality of the 1d spectrum

Type:

float

log_increment

if log_increment is greater than 0 (the default is 50) and the input data are multi-integration (which can be CubeModel or SlitModel), a message will be written to the log with log level INFO every log_increment integrations. This is intended to provide progress information when invoking the step interactively.

Type:

int

subtract_background

A flag which indicates whether the background should be subtracted. If None, the value in the extract_1d reference file will be used. If not None, this parameter overrides the value in the extract_1d reference file.

Type:

bool or None

use_source_posn

If True, the source and background extraction positions specified in the extract1d reference file (or the default position, if there is no reference file) will be shifted to account for the computed position of the source in the data. If None (the default), the values in the reference file will be used. Aperture offset is determined by computing the pixel location of the source based on its RA and Dec. It does not make sense to apply aperture offsets for extended sources, so this parameter can be overridden (set to False) internally by the step.

Type:

bool or None

center_xy

A list of 2 pixel coordinate values at which to place the center of the IFU extraction aperture, overriding any centering done by the step. Two values, in x,y order, are used for extraction from IFU cubes. Default is None.

Type:

int or None

apply_apcorr

Switch to select whether or not to apply an APERTURE correction during the Extract1dStep. Default is True

Type:

bool

ifu_autocen

Switch to turn on auto-centering for point source spectral extraction in IFU mode. Default is False.

Type:

bool

ifu_rfcorr

Switch to select whether or not to apply a 1d residual fringe correction for MIRI MRS IFU spectra. Default is False.

Type:

bool

ifu_set_srctype

For MIRI MRS IFU data override srctype and set it to either POINT or EXTENDED.

Type:

str

ifu_rscale

For MRS IFU data a value for changing the extraction radius. The value provided is the number of PSF FWHMs to use for the extraction radius. Values accepted are between 0.5 to 3.0. The default extraction size is set to 2 * FWHM. Values below 2 will result in a smaller radius, a value of 2 results in no change to the radius and a value above 2 results in a larger extraction radius.

Type:

float

ifu_covar_scale

Scaling factor by which to multiply the ERR values in extracted spectra to account for covariance between adjacent spaxels in the IFU data cube.

Type:

float

soss_atoca

Switch to toggle extraction of SOSS data with the ATOCA algorithm. WARNING: ATOCA results not fully validated, and require the photom step be turned off. Default is False, meaning SOSS data use box extraction.

Type:

bool, default=False

soss_threshold

Threshold value above which a pixel will be included when modeling the SOSS trace in ATOCA. Default is 0.01.

Type:

float

soss_n_os

Oversampling factor of the underlying wavelength grid when modeling the SOSS trace in ATOCA. Default is 2.

Type:

int

soss_transform

Rotation applied to the reference files to match the observation orientation. Default is None.

Type:

list[float]

soss_tikfac

The regularization factor used for extraction in ATOCA. If left to default value of None, ATOCA will find an optimized value.

Type:

float

soss_width

Aperture width used to extract the SOSS spectrum from the decontaminated trace in ATOCA. Default is 40.

Type:

float

soss_bad_pix

Method used to handle bad pixels, accepts either “model” or “masking”. Default method is “model”.

Type:

str

soss_modelname

Filename for optional model output of ATOCA traces and pixel weights.

Type:

str

soss_estimate

Filename or SpecModel of the estimate of the target flux. The estimate must be a SpecModel with wavelength and flux values.

Type:

str or SpecModel or None

soss_wave_grid_in

Filename or SossWaveGrid containing the wavelength grid used by ATOCA to model each pixel valid pixel of the detector. If not given, the grid is determined based on an estimate of the flux (soss_estimate), the relative tolerance (soss_rtol) required on each pixel model and the maximum grid size (soss_max_grid_size).

Type:

str or SossWaveGrid or None

soss_wave_grid_out

Filename to hold the wavelength grid calculated by ATOCA.

Type:

str or None

soss_rtol

The relative tolerance needed on a pixel model. It is used to determine the sampling of the soss_wave_grid when not directly given.

Type:

float

soss_max_grid_size

Maximum grid size allowed. It is used when soss_wave_grid is not provided to make sure the computation time or the memory used stays reasonable.

Type:

int

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

reference_file_types

spec

Methods Summary

process(input)

Execute the step.

Attributes Documentation

class_alias = 'extract_1d'
reference_file_types: ClassVar = ['extract1d', 'apcorr', 'wavemap', 'spectrace', 'specprofile', 'speckernel']
spec
smoothing_length = integer(default=None)  # background smoothing size
bkg_fit = option("poly", "mean", "median", None, default=None)  # background fitting type
bkg_order = integer(default=None, min=0)  # order of background polynomial fit
bkg_sigma_clip = float(default=3.0)  # background sigma clipping threshold
log_increment = integer(default=50)  # increment for multi-integration log messages
subtract_background = boolean(default=None)  # subtract background?
use_source_posn = boolean(default=None)  # use source coords to center extractions?
center_xy = float_list(min=2, max=2, default=None)  # IFU extraction x/y center
apply_apcorr = boolean(default=True)  # apply aperture corrections?
ifu_autocen = boolean(default=False) # Auto source centering for IFU point source data.
ifu_rfcorr = boolean(default=False) # Apply 1d residual fringe correction
ifu_set_srctype = option("POINT", "EXTENDED", None, default=None) # user-supplied source type
ifu_rscale = float(default=None, min=0.5, max=3) # Radius in terms of PSF FWHM to scale extraction radii
ifu_covar_scale = float(default=1.0) # Scaling factor to apply to errors to account for IFU cube covariance
soss_atoca = boolean(default=True)  # use ATOCA algorithm
soss_threshold = float(default=1e-2)  # TODO: threshold could be removed from inputs. Its use is too specific now.
soss_n_os = integer(default=2)  # minimum oversampling factor of the underlying wavelength grid used when modeling trace.
soss_wave_grid_in = input_file(default = None)  # Input wavelength grid used to model the detector
soss_wave_grid_out = string(default = None)  # Output wavelength grid solution filename
soss_estimate = input_file(default = None)  # Estimate used to generate the wavelength grid
soss_rtol = float(default=1.0e-4)  # Relative tolerance needed on a pixel model
soss_max_grid_size = integer(default=20000)  # Maximum grid size, if wave_grid not specified
soss_transform = list(default=None, min=3, max=3)  # rotation applied to the ref files to match observation.
soss_tikfac = float(default=None)  # regularization factor for NIRISS SOSS extraction
soss_width = float(default=40.)  # aperture width used to extract the 1D spectrum from the de-contaminated trace.
soss_bad_pix = option("model", "masking", default="masking")  # method used to handle bad pixels
soss_modelname = output_file(default = None)  # Filename for optional model output of traces and pixel weights

Methods Documentation

process(input)[source]

Execute the step.

Parameters:

input (JWST data model)

Returns:

This will be input_model if the step was skipped; otherwise, it will be a model containing 1-D extracted spectra.

Return type:

JWST data model