flint.selfcal.utils

Gemeral help functions that could be used for self-calibration across different packages.

Functions

consider_skip_selfcal_on_round(→ bool)

Consider whether the self-calibration process (derive and applying solutions)

create_and_check_caltable_path(→ pathlib.Path)

Create the output name path for the gaincal solutions table.

get_channel_ranges_given_nspws(→ tuple[tuple[int, ...)

Given the number of channels construct the start and end channel indices

get_channel_ranges_given_nspws_for_ms(...)

Construct channel range intervals for the channels in a measurement set

Module Contents

flint.selfcal.utils.consider_skip_selfcal_on_round(current_round: int, skip_selfcal_on_rounds: int | list[int] | None) bool[source]

Consider whether the self-calibration process (derive and applying solutions) should be skipped on a particular imaging round.

Should current_round be in skip_selfcal_on_round then the self-calibration should be skipped and a True is returned.

Parameters:
  • current_round (int) – The current imaging round being considered

  • skip_selfcal_on_rounds (Union[int, List[int], None]) – The set of rounds that should be considerede for skipping. If None a False is returned.

Returns:

Whether the round is skipped (True) or performed (False)

Return type:

bool

flint.selfcal.utils.create_and_check_caltable_path(ms: flint.options.MS, channel_range: tuple[int, int] | None = None, remove_if_exists: bool = False) pathlib.Path[source]

Create the output name path for the gaincal solutions table.

If the table already exists it will be removed.

Parameters:
  • cal_ms (MS) – A description of the measurement set

  • channel_range (tuple[int,int] | None, optional) – Channel start and end, which will be appended. Defaults to None.

  • remove_if_exists (bool, optional) – If True and the table exists, remove it. Defaults to False.

Returns:

Output path of the solutions table

Return type:

Path

flint.selfcal.utils.get_channel_ranges_given_nspws(num_channels: int, nspws: int) tuple[tuple[int, int], Ellipsis][source]

Given the number of channels construct the start and end channel indices for the specified number of spectral windows. The interval step size will be ceiled should the the num_channels / nspw not be whole. In this case the last interval will be smaller than the others.

Parameters:
  • num_channels (int) – The number of channels spanning some band

  • nspws (int) – The number of segments across the band

Returns:

The start and end channel index spanning the number of channels.

Return type:

tuple[tuple[int,int]]

flint.selfcal.utils.get_channel_ranges_given_nspws_for_ms(ms: flint.options.MS | pathlib.Path, nspw: int) tuple[tuple[int, int], Ellipsis][source]

Construct channel range intervals for the channels in a measurement set given a desired number of spectral windows

Parameters:
  • ms (MS | Path) – The measurement set to construct channel ranges for

  • nspw (int) – Number of channel intervals to construct

Returns:

The collection of start and end channel intervals. The length will be nspw

Return type:

tuple[tuple[int,int], …]