HighModel

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

Bases: object

Abstract class for high-level models.

These models correspond to a single FITS file which contain one or more mid-level models. They also define the methods by which the Eye interacts with models.

This class does not contain method implementations. It should be subclassed before using. Currently implemented subclasses are Grism and MultiOrder.

Parameters:
hdulastropy.io.fits.HDUList

FITS HDU list to load.

Attributes:
filenamestr

Filename associated with the HDU list.

iduuid.uuid4

Unique id (uuid4) associated with each HDU list. Note that it is different from the id in low_model (filename).

indexint

Model index number.

enabled: bool

Indicates if a high model is enabled and thus visible in plots or not.

default_ndims: int

Default number of dimensions depending on the type of dataset.

bookslist

List of mid_model.Book objects.

orderslist

List of mid_model.Order objects based on the number of apertures (orders) in a dataset.

Methods Summary

ap_order_count()

Retrieve the number of apertures and orders loaded.

enable_orders(order_flags[, enable, aperture])

Enable or disable specified orders.

enabled_state()

Return the enabled status for all loaded data.

extensions()

Retrieve all loaded extension names.

list_enabled()

Return a list of enabled med-level objects.

load_data()

Load the data into the model.

retrieve(**kwargs)

Retrieve data from the model.

set_enabled_state(state)

Set a mid-level model to a new enabled state.

spectral_data_check()

Check if an input data file contains spectral data.

spectral_test()

Check if an input data file contains spectral data.

valid_field(field)

Determine if a field is valid for the loaded data.

Methods Documentation

ap_order_count()[source]

Retrieve the number of apertures and orders loaded.

Returns:
num_aperture, num_orderint, int

The aperture and order count.

enable_orders(order_flags: List[int], enable: bool | None = True, aperture: bool | None = False) None[source]

Enable or disable specified orders.

Parameters:
order_flagslist of int

Orders to update.

enablebool, optional

If True, specified orders are enabled. If False, they are disabled.

aperturebool, optional

If True, apertures are expected. Currently has no effect.

enabled_state() Dict[str, bool | Dict[str, bool]][source]

Return the enabled status for all loaded data.

Returns:
enableddict

Keys are ‘high’ or the mid-level model names; values are either boolean flags or sub-dictionaries with the same structure with field name keys.

extensions()[source]

Retrieve all loaded extension names.

Returns:
extensionslist of str

All extension names present in self.hdul.

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

Return a list of enabled med-level objects.

Returns:
full_enableddict

Dictionary that lists the enabled Orders and Books. Keys are ‘orders’, ‘books’, and ‘apertures’; values are lists of mid-level model objects.

load_data() None[source]

Load the data into the model.

retrieve(**kwargs) None[source]

Retrieve data from the model.

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

Set a mid-level model to a new enabled state.

Parameters:
statedict

Keys are ‘high’ or the mid-level model names; values are either boolean flags or sub-dictionaries with the same structure with field name keys.

Returns:
spectral_data_check() bool[source]

Check if an input data file contains spectral data.

This test is based on specific product types known to contain spectral data.

Returns:
bool

True if spectral data is present; False otherwise.

spectral_test()[source]

Check if an input data file contains spectral data.

This test is based on the file and data structure. There are two possible conditions for spectral data files:

  • a ‘SPECTRAL_FLUX*’ extension is present

  • the first extension contains at least 1 row of data and not more than 5 rows of data

Returns:
bool

True if spectral data is present; False otherwise.

valid_field(field: str) bool[source]

Determine if a field is valid for the loaded data.

Parameters:
fieldstr

Name of field.

Returns:
checkbool

True if the field is valid, False otherwise.