flint.dp3

Run DP3 steps against measurement sets through DP3’s Python interface

Attributes

Classes

DP3AOFlaggerOptions

Options for the DP3 aoflagger step

DP3ApplyCalOptions

Options for the DP3 applycal step

DP3DDECalOptions

Options for the DP3 ddecal step

DP3GainCalOptions

Options for the DP3 gaincal step

DP3PreFlaggerOptions

Options for the DP3 preflagger step. Unset selections are not used.

Functions

check_columns(→ None)

Raise if any of the given columns is missing from the measurement set.

cli(→ None)

create_dp3_parset(→ dict[str, str])

The parset to read a measurement set and update it in place.

dp3_applycal(→ flint.options.MS)

Apply the solutions in an h5parm, writing the corrected data to output_column.

dp3_ddecal(→ flint.options.MS)

Solve for gains against the model column with ddecal.

dp3_flag(→ flint.options.MS)

Flag a measurement set with aoflagger, after the preflagger if given.

dp3_gaincal(→ flint.options.MS)

Solve for gains against the model column with gaincal.

dp3_solve_apply(→ flint.options.MS)

Solve against the model column and apply the solutions to output_column.

get_model_column(→ str)

The model column of a measurement set, which calibration needs.

get_parser(→ argparse.ArgumentParser)

Create the argument parser for the DP3 tasks.

options_to_parset(→ dict[str, str])

Turn step options into DP3 parset keys and values, skipping unset ones.

run_dp3(→ None)

Run a DP3 pipeline described by parset keys and values.

Module Contents

class flint.dp3.DP3AOFlaggerOptions(/, **data: Any)[source]

Bases: flint.options.BaseOptions

Options for the DP3 aoflagger step

classmethod check_strategy_is_lua(strategy: pathlib.Path | None) → pathlib.Path | None[source]

Strategies are lua scripts.

memoryperc: int | None[source]

Percentage of system memory aoflagger may use

strategy: pydantic.FilePath | None = None[source]

The aoflagger .lua strategy file. The packaged ASKAP strategy is used if unset.

timewindow: int | None[source]

Number of time slots flagged together

class flint.dp3.DP3ApplyCalOptions(/, **data: Any)[source]

Bases: flint.options.BaseOptions

Options for the DP3 applycal step

correction: list[ParsetWord][source]

Soltabs to apply in turn, e.g. [‘phase000’] or [‘rotationmeasure000’]

interpolation: Interpolation | None = None[source]

How solutions are interpolated in time and frequency

invert: bool | None = None[source]

Apply the inverse of the solutions, i.e. correct the data

solset: ParsetWord | None = None[source]

The solset holding the soltabs. DP3 picks one if unset.

updateweights: bool | None = None[source]

Update the weights along with the data

class flint.dp3.DP3DDECalOptions(/, **data: Any)[source]

Bases: flint.options.BaseOptions

Options for the DP3 ddecal step

maxiter: int | None[source]

Maximum number of solver iterations

mode: DDECalMode = 'scalarphase'[source]

What to solve for

nchan: int[source]

Number of channels per solution. 0 uses the whole band.

propagatesolutions: bool | None = None[source]

Start each solution interval from the previous solutions

solint: int[source]

Number of time slots per solution. 0 uses the whole observation.

tolerance: float | None[source]

Convergence tolerance of the solver

uvlambdamin: float | None[source]

Ignore baselines shorter than this many wavelengths

class flint.dp3.DP3GainCalOptions(/, **data: Any)[source]

Bases: flint.options.BaseOptions

Options for the DP3 gaincal step

caltype: GainCalType = 'scalarphase'[source]

What to solve for

maxiter: int | None[source]

Maximum number of solver iterations

nchan: int[source]

Number of channels per solution. 0 uses the whole band.

propagatesolutions: bool | None = None[source]

Start each solution interval from the previous solutions

solint: int[source]

Number of time slots per solution. 0 uses the whole observation.

tolerance: float | None[source]

Convergence tolerance of the solver

uvlambdamin: float | None[source]

Ignore baselines shorter than this many wavelengths

class flint.dp3.DP3PreFlaggerOptions(/, **data: Any)[source]

Bases: flint.options.BaseOptions

Options for the DP3 preflagger step. Unset selections are not used.

classmethod check_channel_ranges(chan: list[str] | None) → list[str] | None[source]

Channel ranges must not run backwards.

check_limits() → Self[source]

Each lower limit must be below its upper limit.

amplmax: float | None[source]

Flag data with an amplitude above this

amplmin: float | None[source]

Flag data with an amplitude below this

blmax: float | None[source]

Flag baselines longer than this length in metres

blmin: float | None[source]

Flag baselines shorter than this length in metres

chan: list[ChannelRange] | None = None[source]

Channels or inclusive channel ranges to flag, e.g. [‘0..7’, ‘287’]

corrtype: CorrelationType | None = None[source]

Flag only auto or cross correlations

uvmmax: float | None[source]

Flag data with a UV distance above this in metres

uvmmin: float | None[source]

Flag data with a UV distance below this in metres

flint.dp3.check_columns(ms: flint.options.MS, *columns: str | None) → None[source]

Raise if any of the given columns is missing from the measurement set.

flint.dp3.cli() → None[source]
flint.dp3.create_dp3_parset(ms: flint.options.MS, steps: list[str], output_column: str | None = None) → dict[str, str][source]

The parset to read a measurement set and update it in place.

