deltakit.decode.utils.calculate_pij_values#
- deltakit.decode.utils.calculate_pij_values(exp_values: dict[frozenset[int], float], graph: NXDecodingGraph | DecodingHyperGraph | None = None, min_prob: float = -inf, max_degree: int = 2, noise_floor_graph: NXDecodingGraph | DecodingHyperGraph | None = None) dict[frozenset[int], float]#
Calculates the Pij values given the <Xi> <Xj> etc values. At most degree 4 edges are supported.
- NB: If an edge does not turn up in the expectation data, no
pij value will be calculated for it. E.g, if the edge (3,5) is possible in your circuit, but never appears in the samples, then there will be no entry in the Pij matrix for this edge.
- Parameters:
exp_values (PijData) – Dictionary with keys being Tuples of ints, describing edges in the error graph. Values are floats describing the expectation value for the detector lighting up obtained from experimental data.
graph (Optional[Union[NXDecodingGraph, DecodingHyperGraph]], optional) – Optionally pass a (hyper)graph that will then be used to inform which edges of the graph to remove. Comparison made against stim’s decoder graph, as in the Google paper.
min_prob (float) – Minimum probability with which to limit the calculated Pij values. By default -math.inf to allow all values. In Google’s paper, they set this value to their T1/T2 times. Overridden by noise_floor_graph, or only used for edge comparisons with edges that are not contained in both the Pij and noise_floor_graph.
max_degree (int) – Maximum degree of possible (hyper)edges. Any value over 4 will be ignored as we do not support computing hyperedges with degree > 4. Default value is 2 to consider simple graphs rather than hypergraphs.
noise_floor_graph (Optional[Union[NXDecodingGraph, DecodingHyperGraph]], optional) – (Hyper)graph against which we can compare edges and floor those edges if they fall below the value of this noise floor graph. If no graph is given, the values will instead be compared against min_prob. Noise floor graph likely generated from a noise model. Default value is None.
- Returns:
Dictionary with keys being Tuples of ints, describing edges in the error graph. Values are floats describing the Pij value for that particular edge.
- Return type:
PijData