exosim.recipes.create_ndrs#

Classes#

CreateNDRs

Pipeline to create the observation NDRs.

Module Contents#

class CreateNDRs(input_file, output_file, options_file)[source]#

Bases: exosim.utils.timed_class.TimedClass, exosim.log.Logger

Pipeline to create the observation NDRs. This pipeline loads the configuration file and the Sub-Exposures.

Examples

>>> import exosim.recipes as recipes
>>> recipes.CreateNDRs(input_file='./input_file.h5',
>>>                    output_file = 'ndrs_file.h5',
>>>                    options_file='main _configuration.xml')
Parameters:
input[source]#
load_subexposure_data(ch)[source]#

It loads the sub-exposures data from file

Parameters:

ch (str) – channel name

Returns:

  • astropy.units.Quantity – spectral axes array

  • astropy.units.Quantity – spatial axes array

  • astropy.units.Quantity – temporal array

  • astropy.units.Quantity – integration times

  • int – number of exposures

  • int – number of NDRs per ramp

  • int – number of NDRs per group

Return type:

tuple[astropy.units.Quantity, astropy.units.Quantity, astropy.units.Quantity, astropy.units.Quantity, int, int, int]

prepare_output(spectral, spatial, time_line, integration_times, ch, ch_grp)[source]#

It produces the NDRs output per channel.

Parameters:
  • spectral (u.Quantity) – spectral axes array

  • spatial (u.Quantity) – spatial axes array

  • time_line (u.Quantity) – temporal array

  • integration_times (u.Quantity) – integration times

  • ch (str) – channel name

  • ch_grp (h5py.Group) – output group

Returns:

Return type:

tuple[exosim.models.signal.Counts, exosim.output.HDF5OutputGroup]

clean_output_tree(out, key_list)[source]#

Remove specified keys and their associated data from the output object.

This method iterates through a list of keys and deletes each key-value pair from the output object. Useful for cleaning up temporary or unnecessary data from the output.

Parameters:
  • out (HDF5OutputGroup) – The output object where key-value pairs are stored.

  • key_list (list of str) – A list of keys that need to be removed from the output object.

Return type:

None

Examples

>>> out = Output(
...     {"key1": "value1", "key2": "value2", "key3": "value3"}
... )
>>> clean_output(out, ["key1", "key3"])
>>> out.data
{'key2': 'value2'}

Notes

The method assumes that the keys specified in the key_list are present in the output object. If a key is not found, the delete_data method should handle it gracefully.

refactor_output(output_file)[source]#

Renames the original output file and creates a new one with its contents.

This method takes the original output file, renames it by appending ‘_unrefactored’ to its name, and then copies its content into a new file with the original name. The refactored (old version) file is deleted after the operation.

Parameters:

output_file (str) – The path of the original output file.

Return type:

None