flint.dp3.dp3_applycal(ms: flint.options.MS | pathlib.Path, h5parm: pathlib.Path | None = None, options: DP3ApplyCalOptions | None = None, output_column: str = 'CORRECTED_DATA') → flint.options.MS[source]

Apply the solutions in an h5parm, writing the corrected data to output_column.

Parameters:
  • ms (MS | Path) – The measurement set to correct

  • h5parm (Path | None, optional) – The solutions to apply. Defaults to ms.h5parm.

  • options (DP3ApplyCalOptions | None, optional) – Options for applycal. Defaults to None.

  • output_column (str, optional) – The column to write the corrected data to. Defaults to “CORRECTED_DATA”.

Raises:
  • ValueError – Raised if no h5parm is given or set on the measurement set

  • FileNotFoundError – Raised if the h5parm does not exist

Returns:

The measurement set with column set to output_column and h5parm set

Return type:

MS

flint.dp3.dp3_ddecal(ms: flint.options.MS | pathlib.Path, options: DP3DDECalOptions | None = None, h5parm: pathlib.Path | None = None) → flint.options.MS[source]

Solve for gains against the model column with ddecal.

Parameters:
  • ms (MS | Path) – The measurement set, with its model column set

  • options (DP3DDECalOptions | None, optional) – Options for ddecal. Defaults to None.

  • h5parm (Path | None, optional) – Where to write the solutions. Defaults to the MS path with a .ddecal.h5 suffix.

Raises:

ValueError – Raised if the model column is not set or missing

Returns:

The measurement set with h5parm set to the solutions

Return type:

MS

flint.dp3.dp3_flag(ms: flint.options.MS | pathlib.Path, aoflagger_options: DP3AOFlaggerOptions | None = None, preflagger_options: DP3PreFlaggerOptions | None = None) → flint.options.MS[source]

Flag a measurement set with aoflagger, after the preflagger if given.

Parameters:
  • ms (MS | Path) – The measurement set, flagging its nominated column

  • aoflagger_options (DP3AOFlaggerOptions | None, optional) – Options for aoflagger. Defaults to the packaged ASKAP strategy.

  • preflagger_options (DP3PreFlaggerOptions | None, optional) – If set, run the preflagger first. Defaults to None.

Returns:

The flagged measurement set

Return type:

MS

flint.dp3.dp3_gaincal(ms: flint.options.MS | pathlib.Path, options: DP3GainCalOptions | None = None, h5parm: pathlib.Path | None = None, output_column: str | None = None) → flint.options.MS[source]

Solve for gains against the model column with gaincal.

Parameters:
  • ms (MS | Path) – The measurement set, with its model column set

  • options (DP3GainCalOptions | None, optional) – Options for gaincal. Defaults to None.

  • h5parm (Path | None, optional) – Where to write the solutions. Defaults to the MS path with a .gaincal.h5 suffix.

  • output_column (str | None, optional) – If set, also apply the solutions in the same pass, writing to this column. Defaults to None.

Raises:

ValueError – Raised if the model column is not set or missing

Returns:

The measurement set with h5parm set, and column set to output_column if given

Return type:

MS

flint.dp3.dp3_solve_apply(ms: flint.options.MS | pathlib.Path, options: DP3DDECalOptions | DP3GainCalOptions | None = None, h5parm: pathlib.Path | None = None, output_column: str = 'CORRECTED_DATA') → flint.options.MS[source]

Solve against the model column and apply the solutions to output_column.

Parameters:
  • ms (MS | Path) – The measurement set, with its model column set

  • options (DP3DDECalOptions | DP3GainCalOptions | None, optional) – Solve with ddecal or gaincal depending on the type. Defaults to ddecal.

  • h5parm (Path | None, optional) – Where to write the solutions. Defaults to a path next to the MS.

  • output_column (str, optional) – The column to write the corrected data to. Defaults to “CORRECTED_DATA”.

Returns:

The measurement set with column set to output_column and h5parm set

Return type:

MS

flint.dp3.get_model_column(ms: flint.options.MS) → str[source]

The model column of a measurement set, which calibration needs.

flint.dp3.get_parser() → argparse.ArgumentParser[source]

Create the argument parser for the DP3 tasks.

flint.dp3.options_to_parset(step: str, options: flint.options.BaseOptions) → dict[str, str][source]

Turn step options into DP3 parset keys and values, skipping unset ones.

flint.dp3.run_dp3(parset: dict[str, str]) → None[source]

Run a DP3 pipeline described by parset keys and values.

type flint.dp3.ChannelRange = Annotated[str, StringConstraints(pattern='^\\d+(\\.\\.\\d+)?$')][source]
type flint.dp3.CorrelationType = Literal['auto', 'cross'][source]
type flint.dp3.DDECalMode = Literal['scalar', 'scalarphase', 'scalaramplitude', 'diagonal', 'diagonalphase', 'diagonalamplitude', 'fulljones', 'tec', 'tec+delay', 'tec+phase', 'tec+phase+delay', 'rotation', 'rotation+diagonal', 'faradayrotation', 'leakage', 'leakageamplitude'][source]
type flint.dp3.GainCalType = Literal['scalar', 'scalarphase', 'scalaramplitude', 'diagonal', 'diagonalphase', 'diagonalamplitude', 'fulljones', 'tec', 'tec+phase'][source]
type flint.dp3.Interpolation = Literal['nearest', 'linear'][source]
type flint.dp3.ParsetWord = Annotated[str, StringConstraints(pattern='^[^\\s,\\[\\]=]+$')][source]