flint.prefect.flows.subtract_cube_pipeline

This is a workflow to subtract a continuum model and image the channel-wise data

Unlike the continuum imaging and self-calibnration pipeline this flow currently expects that all measurement sets are in the flint format, which means other than the naming scheme that they have been been preprocessed to place them in the IAU frame and have had their fields table updated. That is to say that they have already been preprocessed and fixed.

Functions

_check_and_verify_options(→ None)

Verify that the options supplied to run the subtract field options make sense

cli(→ None)

find_and_setup_mss(→ tuple[flint.ms.MS, Ellipsis])

Search for MSs in a directory and, if necessary, perform checks around

find_mss_to_image(→ tuple[flint.ms.MS, Ellipsis])

Search for MSs to image. See flint.ms.find_mss for further details.

flow_addmodel_to_mss(→ tuple[flint.ms.MS, Ellipsis])

Separate flow to perform the potentially expensive model prediction

flow_subtract_cube(→ None)

get_parser(→ configargparse.ArgumentParser)

setup_run_subtract_flow(→ None)

task_combine_all_linmos_images(→ pathlib.Path)

Use the fits-cube package to take all input images and create a single output cube.

task_map_all_wsclean(...)

A single task that internally runs the wsclean imager task while iterates over

Module Contents

flint.prefect.flows.subtract_cube_pipeline._check_and_verify_options(subtract_field_options: flint.options.SubtractFieldOptions | None = None, addmodel_subtract_field_options: flint.options.AddModelSubtractFieldOptions | None = None, crystalball_subtract_field_options: flint.predict.crystalball.CrystalBallOptions | None = None) None[source]

Verify that the options supplied to run the subtract field options make sense

flint.prefect.flows.subtract_cube_pipeline.cli() None[source]
flint.prefect.flows.subtract_cube_pipeline.find_and_setup_mss(science_path_or_mss: pathlib.Path | tuple[flint.ms.MS, Ellipsis], expected_ms_count: int, data_column: str) tuple[flint.ms.MS, Ellipsis][source]

Search for MSs in a directory and, if necessary, perform checks around their consistency. If the input data appear to be collection of MSs already assume they have already been set and checked for consistency.

Parameters:
  • science_path_or_mss (Union[Path, List[MS, ...]]) – Path to search or existing MSs

  • expected_ms_count (int) – Expected number of MSs to find

  • data_column (str) – The data column to nominate if creating MSs after searching

Raises:

FrequencyMismatchError – Raised when frequency information is not consistent

Returns:

Collection of MSs

Return type:

Tuple[MS, …]

flint.prefect.flows.subtract_cube_pipeline.find_mss_to_image(mss_parent_path: pathlib.Path, expected_ms_count: int | None = None, data_column: str = 'CORRECTED_DATA', model_column: str = 'MODEL_DATA') tuple[flint.ms.MS, Ellipsis][source]

Search for MSs to image. See flint.ms.find_mss for further details.

Parameters:
  • mss_parent_path (Path) – Path to search for MSs in

  • expected_ms_count (Optional[int], optional) – Expected number of measurement sets to find. Defaults to None.

  • data_column (str, optional) – The nominated data column that should eb set. Defaults to “CORRECTED_DATA”.

  • model_column (str, optional) – The nominated model data column that should be set. Defaults to “MODEL_DATA”.

Returns:

Collect of MSs

Return type:

Tuple[MS, …]

flint.prefect.flows.subtract_cube_pipeline.flow_addmodel_to_mss(science_path_or_mss: pathlib.Path | tuple[flint.ms.MS, Ellipsis], addmodel_subtract_field_options: flint.options.AddModelSubtractFieldOptions, expected_ms: int, data_column: str) tuple[flint.ms.MS, Ellipsis][source]

Separate flow to perform the potentially expensive model prediction into MSs

flint.prefect.flows.subtract_cube_pipeline.flow_subtract_cube(science_path: pathlib.Path, subtract_field_options: flint.options.SubtractFieldOptions, addmodel_subtract_field_options: flint.options.AddModelSubtractFieldOptions, crystalball_subtract_field_options: flint.predict.crystalball.CrystalBallOptions) None[source]
flint.prefect.flows.subtract_cube_pipeline.get_parser() configargparse.ArgumentParser[source]
flint.prefect.flows.subtract_cube_pipeline.setup_run_subtract_flow(science_path: pathlib.Path, subtract_field_options: flint.options.SubtractFieldOptions, addmodel_subtract_field_options: flint.options.AddModelSubtractFieldOptions, crystalball_subtract_field_options: flint.predict.crystalball.CrystalBallOptions, cluster_config: pathlib.Path) None[source]
flint.prefect.flows.subtract_cube_pipeline.task_combine_all_linmos_images(linmos_commands: list[flint.coadd.linmos.LinmosResult], remove_original_images: bool = False, combine_weights: bool = False, time_domain: bool = False, update_fits_cube_options: dict[str, Any] | None = None) pathlib.Path[source]

Use the fits-cube package to take all input images and create a single output cube.

Parameters:
  • linmos_commands (list[LinmosResult]) – The output linmos commands to concatenated into a single cube.

  • remove_original_images (bool, optional) – Remove the original images after the cube has been formed. Defaults to False.

  • combine_weights (bool, optional) – Whether to concatenated the images or the weights that are described by the input linmos_commands. Defaults to False.

  • time_domain (bool, optional) – Whether images are to be formed on the spectral or time axis. Defaults to False.

  • bounding_box (bool, optional) – Whether to trim the output cube to include only valid pixels (see fitscube docs). Defaults to False.

  • invalidate_zeros (bool, optional) – Where to mark pixels that are exactly zero as invalid (replace with a NaN). Defaults to False.

Returns:

The output cube path

Return type:

Path

flint.prefect.flows.subtract_cube_pipeline.task_map_all_wsclean(in_mss: list[flint.ms.MS], *args, **kwargs) list[flint.imager.wsclean.WSCleanResult][source]

A single task that internally runs the wsclean imager task while iterates over the input list of measurement sets when run. It performs the same operation as the prefect task enabled map operator, but unlike the .map method all outputs are tracked in a single prefect task. This is used to lower the load on the prefect server.

Parameters:

in_mss (list[MS]) – List of measurement sets to image

Returns:

The list of output wsclean results

Return type:

list[WSCleanResult]