orca.transform.calibration

Visibility calibration operations.

Provides functions for direction-independent calibration of OVRO-LWA measurement sets, including bandpass solving and application.

Functions

di_cal

Solve for bandpass calibration from a single MS.

di_cal_multi_v2

Solve for bandpass from multiple concatenated MS files (with auto-retry).

di_cal_multi

Solve for bandpass from multiple concatenated MS files.

flag_bad_sol

Flag bad solutions in a bandpass table.

applycal_data_col

Apply calibration and write to a new measurement set.

applycal_data_col_nocopy

Apply calibration in-place without copying.

applycal_in_mem

Apply bandpass calibration to data array in memory.

applycal_in_mem_cross

Apply bandpass calibration to cross-correlation data in memory.

Attributes

logger

Functions

di_cal(→ str)

Perform DI calibration and solve for cal table.

di_cal_multi_v2(→ Optional[str])

Perform DI calibration on multiple integrations. Copy, concat, then solve.

di_cal_multi(→ Optional[str])

Perform DI calibration on multiple integrations. Copy, concat, then solve.

flag_bad_sol(→ str)

Flag bad solutions in a bandpass calibration table.

applycal_data_col(→ str)

Apply calibration and write to a new measurement set.

applycal_data_col_nocopy(→ str)

Apply calibration in-place without copying the measurement set.

applycal_in_mem(→ numpy.ndarray)

Apply bandpass calibration to visibility data in memory.

applycal_in_mem_cross(→ numpy.ndarray)

Apply bandpass calibration to cross-correlation visibility data.

Module Contents

orca.transform.calibration.logger[source]
orca.transform.calibration.di_cal(ms, out=None, do_polcal=False, refant='199') str[source]

Perform DI calibration and solve for cal table.

Parameters:
  • ms – Measurement set to solve with

  • out – Output path for the derived cal table (incl the table name). Default is None.

  • do_polcal – Do polarization calibration. Default is False.

Returns: Path to the derived cal table.

orca.transform.calibration.di_cal_multi_v2(ms_list, scrach_dir, out, do_polcal=False, refant='199', flag_ant=True) str | None[source]

Perform DI calibration on multiple integrations. Copy, concat, then solve.

Parameters:
  • ms_list – List of measurement sets to solve with

  • scrach_dir – Directory to store temporary files

  • out – Output path for the derived cal table.

  • do_polcal – Do polarization calibration. Default is False.

Returns: List of paths to the derived cal tables.

orca.transform.calibration.di_cal_multi(ms_list, scrach_dir, out, do_polcal=False, refant='199', flag_ant=True) str | None[source]

Perform DI calibration on multiple integrations. Copy, concat, then solve.

Parameters:
  • ms_list – List of measurement sets to solve with

  • scrach_dir – Directory to store temporary files

  • out – Output path for the derived cal table.

  • do_polcal – Do polarization calibration. Default is False.

Returns: List of paths to the derived cal tables.

orca.transform.calibration.flag_bad_sol(bcal: str) str[source]

Flag bad solutions in a bandpass calibration table.

Flags solutions with amplitudes below 1% of the median, which would cause excessive amplification when applied.

Parameters:

bcal – Path to the bandpass calibration table.

Returns:

Path to the modified calibration table.

orca.transform.calibration.applycal_data_col(ms: str, gaintable: str, out_ms: str) str[source]

Apply calibration and write to a new measurement set.

Copies the MS, applies calibration to CORRECTED_DATA, then replaces DATA with the calibrated values.

Parameters:
  • ms – Input measurement set.

  • gaintable – Calibration table to apply.

  • out_ms – Output path for the calibrated measurement set.

Returns:

Path to the calibrated measurement set.

orca.transform.calibration.applycal_data_col_nocopy(ms: str, gaintable: str) str[source]

Apply calibration in-place without copying the measurement set.

Uses Numba-accelerated in-memory calibration for performance.

Parameters:
  • ms – Path to the measurement set (modified in-place).

  • gaintable – Path to the bandpass calibration table.

Returns:

Path to the calibrated measurement set.

orca.transform.calibration.applycal_in_mem(data: numpy.ndarray, bcal: numpy.ndarray) numpy.ndarray[source]

Apply bandpass calibration to visibility data in memory.

Numba-JIT compiled function for efficient calibration application. Handles the full visibility matrix including both autocorrelations and cross-correlations.

Parameters:
  • data – Visibility data with shape (n_bl, n_chan, 4).

  • bcal – Bandpass gains with shape (n_ant, n_chan, 2).

Returns:

Calibrated visibility data with same shape as input.

orca.transform.calibration.applycal_in_mem_cross(data: numpy.ndarray, bcal: numpy.ndarray) numpy.ndarray[source]

Apply bandpass calibration to cross-correlation visibility data.

Numba-JIT compiled function for efficient calibration of cross-correlations only (excludes autocorrelations). Uses the same algorithm as applycal_in_mem but only iterates over baselines where antenna i < j.

Parameters:
  • data – Visibility data with shape (n_cross_bl, n_chan, 4).

  • bcal – Bandpass gains with shape (n_ant, n_chan, 2).

Returns:

Calibrated visibility data with same shape as input.