pygsti.tools.chi2fn_2outcome

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

Computes chi^2 for a 2-outcome measurement.

The chi-squared function for a 2-outcome measurement using a clipped probability for the statistical weighting.

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) – Defines clipping interval (see return value).
Returns:

N(p-f)^2 / (cp(1-cp)), where cp is the value of p clipped to the interval (minProbClipForWeighting, 1-minProbClipForWeighting)

Return type:

float or numpy array