flint.configuration

Basic utilities to load operational parameters from a yaml-based configuration file. The idea being that a configuration file would be used to specify the options for imaging and self-calibration throughout the pipeline.

Attributes

Classes

Strategy

Base representation for handling a loaded flint

Functions

_create_mode_mapping_defaults(→ dict[str, Any])

Create the default key-values for each of the registered Option classes

cli(→ None)

copy_and_timestamp_strategy_file(→ pathlib.Path)

Timestamp and copy the input strategy file to an

create_default_yaml(→ pathlib.Path)

Create an example strategy yaml file that outlines the options to use at varies stages

get_image_options_from_yaml(→ dict)

Stub to interact with configuration file.

get_options_from_strategy(→ dict[Any, Any])

get_parser(→ argparse.ArgumentParser)

get_selfcal_options_from_yaml(→ dict)

Stub to represent interaction with a configurationf ile

load_and_copy_strategy(→ Strategy | None)

Load a strategy file and copy a timestamped version into the output directory

load_strategy_yaml(→ Strategy)

Load in a flint based configuration file, which

verify_configuration(→ bool)

Perform basic checks on the configuration file

write_strategy_to_yaml(→ pathlib.Path)

Write the contents of a current strategy to a yaml file

Module Contents

class flint.configuration.Strategy[source]

Bases: dict

Base representation for handling a loaded flint strategy

flint.configuration._create_mode_mapping_defaults() dict[str, Any][source]

Create the default key-values for each of the registered Option classes

Returns:

Name of mode and the supported keys and default values for each

Return type:

Dict[str, Any]

flint.configuration.cli() None[source]
flint.configuration.copy_and_timestamp_strategy_file(output_dir: pathlib.Path, input_yaml: pathlib.Path) pathlib.Path[source]

Timestamp and copy the input strategy file to an output directory

Parameters:
  • output_dir (Path) – Output directory the file will be copied to

  • input_yaml (Path) – The file to copy

Returns:

Copied and timestamped file path

Return type:

Path

flint.configuration.create_default_yaml(output_yaml: pathlib.Path, selfcal_rounds: int | None = None) pathlib.Path[source]

Create an example strategy yaml file that outlines the options to use at varies stages of some assumed processing pipeline.

This is is completely experimental, and expected fields might change.

Parameters:
  • output_yaml (Path) – Location to write the yaml file to.

  • selfcal_rounds (Optional[int], optional) – Will specify the number of self-calibration loops to include the file. If None, there will be none written. Defaults to None.

Returns:

Path to the written yaml output file.

Return type:

Path

flint.configuration.get_image_options_from_yaml(input_yaml: pathlib.Path | None = None, self_cal_rounds: bool = False) dict[source]

Stub to interact with configuration file.

If a input_yaml file is provided an error is raised

Parameters:
  • input_yaml (Optional[Path], optional) – Should be None. Defaults to None.

  • self_cal_rounds (bool, optional) – Whether options for first imaging is being provided, or options to supply for each self-cal round. Defaults to False.

Returns:

_description_

Return type:

Dict

flint.configuration.get_options_from_strategy(strategy: Strategy | None | pathlib.Path, operation: str, mode: str = 'wsclean', round_info: int | None = None, max_round_override: bool = True, polarisation: str | None = None) dict[Any, Any][source]
flint.configuration.get_parser() argparse.ArgumentParser[source]
flint.configuration.get_selfcal_options_from_yaml(input_yaml: pathlib.Path | None = None) dict[source]

Stub to represent interaction with a configurationf ile

If a path is supplied, an error is raised.

Parameters:

input_yaml (Optional[Path], optional) – Path to the configuration file. . Defaults to Optional[Path]=None.

Returns:

Mapping where the key is the self-calibration round, and values are key-value of updated gaincal options

Return type:

Dict

flint.configuration.load_and_copy_strategy(output_split_science_path: pathlib.Path, imaging_strategy: pathlib.Path | None = None) Strategy | None[source]

Load a strategy file and copy a timestamped version into the output directory that would contain the science processing.

Parameters:
  • output_split_science_path (Path) – Where the strategy file should be copied to (where the data would be processed)

  • imaging_strategy (Optional[Path], optional) – Location of the strategy file. Defaults to None.

Returns:

The loadded strategy file if provided, None otherwise

Return type:

Union[Strategy, None]

flint.configuration.load_strategy_yaml(input_yaml: pathlib.Path, verify: bool = True) Strategy[source]

Load in a flint based configuration file, which will be used to form the strategy for imaging of a field.

The format of the return is likely to change. This is not to be relied on for the moment, and should be considered a toy. There will be a mutiny.

Parameters:
  • input_yaml (Path) – The imaging strategy to use

  • verify (bool, optional) – Apply some basic checks to ensure a correctly formed strategy. Defaults to True.

Returns:

The parameters of the imaging and self-calibration to use.

Return type:

Strategy

flint.configuration.verify_configuration(input_strategy: Strategy, raise_on_error: bool = True) bool[source]

Perform basic checks on the configuration file

Parameters:
  • input_strategy (Strategy) – The loaded configuration file structure

  • raise_on_error (bool, optional) – Whether to raise an error should an issue in thew config file be found. Defaults to True.

Raises:

ValueError – Whether structure is valid

Returns:

Config file is not valid. Raised only if raise_on_error is True

Return type:

bool

flint.configuration.write_strategy_to_yaml(strategy: Strategy, output_path: pathlib.Path) pathlib.Path[source]

Write the contents of a current strategy to a yaml file

Parameters:
  • strategy (Strategy) – The strategy to write out

  • output_path (Path) – Where to write the output YAML file to

Returns:

The path the output YAML file was written to

Return type:

Path

flint.configuration.FORMAT_VERSION = 0.2[source]
flint.configuration.KNOWN_HEADERS = ('defaults', 'version')[source]
flint.configuration.KNOWN_OPERATIONS = ('selfcal', 'stokesv', 'subtractcube', 'polarisation')[source]
flint.configuration.MODE_OPTIONS_MAPPING[source]
flint.configuration.POLARISATION_MAPPING[source]