Statistical tests for jackknives¶
The hera_stats.stats
module contains various statistical convenience functions to compare jackknifed power spectra and other data.
-
hera_stats.stats.
redgrp_pspec_covariance
(uvp, red_grp, dly_idx, spw, polpair, mode='cov', verbose=False)[source]¶ Calculate the covariance or correlation matrix for all pairs of delay spectra in a redundant group, for a single delay bin. The matrix is estimated by averaging over all LST samples.
Parameters: - uvp (UVPSpec) – Input UVPSpec object.
- red_grp (list) – List of redundant baseline pairs within a group.
- dly_idx (int) – Index of the delay bin to calculate the covariance matrix for.
- spw (int) – Index of spectral window to use.
- polpair (int or str or tuple) – Polarization pair.
- mode (str, optional) – Whether to calculate the covariance matrix (‘cov’) or correlation matrix (‘corr’). Default: ‘cov’.
- verbose (bool, optional) – Whether to print status messages. Default: false.
Returns: cov_real, cov_imag – Real and imaginary covariance or correlation matrices, of shape (Nblps, Nblps).
Return type: ndarrays
-
hera_stats.stats.
uvp_zscore
(uvp, error_field='bs_std', inplace=False)[source]¶ Calculate a zscore of a UVPSpec object using entry ‘error_field’ in its stats_array. This assumes that the UVPSpec object has been already mean subtracted using hera_pspec.uvpspec_utils.subtract_uvp().
The resultant zscore is stored in the stats_array as error_field + “_zscore”.
Parameters: - uvp (UVPSpec object)
- error_field (str, optional) – Key of stats_array to use as z-score normalization.
- inplace (bool, optional) – If True, add zscores into input uvp, else make a copy of uvp and return with zscores.
Returns: uvp : UVPSpec object
Return type: if inplace