ResampleSpec

class jwst.resample.resample_spec.ResampleSpec(input_models, good_bits=0, output_wcs=None, wcs_pars=None, **kwargs)[source]

Bases: ResampleImage

Resample spectral data.

Notes

This routine performs the following operations:

1. Extracts parameter settings from input model, such as pixfrac,
   weight type, exposure time (if relevant), and kernel, and merges
   them with any user-provided values.
2. Creates output WCS based on input images and define mapping function
   between all input arrays and the output array.
3. Updates output data model with output arrays from drizzle, including
   a record of metadata from all input models.

Initialize the ResampleSpec object.

Parameters:
input_modelslist

List of data models, one for each input image

good_bitsint

Bit values that should be considered good when creating a mask

output_wcsdict

Output WCS parameters

wcs_parsdict

Additional parameters for WCS

**kwargsdict

Additional parameters to be passed into ResampleImage.__init__(). See the docstring of that method for more details.

Methods Summary

build_interpolated_output_wcs(input_models)

Create a spatial/spectral WCS output frame using all the input models.

build_nirspec_lamp_output_wcs(input_models, ...)

Create a spatial/spectral WCS output frame for NIRSpec lamp mode.

build_nirspec_output_wcs(input_models[, ...])

Create a spatial/spectral WCS covering the footprint of the input.

create_output_jwst_model([ref_input_model])

Create a new blank model and update its meta with info from ref_input_model.

update_output_model(model, info_dict)

Add spectroscopy-specific meta information to the output model.

Methods Documentation

build_interpolated_output_wcs(input_models, pixel_scale_ratio=1.0)[source]

Create a spatial/spectral WCS output frame using all the input models.

Creates output frame by linearly fitting RA, Dec along the slit and producing a lookup table to interpolate wavelengths in the dispersion direction.

Frames available in the output WCS are:

  • detector: image x, y

  • world: RA, Dec, wavelength

Parameters:
input_modelslist

List of data models, one for each input image

pixel_scale_ratiofloat

The ratio of the input pixel scale to the output pixel scale.

Returns:
output_wcsWCS object

A GWCS object defining the output frame WCS

build_nirspec_lamp_output_wcs(input_models, pixel_scale_ratio)[source]

Create a spatial/spectral WCS output frame for NIRSpec lamp mode.

Creates output frame by linearly fitting x_msa, y_msa along the slit and producing a lookup table to interpolate wavelengths in the dispersion direction.

Frames available in the output WCS are:

  • detector: image x, y

  • world: MSA x, MSA y, wavelength

Parameters:
input_modelslist

List of data models, one for each input image

pixel_scale_ratiofloat

The ratio of the input pixel scale to the output pixel scale.

Returns:
output_wcsWCS object

A GWCS object defining the output frame WCS.

build_nirspec_output_wcs(input_models, refmodel=None, good_bits=None, pixel_scale_ratio=1.0)[source]

Create a spatial/spectral WCS covering the footprint of the input.

Creates the output frame by linearly fitting RA, Dec along the slit and producing a lookup table to interpolate wavelengths in the dispersion direction.

For NIRSpec, the output WCS must also provide slit coordinates to support source location in the spectral extraction step. To do so, this step creates a lookup table for virtual slit coordinates, corresponding to the slit y-position at the center of the array in the input reference model. Slit x-position is set to zero for all pixels.

Frames available in the output WCS are:

  • detector: image x, y

  • slit_frame: slit x, slit y, wavelength

  • world: RA, Dec, wavelength

Parameters:
refmodelJwstDataModel, optional

The reference input image from which the fiducial WCS is created. If not specified, the first image in input_models. If the first model is empty (all-NaN or all-zero), the first non-empty model is used.

Returns:
output_wcsWCS

A GWCS object defining the output frame WCS.

create_output_jwst_model(ref_input_model=None)[source]

Create a new blank model and update its meta with info from ref_input_model.

Parameters:
ref_input_modelJwstDataModel, optional

The reference input model from which to copy meta data.

Returns:
SlitModel

A new blank model with updated meta data.

update_output_model(model, info_dict)[source]

Add spectroscopy-specific meta information to the output model.

Parameters:
modelSlitModel

The output model to be updated.

info_dictdict

A dictionary containing information about the resampling process.