numina.instrument — Instrument description

This module contains clases and functions used to create a model of the instrument during the reduction process. The model of the instrument is assembled from a set of JSON configuration files provided by each particular instrument package, usually in the submodule packagedrp.instrument.configs.

The functions in this module build the instrument representation as an object of a class derived from numina.instrument.generic.InstrumentGeneric.

numina.instrument.assembly.assembly_component(comp_store, keyval: str, date: str | datetime, dest=None, by_key='name') CG

Assembly an instrument configuration object.

Create an instrument object from a store of configurations using either the UUID of the configuration or the date of the configuration

Parameters:
  • comp_store (dict) –

  • keyval (str) –

  • date (str or datetime) –

  • dest (str, optional) –

  • by_key (str, optional) –

Returns:

an instrument configuration

Return type:

ComponentGeneric

numina.instrument.assembly.assembly_element(comp_store, etype: ElementEnum, tmpl: str, date: str | datetime, dest: str | None = None, by_key='name')

Assembly a given element in the object. :param comp_store: :type comp_store: dict :param etype: :type etype: ElementEnum :param tmpl: :param date: :type date: str or datetime :param dest: :param by_key: :type by_key: str, optional

Return type:

ComponentGeneric or SetupGeneric or PropertiesGeneric

Raises:

ValueError is there is a problem during element construction

numina.instrument.assembly.assembly_instrument(comp_store, keyval: str, date: str | datetime, by_key: str = 'name') CG

Assembly an instrument configuration object.

Create an instrument object from a store of configurations using either the UUID of the configuration or the date of the configuration

Parameters:
  • comp_store (dict) –

  • keyval (str) –

  • date (str or datetime) –

  • by_key (str, optional) –

Returns:

an instrument configuration

Return type:

InstrumentGeneric

numina.instrument.assembly.find_element(comp_store, etype: ElementEnum, keyval: str, date: str | datetime, by_key='name') dict[str, Any]

Find component of the given type in the component collection

Raises:

ValueError – If there is no component

numina.instrument.assembly.find_instrument(comp_store, keyval: str, date: str | datetime, by_key='name') dict[str, Any]

Find instrument in the component collection

Raises:

ValueError – If there is no instrument

numina.instrument.assembly.load_comp_store(comp_collection: ComponentCollection) dict
Parameters:

comp_collection (ComponentCollection) –

Return type:

dict

numina.instrument.assembly.load_paths_store(pkg_paths=None, file_paths=None) dict
Parameters:
  • pkg_paths

  • file_paths

Return type:

dict

Description of the origin of different configurations

class numina.instrument.configorigin.ElementOrigin(name: str, uuid_in: UUID | str, date_start: str | datetime | None = None, date_end: str | datetime | None = None, description: str = '')

Description of the origin of a particular configuration

is_valid_date(cdate: str | None) bool

Check if the element is valid for a given date

class numina.instrument.configorigin.UndefinedOrigin

Origin not defined

numina.instrument.device.visit(node: DeviceBase, root: str = '', result: dict | None = None, sep: str = '.')

Visit recursively all subdevices of node and return their configurations

class numina.instrument.generic.ComponentGeneric(name: str, origin: ElementOrigin | None = None, parent: DeviceBase | None = None)

Class representing a device component from a file

my_depends() set[str]

Compute the dependencies for me

class numina.instrument.generic.InstrumentGeneric(name: str, origin: ElementOrigin | None = None, parent: DeviceBase | None = None)

A representation of a hardware device