exorad.tasks.instrumentHandler module

class BuildChannels[source]

Bases: Task

Initialize and build all the channels in the payload

Parameters:
  • payload (dict) – main payload. Default is None

  • write (bool) – set to True to write the built dict to file. Default is None

  • output (str) – output object

Returns:

return a dict of built Instrument classes

Return type:

dict

Examples

>>> buildChannels = BuildChannels()
>>> channels = buildChannels(payload=payload, write=False, output=None)

Class initialisation, needed to prepare the task inputs reader

execute()[source]

Class execution. It runs on call and executes all the task actions returning the outputs. It requires the input with correct keywords

class BuildInstrument[source]

Bases: Task

Initialize and build an instrument

Parameters:
  • type (str) – instrument class

  • name (str) – instrument name

  • description (dict) – instrument description dictionary

  • payload (dict) – main payload. Default is None

  • write (bool) – set to True to write the built dict to file. Default is None

  • output (str) – output object

Returns:

return the built instrument class

Return type:

Instrument

Raises:

KeyError – if the indicated instrument class is not supported

Examples

>>> buildInstrument = BuildInstrument()
>>> instrument = buildInstrument(type='photometer', name='Phot',
>>>                              description=payload['channel']['Phot'],
>>>                              payload=payload, write=False, output=None)

Class initialisation, needed to prepare the task inputs reader

execute()[source]

Class execution. It runs on call and executes all the task actions returning the outputs. It requires the input with correct keywords

class GetChannelList[source]

Bases: Task

Returns a list of the channels of the specific type that are contained in the instrument options file

Parameters:
  • options (object) – payload description

  • channel_type (string) – type of channel to find

Returns:

list of strings with channel names

Return type:

list

Examples

>>> from exorad.tasks.loadOptions import LoadOptions
>>> loadOptions = LoadOptions()
>>> options = loadOptions(filename = 'path/to/file.xml')
>>> getDetectorList = GetChannelList()
>>> photometers_list = getDetectorList(options = options, channel_type = 'Photometer')
>>> spectrometers_list = getDetectorList(options = options, channel_type = 'Spectrometer')

Class initialisation, needed to prepare the task inputs reader

execute()[source]

Class execution. It runs on call and executes all the task actions returning the outputs. It requires the input with correct keywords

class LoadPayload[source]

Bases: Task

Loads payload and channels from dict

Parameters:

input (dict) – main dictionary

Returns:

  • dict – payload dict

  • dict – return a dict of built Instrument classes

Examples

>>> loadPayload = LoadPayload()
>>> channels = loadPayload(input=input)

Class initialisation, needed to prepare the task inputs reader

execute()[source]

Class execution. It runs on call and executes all the task actions returning the outputs. It requires the input with correct keywords

class MergeChannelsOutput[source]

Bases: Task

Merges the channels output tables

Parameters:

channels (dict)

Return type:

Table

Class initialisation, needed to prepare the task inputs reader

execute()[source]

Class execution. It runs on call and executes all the task actions returning the outputs. It requires the input with correct keywords

class PreparePayload[source]

Bases: Task

It loads the payload information and returns a dictionary containing the payload, a dictionary with the channels already built, and a couple with minimum and maximum wavelength investigated by the payload

Parameters:
  • payload_file (str) – xml file with payload description

  • output (str) – h5 output file

Returns:

  • dict – payload dictionary

  • dict – channels dictionary

  • couple – minimum and maximum investigated wavelength

Examples

>>> preparePayload = PreparePayload()
>>> payload, channels, (wl_min, wl_max) = PreparePayload(payload_file=payload, output=output)

Class initialisation, needed to prepare the task inputs reader

execute()[source]

Class execution. It runs on call and executes all the task actions returning the outputs. It requires the input with correct keywords