Observation

class jwst.wfss_contam.observations.Observation(direct_image, segmentation_map, grism_wcs, direct_image_wcs, boundaries=None, max_cpu=1, max_pixels_per_chunk=50000.0, oversample_factor=2)[source]

Bases: object

Define an observation leading to a single grism image.

The Observation class is responsible for calling the various WCS transforms that convert a direct image and a segmentation image into a simulation of the grism image, making assumptions about the spectral properties of the direct image sources. When the disperse_order method is called one or more times, two products are created: the simulated dispersed image (simulated_image attribute) and the simulated MultiSlitModel (simulated_slits attribute).

Initialize all data and metadata for a given observation.

Parameters:
direct_imagenp.ndarray

Direct imaging data.

segmentation_mapnp.ndarray

Segmentation map data.

grism_wcsWCS

WCS object from grism image

direct_image_wcsWCS

WCS object from direct image

boundarieslist, optional

Start/Stop coordinates of the FOV within the larger seed image.

max_cpuint, optional

Max number of cpu’s to use when multiprocessing

max_pixels_per_chunkint, optional

Maximum number of pixels per chunk when dispersing sources

oversample_factorint, optional

Factor by which to oversample the wavelength grid

Methods Summary

chunk_sources(order, wmin, wmax, sens_waves, ...)

Chunk the sources into groups of max_pixels.

disperse_order(order, wmin, wmax, ...[, ...])

Disperse the sources for a given spectral order, with multiprocessing.

Methods Documentation

chunk_sources(order, wmin, wmax, sens_waves, sens_response, selected_ids=None, max_pixels=100000.0)[source]

Chunk the sources into groups of max_pixels.

Parameters:
orderint

Spectral order to process

wminfloat

Minimum wavelength for dispersed spectra

wmaxfloat

Maximum wavelength for dispersed spectra

sens_wavesndarray

Wavelength array from photom reference file

sens_responsendarray

Response (flux calibration) array from photom reference file

selected_idslist, optional

List of source IDs to process. If None, all sources are processed.

max_pixelsint, optional

Maximum number of pixels per chunk.

Returns:
disperse_argslist[list]

Outer list has length number of groups, and each inner list contains the arguments to disperse() for that group in the format that multiprocessing starmap expects.

disperse_order(order, wmin, wmax, sens_waves, sens_response, selected_ids=None)[source]

Disperse the sources for a given spectral order, with multiprocessing.

The simulated_slits and simulated_image attributes are updated in place.

Parameters:
orderint

Spectral order to process

wminfloat

Minimum wavelength for dispersed spectra

wmaxfloat

Maximum wavelength for dispersed spectra

sens_wavesndarray

Wavelength array from photom reference file

sens_responsendarray

Response (flux calibration) array from photom reference file

selected_idslist, optional

List of source IDs to process. If None, all sources are processed.