Phase Gradient Analysis
Functions for analysis of calibration solution phase gradient fits.
- ska_sci_ops_data_analysis.phase_gradient.fit_phase_angle(freqs: ndarray, phases: ndarray, guess: float)
Fit provided phases over freqs, returning m and sig_m.
This does the optimisation on complex numbers, not just the phase of those complex numbers, for better results.
This function needs a guess for the gradient within ~0.05 of the truth.
- ska_sci_ops_data_analysis.phase_gradient.fit_soln_set_phase_angles(soln_dir: str, force_zero_phase_offset: bool = False)
Fit the phase angles for all antenna-polarisations in a soln set.
- Parameters:
- Returns:
Arrays of fitted m, sig_m, c, sig_c. m is the gradient, c is the y-intercept. m units are rad/MHz, c units are rad
- Return type:
np.ndaray, np.ndarray, np.ndarray, np.ndarray
- ska_sci_ops_data_analysis.phase_gradient.get_guess(freqs: ndarray, phases: ndarray, guess0: float)
Derive a guess for the gradient of the phase angle of complex gains.
Done by fitting the phase angle on the first half of the given data.
- ska_sci_ops_data_analysis.phase_gradient.phase_angle_model(f: float, m: float)
Model the phase angle of complex gain solutions.
phi(f) = m*f
- ska_sci_ops_data_analysis.phase_gradient.plot_mean_fmax_phase_errs(means, ax_hist, ax_pie)
Plot the distributions of solution mean fmax_phase_errs.
- Parameters:
means (array-like) – array-like of floats
ax_hist (matplotlib.pyplot.axis) – axis to plot histogram on
ax_pie (matplotlib.pyplot.axis) – axis to plot pie chart on
- ska_sci_ops_data_analysis.phase_gradient.soln_set_phase_fit_quality(soln_dir: str, fmax_phase_err_thresh: float = 5.74398001037828, flagged_ant_idxs: list = [], force_zero_phase_offset: bool = False)
Determine the quality of the phase angle fits for a solution set.
- Parameters:
soln_dir (str) – Path to directory containing calibration solutinos
fmax_phase_err_thresh (float) – Threshold for errorbar at maximum frequency in degrees, defaults to FMAX_PHASE_ERR_THRESH
flagged_ant_idxs (list) – List of indexes of flagged antennas to exclude, defaults to empty
force_zero_phase_offset (bool) – If True, fit phases while forcing the offset to be zero. Otherwise, use ska_low_mccs_calibration fitting function. Defaults to False.
- Raises:
ValueError – If soln_dir doesn’t contain station name
- Returns:
quality from (“Healthy”, “Faulty”), mean fmax_phase_err, array of all measured fmax_phase_err, array of phase offsets, array of errors in phase_offsets. All arrays in degrees with shape (NPOL, NANT)==(2, 256).
- Return type:
- ska_sci_ops_data_analysis.phase_gradient.summary_plot(soln_dir_base: str)
Plot goodness metric for a particular time’s solutions.
Includes all antennas present.
- Parameters:
soln_dir_base (str) – Path to directory containing solutions for a particular time step
- Returns:
figure and axis of summary plot
- Return type:
plt.Figure, plt.Axis