flint.configuration =================== .. py:module:: flint.configuration .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: flint.configuration.FORMAT_VERSION flint.configuration.KNOWN_HEADERS flint.configuration.KNOWN_OPERATIONS flint.configuration.MODE_OPTIONS_MAPPING flint.configuration.POLARISATION_MAPPING Classes ------- .. autoapisummary:: flint.configuration.Strategy Functions --------- .. autoapisummary:: flint.configuration._create_mode_mapping_defaults flint.configuration.cli flint.configuration.copy_and_timestamp_strategy_file flint.configuration.create_default_yaml flint.configuration.get_image_options_from_yaml flint.configuration.get_options_from_strategy flint.configuration.get_parser flint.configuration.get_selfcal_options_from_yaml flint.configuration.load_and_copy_strategy flint.configuration.load_strategy_yaml flint.configuration.verify_configuration flint.configuration.write_strategy_to_yaml Module Contents --------------- .. py:class:: Strategy Bases: :py:obj:`dict` Base representation for handling a loaded flint strategy .. py:function:: _create_mode_mapping_defaults() -> dict[str, Any] 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 :rtype: Dict[str, Any] .. py:function:: cli() -> None .. py:function:: copy_and_timestamp_strategy_file(output_dir: pathlib.Path, input_yaml: pathlib.Path) -> pathlib.Path Timestamp and copy the input strategy file to an output directory :param output_dir: Output directory the file will be copied to :type output_dir: Path :param input_yaml: The file to copy :type input_yaml: Path :returns: Copied and timestamped file path :rtype: Path .. py:function:: create_default_yaml(output_yaml: pathlib.Path, selfcal_rounds: int | None = None) -> pathlib.Path 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. :param output_yaml: Location to write the yaml file to. :type output_yaml: Path :param selfcal_rounds: Will specify the number of self-calibration loops to include the file. If None, there will be none written. Defaults to None. :type selfcal_rounds: Optional[int], optional :returns: Path to the written yaml output file. :rtype: Path .. py:function:: get_image_options_from_yaml(input_yaml: pathlib.Path | None = None, self_cal_rounds: bool = False) -> dict Stub to interact with configuration file. If a `input_yaml` file is provided an error is raised :param input_yaml: Should be None. Defaults to None. :type input_yaml: Optional[Path], optional :param self_cal_rounds: Whether options for first imaging is being provided, or options to supply for each self-cal round. Defaults to False. :type self_cal_rounds: bool, optional :returns: _description_ :rtype: Dict .. py:function:: 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] .. py:function:: get_parser() -> argparse.ArgumentParser .. py:function:: get_selfcal_options_from_yaml(input_yaml: pathlib.Path | None = None) -> dict Stub to represent interaction with a configurationf ile If a path is supplied, an error is raised. :param input_yaml: Path to the configuration file. . Defaults to Optional[Path]=None. :type input_yaml: Optional[Path], optional :returns: Mapping where the key is the self-calibration round, and values are key-value of updated gaincal options :rtype: Dict .. py:function:: load_and_copy_strategy(output_split_science_path: pathlib.Path, imaging_strategy: pathlib.Path | None = None) -> Strategy | None Load a strategy file and copy a timestamped version into the output directory that would contain the science processing. :param output_split_science_path: Where the strategy file should be copied to (where the data would be processed) :type output_split_science_path: Path :param imaging_strategy: Location of the strategy file. Defaults to None. :type imaging_strategy: Optional[Path], optional :returns: The loadded strategy file if provided, `None` otherwise :rtype: Union[Strategy, None] .. py:function:: load_strategy_yaml(input_yaml: pathlib.Path, verify: bool = True) -> Strategy 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. :param input_yaml: The imaging strategy to use :type input_yaml: Path :param verify: Apply some basic checks to ensure a correctly formed strategy. Defaults to True. :type verify: bool, optional :returns: The parameters of the imaging and self-calibration to use. :rtype: Strategy .. py:function:: verify_configuration(input_strategy: Strategy, raise_on_error: bool = True) -> bool Perform basic checks on the configuration file :param input_strategy: The loaded configuration file structure :type input_strategy: Strategy :param raise_on_error: Whether to raise an error should an issue in thew config file be found. Defaults to True. :type raise_on_error: bool, optional :raises ValueError: Whether structure is valid :returns: Config file is not valid. Raised only if `raise_on_error` is `True` :rtype: bool .. py:function:: write_strategy_to_yaml(strategy: Strategy, output_path: pathlib.Path) -> pathlib.Path Write the contents of a current strategy to a yaml file :param strategy: The strategy to write out :type strategy: Strategy :param output_path: Where to write the output YAML file to :type output_path: Path :returns: The path the output YAML file was written to :rtype: Path .. py:data:: FORMAT_VERSION :value: 0.2 .. py:data:: KNOWN_HEADERS :value: ('defaults', 'version') .. py:data:: KNOWN_OPERATIONS :value: ('selfcal', 'stokesv', 'subtractcube', 'polarisation') .. py:data:: MODE_OPTIONS_MAPPING .. py:data:: POLARISATION_MAPPING