location_from_wcs

jwst.extract_1d.source_location.location_from_wcs(input_model, slit, make_trace=True)[source]

Get the cross-dispersion location of the spectrum, based on the WCS.

None values will be returned if there was insufficient information available, e.g. if the wavelength attribute or wcs function is not defined.

Parameters:
input_modelDataModel

The input science model containing metadata information.

slitDataModel or None

One slit from a MultiSlitModel (or similar), or None. The WCS and target coordinates will be retrieved from slit unless slit is None. In that case, they will be retrieved from input_model.

make_tracebool, optional

If True, the source position will be calculated for each dispersion element and returned in trace. If False, None is returned.

Returns:
middleint or None

Pixel coordinate in the dispersion direction within the 2-D cutout (or the entire input image) at the middle of the WCS bounding box. This is the point at which to determine the nominal extraction location, in case it varies along the spectrum. The offset will then be the difference between location (below) and the nominal location.

middle_wlfloat or None

The wavelength at pixel middle.

locationfloat or None

Pixel coordinate in the cross-dispersion direction within the spectral image that is at the planned target location. The spectral extraction region should be centered here.

tracendarray or None

An array of source positions, one per dispersion element, corresponding to the location at each point in the wavelength array. If the input data is resampled, the trace corresponds directly to the location. If the trace could not be generated, or make_trace is False, None is returned.