ska_sdp_instrumental_calibration.xarray_processors.gain_flagging module
- class ska_sdp_instrumental_calibration.xarray_processors.gain_flagging.SmoothingFit(order, component)[source]
Bases:
object
- class ska_sdp_instrumental_calibration.xarray_processors.gain_flagging.PhasorPolyFit(order, freq)[source]
Bases:
object- fit(gains, weights, freq_guess)[source]
Fit a phasor model with polynomial envelope.
- Parameters:
gains (Array) -- Gains.
weights (Array) -- Weights of the gains.
freq_guess (float) -- Initial frequency to begin.
- Returns:
Fitted model.
- class ska_sdp_instrumental_calibration.xarray_processors.gain_flagging.RMSFlagger(n_sigma)[source]
Bases:
object- pre_flag(arr, weights)[source]
Flag outliers using Median Absolute Deviation (MAD).
- Parameters:
arr (ndarray) -- Input array containing the data to be flagged.
weights (ndarray) -- Weighting factors for each element in the input array.
- Returns:
- ndarray
Boolean mask where True indicates an outlier based on n_sigma.
- class ska_sdp_instrumental_calibration.xarray_processors.gain_flagging.RollingRMSFlagger(n_sigma, window)[source]
Bases:
object- pre_flag(arr, weights)[source]
Flag outliers based on the rolling RMS and MAD-derived threshold.
- Parameters:
arr (ndarray) -- Input array to be analyzed.
weights (ndarray) -- Weighting factors where zero indicates invalid data points.
- Returns:
Boolean mask identifying elements exceeding the n_sigma threshold.
- class ska_sdp_instrumental_calibration.xarray_processors.gain_flagging.GainFlagger(soltype, order, max_ncycles, n_sigma, n_sigma_rolling, window_size, freq)[source]
Bases:
object- MODE = {'amp-phase': 'poly', 'amplitude': 'poly', 'phase': 'poly', 'real-imag': 'smooth'}
- SOLTYPE = {'amp-phase': <function GainFlagger.<lambda>>, 'amplitude': <function GainFlagger.<lambda>>, 'phase': <function GainFlagger.<lambda>>, 'real-imag': <function GainFlagger.<lambda>>}
- ska_sdp_instrumental_calibration.xarray_processors.gain_flagging.flag_on_gains(gaintable, soltype, order, max_ncycles, n_sigma, n_sigma_rolling, window_size, normalize_gains, skip_cross_pol, apply_flag)[source]
Solves for gain flagging on gaintable for every receptor combination. Optionally applies the weights to the gains.
- Parameters:
gaintable (Gaintable) -- Gaintable from previous solution.
soltype (str) -- Solution type to flag. Can be "real-imag", "phase", "amplitude" or "amp-phase".
order (int) -- Order of the function fitted during detrending. If mode=smooth these are the window of the running median (0=all axis).
max_ncycles (int) -- Max number of independent flagging cycles, by default 5.
n_sigma (float) -- Flag values greated than n_simga * sigma_hat. Where sigma_hat is 1.4826 * MeanAbsoluteDeviation
n_sigma_rolling (float, optional) -- Do a running rms and then flag those regions that have a rms higher than n_sigma_rolling*MAD(rmses).
window_size (int) -- Window size for the running rms, by default 11.
normalize_gains (bool) -- Normailize the amplitude and phase before flagging.
skip_cross_pol (bool) -- Cross polarizations is skipped when flagging.
apply_flag (bool) -- Weights are applied to the gains.
- Return type:
- Returns:
- gaintable: Gaintable
Updated gaintable with weights.
- fits: dict
All fits generated.