localuf.sim.accuracy.monte_carlo

localuf.sim.accuracy.monte_carlo(sample_counts, code_class, decoder_class, noise, scheme='batch', get_commit_height=None, get_buffer_height=None, parametrization='balanced', demolition=False, monolingual=False, _merge_redundant_edges=True, **kwargs_for_decoder_class)[source]

Make threshold data for any decoder.

Parameters:
  • sample_counts (dict[int, list[tuple[float, int]]]) – A dictionary mapping code distances to lists of (noise level, sample count) pairs. If scheme is ‘global batch’, each sample count must be the same for all noise levels of a given distance. For a more detailed definition of ‘sample’, see _base_classes.Scheme.run.

  • code_class (Type[Code]) – The class of the code; either localuf.Repetition or localuf.Surface.

  • decoder_class (Type[Decoder]) – The class of the decoder; available decoders are listed in localuf.decoders.

  • noise (Literal['code capacity', 'phenomenological', 'circuit-level']) – The noise model.

  • scheme (Literal['batch', 'global batch', 'forward', 'frugal']) – The decoding scheme; either ‘batch’, ‘global batch’, ‘forward’ or ‘frugal’. In global batch scheme, the decoding graph is d*n layers tall i.e. as tall as the (entire) decoding graph would be in forward scheme with commit height d.

  • get_commit_height (Callable[[int], int] | None) – A function with input d that outputs commit height e.g. lambda d: 2*(d//2). If None, commit height is d for forward scheme and 1 for frugal scheme. Affects only forward and frugal decoding schemes.

  • get_buffer_height (Callable[[int], int] | None) – A function with input d that outputs buffer height. If None, buffer height is d for forward scheme and 2*(d//2) for frugal scheme. Affects only forward and frugal decoding schemes.

  • parametrization (Literal['standard', 'balanced', 'ion trap']) – defines relative fault probabilities of 1- and 2-qubit gates, and prep/measurement. Affects only circuit-level noise.

  • demolition (bool) – whether measurement destroys the ancilla qubit state which hence needs to be initialized for next measurement cycle. Affects only circuit-level noise.

  • monolingual (bool) – whether can prep/measure in only Z basis hence X-basis prep/measurement needs Hadamard gates. Affects only circuit-level noise.

  • _merge_redundant_edges (bool) – whether to merge redundant boundary edges. Affects only circuit-level noise.

  • kwargs_for_decoder_class – are for decoder_class.

Return df:

A DataFrame where each column is a (distance, probability); rows ‘m’, ‘n’ indicate number of logical errors and samples, respectively.