liger_iris_pipeline.datamodels.utils

Functions

class_from_model_type(init)

Get the model type from the primary header, lookup to get class

open([init, memmap, copy])

Creates a DataModel from a number of different types.

liger_iris_pipeline.datamodels.utils.class_from_model_type(init)[source]

Get the model type from the primary header, lookup to get class

Parameters: init (HDUList | AsdfFile): The initializer.

Returns: type | None: The LigerIRISDataModel class if found.

liger_iris_pipeline.datamodels.utils.open(init=None, memmap: bool = False, copy: bool = False, **kwargs)[source]

Creates a DataModel from a number of different types.

Args:
init (None | tuple | str | file object | astropy.io.fits.HDUList | numpy.ndarray | dict):

The input used to initialize the model:

  • None: A default data model with no shape.

  • tuple: A shape tuple to initialize empty data.

  • str: A file path to load data from (FITS, JSON, or ASDF).

  • file object: A readable file object.

  • astropy.io.fits.HDUList: Initialize from an ~astropy.io.fits.HDUList.

  • numpy.ndarray: A NumPy array to initialize the data.

  • dict: An object model tree for the data model.

memmap: (bool) (Turn memmap of file on or off. (default: False).

kwargs (dict): Additional arguments used to initialize the model.
  • validate_arrays (bool): If True, arrays will be validated against ndim, max_ndim, and datatype validators in the schemas.

Returns:

LigerIRISDataModel : The specific LigerIRISDataModel instance.