disperse

jwst.wfss_contam.disperse.disperse(xs, ys, fluxes, band_wavelengths, source_ids_per_pixel, order, wmin, wmax, sens_waves, sens_resp, direct_image_wcs, grism_wcs, naxis, oversample_factor=2, basis_models=None)[source]

Compute the dispersed image pixel values from the direct image.

Parameters:
xsndarray

Flat array of X coordinates of pixels in the direct image

ysndarray

Flat array of Y coordinates of pixels in the direct image

fluxesndarray of shape (N, n_pixels)

Fluxes of the pixels in the direct image corresponding to xs, ys, in units of MJy/sr. N is the number of photometric bands; use N=1 for a flat (wavelength-independent) SED. Note in that case the array must still be 2-D.

band_wavelengthsndarray

Central wavelengths (in microns) of each photometric band in fluxes (shape (N,)). Fluxes are linearly interpolated onto the internal wavelength grid. Fluxes are held constant (flat extrapolation) outside the covered wavelength range. For a flat SED this can be any length-1 array, as it is not used with N=1.

source_ids_per_pixelint array

Source IDs of the input pixels in the segmentation map

orderint

Spectral order number

wminfloat

Minimum wavelength for dispersed spectra

wmaxfloat

Maximum wavelength for dispersed spectra

sens_wavesfloat array

Wavelength array from photom reference file. Expected unit is micron.

sens_respfloat array

Response (flux calibration) array from photom reference file. Expected units are (micron) * (MJy / sr) / (ADU/s).

direct_image_wcsWCS object

WCS object for the direct image and segmentation map

grism_wcsWCS object

WCS object for the grism image

naxistuple

Dimensions of the grism image (naxis[0], naxis[1])

oversample_factorint, optional

Factor by which to oversample the wavelength grid

basis_modelslist[Callable], optional

Flux distributions to evaluate at each wavelength. Typically these will be single polynomial orders, e.g. [lambda x: x, lambda x: x^2], …] the coefficients of which are linearly fit later.

Returns:
outputs_by_sourcedict

Dictionary containing dispersed images and bounds for each source ID in the specified spectral order.