low_comm_tools.ms_fixes.reverse_baselines

Attributes

FloatArray

IntArray

Classes

BaselineChunk

A chunk of rows read from the main table of a MeasurementSet,

Functions

_iter_baseline_chunks(...)

Iterate over rows of a MeasurementSet main table in chunks.

check_ant_1_lt_ant_2(→ bool)

Checks the baseline ordering in an MS.

check_baseline_ordering(→ None)

Check if user is happy to continue.

get_parser(→ argparse.ArgumentParser)

main(→ None)

reverse_baselines(→ pathlib.Path)

Reverse baseline order in an MS.

Module Contents

class low_comm_tools.ms_fixes.reverse_baselines.BaselineChunk[source]

Bases: NamedTuple

A chunk of rows read from the main table of a MeasurementSet, containing all columns needed to reverse baselines.

ant_1: IntArray[source]

ANTENNA1 indices, shape (chunk_size,).

ant_2: IntArray[source]

ANTENNA2 indices, shape (chunk_size,).

chunk_size: int[source]

Number of rows in this chunk (may be less than requested on the final chunk).

data: dict[str, low_comm_tools.ms_utils.ComplexArray][source]

Visibility data keyed by column name. Each array has shape (chunk_size, n_chan, n_corr).

row_start: int[source]

Starting row index of this chunk within the full table.

uvws: FloatArray[source]

UVW coordinates, shape (chunk_size, 3).

low_comm_tools.ms_fixes.reverse_baselines._iter_baseline_chunks(ms_table: casacore.tables.table, present_columns: list[str], chunk_size: int) collections.abc.Generator[BaselineChunk, None, None][source]

Iterate over rows of a MeasurementSet main table in chunks.

Parameters:
  • ms_table (table) – An opened, writable MeasurementSet main table.

  • present_columns (list[str]) – Visibility column names to read.

  • chunk_size (int) – Number of rows to read per chunk.

Yields:

BaselineChunk – One chunk of rows at a time.

low_comm_tools.ms_fixes.reverse_baselines.check_ant_1_lt_ant_2(ms_path: pathlib.Path) bool[source]

Checks the baseline ordering in an MS.

Returns True if ANTENNA1<ANTENNA2

Parameters:

ms_path (Path) – Path to MS

Raises:

VisError – If baseliene ordering is mixed

Returns:

True if ANTENNA1<ANTENNA2, False if ANTENNA1>ANTENNA2

Return type:

bool

low_comm_tools.ms_fixes.reverse_baselines.check_baseline_ordering(ms_path: pathlib.Path) None[source]

Check if user is happy to continue.

Will prompt for interaction if check_ordering_is_good returns True.

Parameters:

ms_path (Path) – Path to MS

low_comm_tools.ms_fixes.reverse_baselines.get_parser() argparse.ArgumentParser[source]
low_comm_tools.ms_fixes.reverse_baselines.main() None[source]
low_comm_tools.ms_fixes.reverse_baselines.reverse_baselines(ms_path: pathlib.Path, chunk_size: int = 1000) pathlib.Path[source]

Reverse baseline order in an MS.

Performs three steps on each row:
  1. Hermite transpose (transpose + conjugate) the data

  2. Swap ANTENNA1/ANTENNA2 label

  3. Negate UVWs

Parameters:
  • ms_path (Path) – Path to MS

  • chunk_size (int, optional) – Number of rows to process in a chunk. Defaults to 1000.

Raises:

RuntimeError – If no DATA-like are found

Returns:

Path to modified MS

Return type:

Path

type low_comm_tools.ms_fixes.reverse_baselines.FloatArray = npt.NDArray[np.floating[Any]][source]
type low_comm_tools.ms_fixes.reverse_baselines.IntArray = npt.NDArray[np.int64][source]