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_model (JWSTDataModel) – The input science model.
extract_ref_name (str) – The name of the extract1d reference file, or “N/A”.
apcorr_ref_name (str or None) – Name of the APCORR reference file. Default is None
psf_ref_name (str) – The name of the PSF reference file, or “N/A”.
extraction_type (str) – Extraction type (‘box’ or ‘optimal’). Optimal extraction is only available if
psf_ref_name
is not “N/A”.smoothing_length (int or None) – Width of a boxcar function for smoothing the background regions.
bkg_fit (str 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_order (int 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_increment (int) – 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_background (bool 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_posn (bool 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_offset (float) – Number of pixels to shift the nominal source position in the cross-dispersion direction.
model_nod_pair (bool) – 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_location (bool) – 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_profile (bool) – If True, the spatial profiles created for the input model will be returned as ImageModels. If False, the return value is None.
save_scene_model (bool) – 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_image (bool) – 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_model (MultiSpecModel or TSOMultiSpecModel) – A new data model containing the extracted spectra.
profile_model (ModelContainer, 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_model (ModelContainer, 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.residual (ModelContainer, 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.