pygsti.tools.chi2fn_wfreqs

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

Computes the frequency-weighed chi^2 term corresponding to a single outcome.

The chi-squared term for a single outcome of a multi-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.
Returns:

N(p-f)^2 / 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