deltakit.explorer.analysis.calculate_lambda_and_lambda_stddev#
- deltakit.explorer.analysis.calculate_lambda_and_lambda_stddev(distances: ndarray[tuple[Any, ...], dtype[int64]] | Sequence[int], leppr: ndarray[tuple[Any, ...], dtype[float64]] | Sequence[float], leppr_std: ndarray[tuple[Any, ...], dtype[float64]] | Sequence[float], method: LambdaFitMethod = LambdaFitMethod.LIN) LambdaData#
Estimate the error suppression factor (Λ) and its standard deviation.
This function fits the scaling of the logical error probability per round (leppr) and propagates its standard deviation (leppr_std) through the fitting method as a function of code distance.
It extracts the error suppression factor Λ and the prefactor Λ₀, along with their standard deviations.
The leppr can be approximated as
lep / num_roundsfor small error rates, or computed together with its standard deviation more accurately usingcompute_logical_error_per_round().By supplying leppr values at increasing code distances, this routine estimates how quickly logical errors are suppressed as the code grows. Note that Λ is a heuristic quantity: estimates may be unreliable near threshold and for small distances. In such cases, a warning is emitted.
All three fitting methods show remarkable numerical agreement. LambdaFitMethod.CURVE is slower than both LambdaFitMethod.SHIFTED and LambdaFitMethod.LIN, the later two should be preferred in general.
- Reference:
Fig. S15 of Supplementary information of “Quantum error correction below the surface code threshold” at https://www.nature.com/articles/s41586-024-08449-y#Sec8
- Parameters:
distances – An array for code distances as leppr data points.
leppr – An array for leppr computed for all distances. Must be of same size as ‘distances’.
leppr_std – An array for leppr standard deviation for each distance. Must be of same size as ‘distances’.
method – Method used to fit the data. The default is “lin”.
- Returns:
Container for Λ, Λ₀, their standard deviations, and the input data.
- Return type:
LambdaData
- Raises:
ValueError – When input data do not match sizes or when duplicated data is provided.
Notes
When Λ is very close to 1 (
abs(Λ - 1) < 1e-7) andmethod == "curve", the fit may trigger ascipy.optimize.OptimizeWarningindicating that the covariance of the parameters could not be estimated. This situation is unlikely with real experimental data but may occur with synthetic inputs.Examples
>>> res = calculate_lambda_and_lambda_std( ... distances=[5, 7, 9], ... leppr=[1.992e-04, 4.314e-05, 7.556e-06], ... leppr_std=[1.2e-05, 9.3e-06, 3.9e-06], ... ) >>> res.lambda_, res.lambda_std