pygsti.tools.chi2fn_2outcome_wfreqs

pygsti.tools.chi2fn_2outcome_wfreqs(N, p, f, minProbClipForWeighting=0.0001)

Computes chi^2 for a 2-outcome measurement using frequency-weighting.

The chi-squared function for a 2-outcome measurement using the observed frequency in the statistical weight.

Parameters:
  • N (float or numpy array) – Number of samples.
  • p (float or numpy array) – Probability of 1st outcome (typically computed).
  • f (float or numpy array) – Frequency of 1st outcome (typically observed).
  • minProbClipForWeighting (float, optional) – unused but present to keep the same function signature as chi2fn_2outcome.
Returns:

N(p-f)^2 / (f*(1-f*)), where f* = (f*N+1)/N+2 is the frequency value used in the statistical weighting (prevents divide by zero errors)

Return type:

float or numpy array