Context

class Context(name: str | None = None)[source]

Bases: object

A class holds all pipeline state for a given execution.

The Pipeline Context class acts as a centralized container and access point for the pipeline's state, including dataset and observation project metadata, pipeline calibration status, process stage results from task execution, and other miscellaneous variables required and shared over a processing session. By encapsulating all state within this object, the entire pipeline session can be easily persisted to disk (e.g., via pickling) and later resumed.

name

The name of the context instance, also forms the root of the filename used for the pickled state.

output_dir

The working directory for pipeline output data.

products_dir

The directory for exported pipeline products.

report_dir

The directory for generated HTML reports.

logs

A dictionary mapping log types (CASA commands log, AQUA report, pipeline script, restore script) to their respective output filenames.

results

A list of task result (proxy) objects containing summaries of each executed task in the pipeline run.

task_counter

The index of the last completed task.

subtask_counter

The index of the last completed subtask.

observing_run

The top-level ObservingRun object, providing access to all pipeline.domain objects.

project_performance_parameters

ALMA OUS project performance data.

project_structure

ALMA project structure information.

project_summary

Project summary information.

calimlist

An ImageLibrary object for final calibrator images.

callibrary

A CalLibrary object managing the calibration state.

clean_list_info

A dictionary with information for the target image list.

clean_list_pending

A list of CleanTarget objects queued for cleaning.

clean_masks

A dictionary of clean mask names for reuse in IQUV imaging.

clean_thresholds

A dictionary of thresholds for reuse in IQUV imaging.

contfile

The filename for continuum frequency ranges.

imaging_mode

A string indicating the imaging mode, used to select parameter heuristics and product export settings.

imaging_parameters

A dictionary of computed imaging parameters.

linesfile

The filename for line frequency ranges to be excluded from continuum images.

per_spw_cont_sensitivities_all_chan

A dictionary containing sensitivity and imaging parameters.

processing_intents

A dictionary of processing intents for the run.

rmsimlist

An ImageLibrary object for RMS uncertainty images of science targets.

sciimlist

An ImageLibrary object for final science target images.

selfcal_resources

A list of files needed for self-calibration restoration.

selfcal_targets

A list of targets designated for self-calibration.

size_mitigation_parameters

A dictionary of parameters for managing imaging product size.

subimlist

An ImageLibrary object for cutout images of science targets.

synthesized_beams

A dictionary containing computed synthesized beam data.

Attributes Summary

products_dir

Return path to the products directory.

stage

Return task and sub-task stage number.

Methods Summary

get_oussid()

Get the parent OUS 'ousstatus' name.

get_recipe_name()

Get the recipe name from project structure.

save([filename])

Save a pickle of the Context to a file with given filename.

set_state(cls, name, value)

Set a context property using the class name, property name and property value.

Attributes Documentation

products_dir

Return path to the products directory.

stage

Return task and sub-task stage number.

Methods Documentation

get_oussid() str[source]

Get the parent OUS 'ousstatus' name. This is the sanitized OUS status UID.

get_recipe_name() str[source]

Get the recipe name from project structure.

save(filename: str | None = None) None[source]

Save a pickle of the Context to a file with given filename.

Parameters:

filename -- Name of the context file. If None, this will be set to <context name>.context.

set_state(cls: str, name: str, value: Any) None[source]

Set a context property using the class name, property name and property value.

The class name should be one of:

  1. 'ProjectSummary'

  2. 'ProjectStructure'

  3. 'PerformanceParameters'

Background: see CAS-9497 - add infrastructure to translate values from intent.xml to setter functions in casa_pipescript.

Parameters:
  • cls -- Class identifier.

  • name -- Property to set.

  • value -- Value to set.