Grism

class sofia_redux.visualization.models.high_model.Grism(hdul: HDUList)[source]

Bases: HighModel

High level model describing a Grism data file.

Parameters:
hdulastropy.io.fits.HDUList

The HDU list from a Grism FITS file.

Attributes:
default_fieldstr

Default field for the high model, usually ‘spectral_flux’.

default_ndimsint

Default expected data dimensionality.

num_ordersint

Number of orders loaded.

Methods Summary

list_enabled()

List the enabled Books and Orders.

load_data()

Parse the contents of the HDUL into appropriate classes.

retrieve([book, field, level, order, aperture])

Access contents of lower level models.

valid_field(field)

Determine if a field is valid.

Methods Documentation

list_enabled() Dict[str, List[int]][source]

List the enabled Books and Orders.

Returns:
full_enableddict

Dictionary listing the enabled books and orders.

load_data() None[source]

Parse the contents of the HDUL into appropriate classes.

A file is read in either on the basis of its name or the instrument. Some Grism files only have one extension, without associated image data. In this case, the Book object is not instantiated.

retrieve(book: int | None = None, field: str = '', level: str = 'raw', order: int | None = None, aperture: int | None = None) MidModels | LowModels | ndarray | None[source]

Access contents of lower level models.

Parameters:
bookint, optional

Book number to be returned.

fieldstr, optional

The field to retrieve. Required for ‘low’ and ‘raw’ levels.

level{‘high’, ‘low’, ‘raw’}, optional

The level of the data to return.

orderint, optional

Order number to be returned.

apertureint, optional

Aperture number to be returned.

Returns:
datalow_model.LowModel or mid_model.MidModel or array-like

The requested data set. Can be a Book, Order, Image, Spectrum, or numpy array. If the parameters are not valid (i.e. no loaded data matches them) then None is returned.

valid_field(field: str) bool[source]

Determine if a field is valid.

Parameters:
fieldstr

Name of field, e.g. ‘wavepos’ or ‘flux’.

Returns:
checkbool

True if the field is valid, False otherwise.