run_extract1d
- jwst.extract_1d.extract.run_extract1d(input_model, extract_ref_name='N/A', apcorr_ref_name=None, psf_ref_name='N/A', extraction_type='box', smoothing_length=None, bkg_fit=None, bkg_order=None, log_increment=50, subtract_background=None, use_source_posn=None, position_offset=0.0, model_nod_pair=False, optimize_psf_location=True, save_profile=False, save_scene_model=False, save_residual_image=False)[source]
Extract all 1-D spectra from an input model.
- Parameters:
- input_modelJWSTDataModel
The input science model.
- extract_ref_namestr
The name of the extract1d reference file, or “N/A”.
- apcorr_ref_namestr or None
Name of the APCORR reference file. Default is None
- psf_ref_namestr
The name of the PSF reference file, or “N/A”.
- extraction_typestr
Extraction type (‘box’ or ‘optimal’). Optimal extraction is only available if
psf_ref_name
is not “N/A”.- smoothing_lengthint or None
Width of a boxcar function for smoothing the background regions.
- bkg_fitstr or None
Type of fitting to apply to background values in each column (or row, if the dispersion is vertical). Allowed values are ‘mean’, ‘median’, ‘poly’, or None.
- bkg_orderint or None
Polynomial order for fitting to each column (or row, if the dispersion is vertical) of background. Only used if
bkg_fit
is ‘poly’. Allowed values are >= 0.- log_incrementint
If
log_increment
is greater than 0 and the input data are multi-integration, a message will be written to the log everylog_increment
integrations.- subtract_backgroundbool or None
User supplied flag indicating 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.
- use_source_posnbool or None
If True, the target and background positions specified in the reference file (or the default position, if there is no reference file) will be shifted to account for source position offset.
- position_offsetfloat
Number of pixels to shift the nominal source position in the cross-dispersion direction.
- model_nod_pairbool
If True, and if
extraction_type
is ‘optimal’, then a negative trace from nod subtraction is modeled alongside the positive source during extraction. Even if set to True, this will be attempted only if the input data has been background subtracted and the dither pattern indicates that only 2 nods were used.- optimize_psf_locationbool
If True, and if
extraction_type
is ‘optimal’, then the source location will be optimized, via iterative comparisons of the scene model with the input data.- save_profilebool
If True, the spatial profiles created for the input model will be returned as ImageModels. If False, the return value is None.
- save_scene_modelbool
If True, a model of the 2D flux as defined by the extraction aperture is returned as an ImageModel or CubeModel. If False, the return value is None.
- save_residual_imagebool
If True, the residual image (from the input minus the scene model) is returned as an ImageModel or CubeModel. If False, the return value is None.
- Returns:
- output_modelMultiSpecModel or TSOMultiSpecModel
A new data model containing the extracted spectra.
- profile_modelModelContainer, ImageModel, or None
If
save_profile
is True, the return value is an ImageModel containing the spatial profile with aperture weights, used in extracting a single slit, or else a container of ImageModels, one for each slit extracted. Otherwise, the return value is None.- scene_modelModelContainer, ImageModel, CubeModel, or None
If
save_scene_model
is True, the return value is an ImageModel or CubeModel matching the input data, containing a model of the flux as defined by the aperture, created during extraction. Otherwise, the return value is None.- residualModelContainer, ImageModel, CubeModel, or None
If
save_residual_image
is True, the return value is an ImageModel or CubeModel matching the input data, containing the residual image (from the input minus the scene model). Otherwise, the return value is None.