Python API¶
Statistic readers¶
- class aoquality.BaselineStat(ms_file, verbose=True)[source]¶
Bases:
BaseAOQualityAO quality baseline statistics
- ant1¶
Antenna 1
- Type:
array of int
- ant2¶
Antenna 2
- Type:
array of int
- ant_name¶
Name of the stations
- Type:
array of str
- ant_pos¶
Positions of the stations
- Type:
array
- blenght¶
Baseline length in meter
- Type:
array
- get_combined_stat(stat_name, action_fct=<function nanmedian>)[source]¶
- Return combined statistics applying action_fct over the frequency axis.
Useful when gathering statistics from combined QUALITY tables, but safe to use for non combined QUALITY tables as well: it will be a no-op in this case.
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
action_fct (fct, optional) – The function to apply over the frequency axis
- Returns:
ant1 (n_baselines), ant2 (n_baselines), blenght (n_baselines), stat (n_baselines, n_pol)
- get_antenna_stat(stat_name, reducer=<function nanmedian>)[source]¶
Per-antenna summary statistic aggregated from cross-baselines.
- Parameters:
stat_name (str) – Statistic name. See aoquality.available_stats.
reducer (callable) – Applied over matching baselines per antenna (default: nanmedian).
- Returns:
Station names. ant_stats (n_ant, n_pol): Reduced statistic per antenna and polarisation.
- Return type:
ant_names (n_ant,)
- plot_baseline_stats(stat_name, pol=0, flag_autocorr=True, log=False, vmin=None, vmax=None, name='')[source]¶
Plot 2D matrix of baselines statistics
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
pol (int, optional) – The polarization to plot: 0:XX, 1:XY, 2:YX, 3:YY
- Returns:
the matplotlib figure
- Return type:
Figure
- plot_antennae_stats(stat_name, pol=0, log=False, vmin=None, vmax=None, name='')[source]¶
Plot the statistic for each individual antennae/station
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
pol (int, optional) – The polarization to plot: 0:XX, 1:XY, 2:YX, 3:YY
- Returns:
the matplotlib figure
- Return type:
Figure
- plot_baseline_length_stats(stat_name, pol=0, log=False, vmin=None, vmax=None, name='')[source]¶
Plot the statistic for each baselines as function of baseline length
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
pol (int, optional) – The polarization to plot: 0:XX, 1:XY, 2:YX, 3:YY
- Returns:
the matplotlib figure
- Return type:
Figure
- class aoquality.FrequencyStat(ms_file, verbose=True)[source]¶
Bases:
BaseAOQualityAO quality frequency statistics
- freqs¶
Frequencies
- Type:
array
- get_combined_stat(stat_name, action_fct=<function nanmedian>)[source]¶
- Return combined statistics applying action_fct over the frequency axis.
Useful when gathering statistics from combined QUALITY tables, but safe to use for non combined QUALITY tables as well: it will be a no-op in this case.
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
action_fct (fct, optional) – The function to apply over the frequency axis
- Returns:
freqs(n_freqs,) andstat(n_freqs, n_pol).- Return type:
tuple
- plot_freq_stats(stat_name, pol=0, log=False, vmin=None, vmax=None, name='')[source]¶
Plot frequency statistics
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
pol (int, optional) – The polarization to plot: 0:XX, 1:XY, 2:YX, 3:YY
- Returns:
the matplotlib figure
- Return type:
Figure
- class aoquality.TimeStat(ms_file, verbose=True)[source]¶
Bases:
BaseAOQualityAO quality time statistics
- time¶
Time
- Type:
array
- get_combined_stat(stat_name)[source]¶
- Return combined statistics.
Useful when gathering statistics from combined QUALITY tables
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
- Returns:
time (n_time), freqs (n_freqs), stat (n_freqs, n_time, n_pol)
- plot_time_stats(stat_name, pol=0, log=False, vmin=None, vmax=None, name='')[source]¶
Plot time statistics
- Parameters:
stat_name (str) – The statistic to retrieve. See aoquality.available_stats for a list of available statistics
pol (int, optional) – The polarization to plot: 0:XX, 1:XY, 2:YX, 3:YY
- Returns:
the matplotlib figure
- Return type:
Figure
Combined reader¶
Module-level helpers¶
- aoquality.make_ant_matrix(ant1, ant2, m, a_max=None)[source]¶
Make antenna x antenna matrix from flat array
- Parameters:
ant1 (array) – Antenna 1
ant2 (array) – Antenna 2
m (array) – Flat array
a_max (int, optional) – Max antenna number
- Returns:
antenna x antenna matrix
- Return type:
array (n_ant, n_ant)
Two module-level constants are also exported:
aoquality.available_stats— the list of statistic names that can be requested ('SNR','RFIPercentage','Std','Mean', …).aoquality.pol_dict— mapping of polarisation index (0-3) to its name (XX,XY,YX,YY).