MidModel

class sofia_redux.visualization.models.mid_model.MidModel(hdul: HDUList, filename: str, number: int, aperture: int | None = None)[source]

Bases: object

Describe a mid-level data object.

A mid-level data object represents a single coherent observation structure. These can be an image (containing flux values, uncertainties, instrumental response, etc.) or a spectrum (consisting of the flux values, uncertainties, atmospheric transmission, etc).

Parameters:
hdulastropy.io.fits.HDUList

FITS HDU list to load.

filenamestr

Filename associated with the HDU list.

numberint

Index number for the data object.

apertureint

Aperture number for the data object.

Attributes:
numberint

Index number for the data object.

apertureint

Aperture number for the data object.

namestr

Name for the data object.

datadict

Dictionary of different types of data.

enabled: bool

Indicates if a model is enabled or not.

book_extensionslist

List of extension names known to be images.

order_extensionslist

List of extension names known to be spectra.

Methods Summary

describe()

Describe the loaded data structure.

load_combined(hdu, filename)

Load data that is combined in a single extension.

load_split(hdul, filename)

Load data that is split across multiple extensions.

populated()

Test for loaded data.

retrieve(field, level)

Return raw data for a specified field.

set_enabled_state(state)

Set enabled state for all contained low models.

set_visibility(enabled)

Enable or disable the model visibility.

valid_field(field)

Test field name validity.

Methods Documentation

describe() Dict[str, Any][source]

Describe the loaded data structure.

load_combined(hdu: ImageHDU, filename: str) None[source]

Load data that is combined in a single extension.

Parameters:
hduastropy.io.fits.HDU

An HDU object.

filenamestr

Name of the FITS file.

load_split(hdul: HDUList, filename: str) None[source]

Load data that is split across multiple extensions.

Parameters:
hdulastropy.io.fits.HDUList

List of HDU objects.

filenamestr

Name of the FITS file.

populated() bool[source]

Test for loaded data.

Returns:
bool

True if data has been loaded; False otherwise.

retrieve(field: str, level: str) LowModels | ndarray[source]

Return raw data for a specified field.

Parameters:
fieldstr

Name of field to pull from self.data.

level[‘low’, ‘raw’]

Determines the level of the data to return. ‘Low’ returns the Spectrum object and ‘raw’ will return the raw numeric data.

Returns:
datalow_model.LowModel or array-like

Retrieved raw data. Can be any subclass of low_model.LowModel, a numpy array, or None

set_enabled_state(state: Dict[str, bool]) None[source]

Set enabled state for all contained low models.

Parameters:
statedict

Keys are ‘enabled’ and field names for each contained low model. Values are boolean flags used to set the enabled state for the mid-model or the low fields, respectively.

set_visibility(enabled: bool) None[source]

Enable or disable the model visibility.

Parameters:
enabledbool

If True, the model is visible/enabled. If False, the model is hidden/disabled.

valid_field(field: str) bool[source]

Test field name validity.

Parameters:
fieldstr

Field name to test.

Returns:
bool

True if field has been loaded.