scopesim.source.source_fields

scopesim.source.source_fields#

Contains SourceField and its subclasses.

While the Source object serves as the high-level interface between target descriptions and the ScopeSim optical train, the actual information about the observed objects is stored in the SourceField classes, which constitute the members of Source.fields collection. Any target to be understood by ScopeSim can be characterized by either a Table of point sources, a two-dimensional image (ImageHDU) plus a separate (averaged) spectrum, or a three-dimensional datacube containing spectral information for each spatial pixel. This threefold abstraction is mirrored by the three final subclasses of SourceField: TableSourceField for point source tables with a spectrum reference for each individual point source, ImageSourceField for a 2D image with an average spectrum, and finally CubeSourceField with a full 3D data cube. The ImageSourceField and CubeSourceField also contain a WCS coordinate information and the wavelength axis of the CubeSourceField is available via the CubeSourceField.wave attribute.

In previous versions of ScopeSim (pre-0.9), the Source.fields collection simply held the individual Table and ImageHDU (2D or 3D) objects, which are now stored in the .field attribute of each source field. This new distinction of the different cases allows much clearer separation of the logic required to handle various operations on those objects, such as plotting and shifting the source, which previously had to incorporate a number of case differentiations that made the Source class rather overloaded with logic. This now also allows for well-structured validation logic of the individual source field data upon creation of each SourceField subclass instance.

Creation of the source field classes is usually handled by the Source class itself via its various constructions methods, so the user rarely interacts with these classes directly, except for debugging. They serve more as an internal abstraction layer to handle the different cases of target object descriptions, as described above.

The following class diagram illustrates the relationship between the SourceField subclasses:

```mmd classDiagram class SourceField{+field} class SpectrumSourceField{+spectra} class HDUSourceField{+wcs}

SourceField <|-- SpectrumSourceField SourceField <|– HDUSourceField SpectrumSourceField <|-- TableSourceField SpectrumSourceField <|– ImageSourceField HDUSourceField <|-- ImageSourceField HDUSourceField <|– CubeSourceField ```

Added in version 0.9.0.

Classes

BackgroundSourceField(field, spectra, ...)

Source field with spectrum only, for TER curve emissions.

CubeSourceField(*args, **kwargs)

Source field with 3D data cube.

HDUSourceField(*args, **kwargs)

Base class for source fields with HDU.

ImageSourceField(*args, **kwargs)

Source field with 2D image and a single (average) spectrum.

SourceField(field, *, meta)

Base class for source fields, not meant to be instantiated.

SpectrumSourceField(field, spectra, *, meta)

Base class for source fields with separate spectra (no cube).

TableSourceField(field, spectra, *, meta)

Source field with table of point source(s).