Order

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

Bases: MidModel

Multi-spectrum data object.

Parameters:
hdulastropy.io.fits.HDUList

FITS HDU list to load.

filenamestr

Filename associated with the FITS file.

numberint

Index number for the data object.

apertureint, optional

Aperture number for the data object.

num_aperturesint, optional

Total number of apertures expected.

Methods Summary

describe()

Describe the loaded data structure.

load_combined(hdu, filename)

Load an Order that is combined in a single extension.

load_split(hdul, filename[, num_apertures])

Load an Order that is split across multiple extensions.

retrieve(field[, level])

Return raw data for a specified field.

Methods Documentation

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

Describe the loaded data structure.

Returns:
detailsdict

A nested dictionary containing information for all fields.

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

Load an Order that is combined in a single extension.

Assumes each row describes a separate property of the data. The first row contains wavelength information, the second contains the measured flux, the third contains the error on the measured flux. The fourth row, if it exists, contains a fractional atmospheric transmission spectrum, for reference. The fifth row, if it exists, contains the instrument response.

Parameters:
hduastropy.io.fits.HDU

An HDU object.

filenamestr

Name of the FITS file.

load_split(hdul: HL, filename: str, num_apertures: int | None = None) None[source]

Load an Order that is split across multiple extensions.

All extensions in hdul whose data array only has one dimension are loaded into a Spectrum object.

Parameters:
hdulastropy.io.fits.HDUList

List of HDU objects.

filenamestr

Name of the FITS file.

num_aperturesint, optional

The number of expected apertures. If not provided, only 1 aperture is expected.

retrieve(field: str, level: str = 'raw') LowModels | ndarray | None[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