mirar.pipelines package

Subpackages

Submodules

mirar.pipelines.base_pipeline module

Module containing the base of the Pipeline

class.

Each Pipeline will have several configurations. A configuration corresponds to a list of BaseProcessor objects.

The pipeline will process data using a chosen list of these individual BaseProcessor objects.

class mirar.pipelines.base_pipeline.Pipeline(selected_configurations: str | list[str] = 'default', night: int | str = '')[source]

Bases: object

Base class for pipelines.

Each pipeline must have the following class variables:
  • a name (the name of the instrument

  • pipeline configurations

  • gain

  • a _load_raw_image() function

to load raw images and modify the headers etc as required

add_configuration(configuration_name: str, configuration: list[BaseProcessor])[source]

Add a new configuration to the pipeline.

Parameters:
  • configuration_name – Name of new configuration

  • configuration – the list of processors

Returns:

None

property all_pipeline_configurations

Dictionary containing all pipeline configurations

static configure_processors(processors: list[BaseProcessor], sub_dir: str = '') list[BaseProcessor][source]

Propagates the correct nightly setting to a list of processors.

Parameters:
  • processors – Processors to configure

  • sub_dir – night sub directory to use

Returns:

Updated processors

default_cal_requirements = None
static download_raw_images_for_night(night: str | int)[source]

Function to download images from a remote server

Parameters:

night – Night of data to download

Returns:

None

get_error_output_path() Path[source]

Generates a unique path for the error summary, in the output data directory. Makes the parent directory structure if needed.

Returns:

path for error summary

load_pipeline_configuration(configuration: str = 'default') list[BaseProcessor][source]

Load a particular named configuration from self.all_pipeline_configurations

Parameters:

configuration – configuration to be used

Returns:

list of processors

load_raw_image(path: str) ImageBatch[source]

Function to load in a raw image and create an Image object which can then be processed further

Parameters:

path – path of raw image

Returns:

Image object

property name

Unique name of pipeline , used to call it from the command via get_pipeline(). Should be the name of the instrument.

property non_linear_level

Non-linear level of instrument

pipelines = {'sedmv2': <class 'mirar.pipelines.sedmv2.sedmv2_pipeline.SEDMv2Pipeline'>, 'summer': <class 'mirar.pipelines.summer.summer_pipeline.SummerPipeline'>, 'winter': <class 'mirar.pipelines.winter.winter_pipeline.WINTERPipeline'>, 'wirc': <class 'mirar.pipelines.wirc.wirc_pipeline.WircPipeline'>}
postprocess_configuration(errorstack: ErrorStack, selected_configurations: str | list[str], processed_images: list[str] | None = None) list[BaseProcessor][source]

Generate a postprocessing/cleanup processor sequence, Used by Monitor class for realtime processing. The first step is to update the header of images with any saved errors in errorstack.

Parameters:
  • errorstack – Caught errors

  • selected_configurations – Configurations to use.

  • processed_images – list of processed images

Returns:

list of postprocess processors

reduce_images(dataset: Dataset | None = None, output_error_path: str | None = None, catch_all_errors: bool = True, selected_configurations: str | list[str] | None = None) tuple[Dataset, ErrorStack][source]

Function to process a given dataset.

Parameters:
  • dataset – dataset to process (can be empty)

  • output_error_path – optional path to write error summary

  • catch_all_errors – Either catch errors, or just immediately raise them

  • selected_configurations – Configuration to use

Returns:

Post-processing dataset and summary of errors caught

set_configuration(new_configuration: str = 'default') list[BaseProcessor][source]

Loads a new configuration for the pipeline

Parameters:

new_configuration – name of configuration

Returns:

list of corresponding processors

unpack_raw_image(path: str) Image | list[Image][source]
Function to load in a raw image and ensure it has

the correct format for the code.

This function, unlike _load_raw_image() is not protected.

Parameters:

path – path of raw image

Returns:

The image data and image header