orca.transform.gainscaling

Transforms that relate to amplitude scaling.

It uses autocorrelation to figure out the scaling factor between two snapshots on a per-antenna per-channel per-pol basis.

NOTE: It uses the autocorrelation flags to figure out which antennas are flagged and does not solve for those antennas.

Attributes

log

Functions

auto_corr_data_and_flag(→ Tuple[numpy.ndarray, ...)

Extract autocorrelation data and flags from a measurement set table.

calculate_gain_scale(→ numpy.ndarray)

Calculate the gain scaling factor to match autocorrelation levels.

apply_gain_scale_in_place(→ None)

Apply single pol scaling factor per antenna to cross-correlated data.

correct_scaling(to_scale_ms, target_ms[, data_column])

Correct for per-antenna per-pol per-channel scaling between two measurement sets.

Module Contents

orca.transform.gainscaling.log[source]
orca.transform.gainscaling.auto_corr_data_and_flag(t: casacore.tables.table, data_column: str) Tuple[numpy.ndarray, numpy.ndarray][source]

Extract autocorrelation data and flags from a measurement set table.

Parameters:
  • t – Open casacore table object.

  • data_column – Name of the data column to read.

Returns:

Tuple of (data, flag) arrays for autocorrelation baselines.

orca.transform.gainscaling.calculate_gain_scale(to_scale_data: numpy.ndarray, to_scale_flag: numpy.ndarray, target_data: numpy.ndarray, target_flag: numpy.ndarray) numpy.ndarray[source]

Calculate the gain scaling factor to match autocorrelation levels.

Computes per-antenna per-channel per-polarization scaling factors required to scale one dataset’s autocorrelations to match another’s.

Parameters:
  • to_scale_data – Autocorrelation data to be scaled.

  • to_scale_flag – Flags for to_scale_data.

  • target_data – Target autocorrelation data to match.

  • target_flag – Flags for target_data.

Returns:

Scaling factors array; flagged values are set to 1.0.

orca.transform.gainscaling.apply_gain_scale_in_place(data: numpy.ndarray, scale_spectrum: numpy.ndarray) None[source]

Apply single pol scaling factor per antenna to cross-correlated data. This is similar to applycal in CASA. It multiples a cross-correlation by the scaling factor that corresponds to the two antennas (each of which has 2 polarizations) involved. Warning: this mutates data in place while returning a reference to it.

Parameters:
  • data – Cross-correlated data with shape (N_vis, N_chan, 4), ordered by antennas

  • scale_spectrum – Single polarization scaling factors; shape (N_ant, N_chan, 2), ordered by antennas

Returns: data multiplied by scale_spectrum

orca.transform.gainscaling.correct_scaling(to_scale_ms: str, target_ms: str, data_column: str = 'CORRECTED_DATA')[source]

Correct for per-antenna per-pol per-channel scaling between two measurement sets.

Scales data in to_scale_ms such that its autocorrelation matches target_ms. Uses autocorrelation ratios to derive per-antenna scaling factors.

Parameters:
  • to_scale_ms – Measurement set to scale (modified in-place).

  • target_ms – Reference measurement set whose autocorrelation levels to match.

  • data_column – The data column to apply this operation to.

Returns:

None. Modifies to_scale_ms in place.