localuf.noise.main

Classes for noise models.

Classes

CircuitLevel(fresh_edge_dict, ...[, ...])

Circuit-level depolarizing noise model.

CodeCapacity(fresh_edges[, all_edges])

Code capacity noise model.

Noise()

Abstract base class for noise models.

Phenomenological(fresh_edges[, all_edges])

Phenomenological noise model.

class localuf.noise.main.Noise[source]

Bases: ABC

Abstract base class for noise models.

abstract property ALL_WEIGHTS: Iterable[int] | tuple[tuple[int, ...], ...]

All possible force_error inputs.

abstract property ALL_WEIGHTS_INDEX: Index

ALL_WEIGHTS as pandas Index.

abstractmethod make_error(noise_level)[source]

See Code.make_error.

Parameters:

noise_level (float)

Return type:

set[tuple[tuple[int, …], tuple[int, …]]]

abstractmethod force_error(weight)[source]

Make error of weight weight.

Parameters:

weight (int | tuple[int, ...])

Return type:

set[tuple[tuple[int, …], tuple[int, …]]]

abstractmethod subset_probability(weights, noise_level)[source]

Return probability of any error of weight weight, for weight in weights.

Parameters:
  • weights (Iterable[int] | tuple[tuple[int, ...], ...])

  • noise_level (float)

Return type:

Iterable[float]

subset_probabilities(noise_level, survival=True)[source]

Return DataFrame containing probabilities of each subset.

Parameters:
  • noise_level (float) – noise level.

  • survival (bool) – whether to compute survival probability column.

Returns:

DataFrame indexed by subset weight, with columns ['subset prob', 'survival prob'].

abstractmethod get_edge_weights(noise_level)[source]

Return map from edge to its flip probability and weight.

Parameters:

noise_level (None | float) – a probability that represents the noise strength. This defines the nonuniform edge weights of the decoding graph in the circuit-level noise model. If not specified, all edges have flip probability 0 and weight 1.

Return edge_weights:

A map from each edge in the decoding window to the pair (flip probability, weight).

Return type:

dict[tuple[tuple[int, …], tuple[int, …]], tuple[float, float]]

static log_odds_of_no_flip(flip_probability)[source]

Convert flip probability to log odds of no flip.

Parameters:

flip_probability (float)

Return type:

float

class localuf.noise.main.CodeCapacity(fresh_edges, all_edges=None)[source]

Bases: _Uniform

Code capacity noise model.

Extends _Uniform.

Parameters:
  • fresh_edges (tuple[tuple[tuple[int, ...], tuple[int, ...]], ...])

  • all_edges (None | tuple[tuple[tuple[int, ...], tuple[int, ...]], ...])

class localuf.noise.main.Phenomenological(fresh_edges, all_edges=None)[source]

Bases: _Uniform

Phenomenological noise model.

Extends _Uniform.

Parameters:
  • fresh_edges (tuple[tuple[tuple[int, ...], tuple[int, ...]], ...])

  • all_edges (None | tuple[tuple[tuple[int, ...], tuple[int, ...]], ...])

class localuf.noise.main.CircuitLevel(fresh_edge_dict, parametrization, demolition, monolingual, fresh_merges=None, force_by='pair', all_edge_dict=None, all_merges=None)[source]

Bases: Noise

Circuit-level depolarizing noise model.

Parameters:
  • fresh_edge_dict (dict[Literal['S', 'E westmost', 'E bulk', 'E eastmost', 'U 3', 'U 4', 'SD', 'EU west corners', 'EU east corners', 'EU edge', 'EU centre', 'SEU'], tuple[tuple[tuple[int, ...], tuple[int, ...]], ...]])

  • parametrization (Literal['standard', 'balanced', 'ion trap'])

  • demolition (bool)

  • monolingual (bool)

  • fresh_merges (dict[tuple[tuple[int, ...], tuple[int, ...]], tuple[tuple[int, ...], tuple[int, ...]]] | None)

  • force_by (Literal['pair', 'edge'])

  • all_edge_dict (None | dict[Literal['S', 'E westmost', 'E bulk', 'E eastmost', 'U 3', 'U 4', 'SD', 'EU west corners', 'EU east corners', 'EU edge', 'EU centre', 'SEU'], tuple[tuple[tuple[int, ...], tuple[int, ...]], ...]])

  • all_merges (None | dict[tuple[tuple[int, ...], tuple[int, ...]], tuple[tuple[int, ...], tuple[int, ...]]])

make_error(noise_level)[source]

See Code.make_error.

force_error(weight)[source]

Make error of weight weight.

Parameters:

weight (tuple[int, ...])

property ALL_WEIGHTS

All possible force_error inputs.

property ALL_WEIGHTS_INDEX

ALL_WEIGHTS as pandas Index.

subset_probability(weights, noise_level)[source]

Return probability of any error of weight weight, for weight in weights.

Parameters:
  • weights (tuple[tuple[int, ...], ...])

  • noise_level (float)

get_edge_weights(noise_level)[source]

Return map from edge to its flip probability and weight.

Parameters:

noise_level (None | float) – a probability that represents the noise strength. This defines the nonuniform edge weights of the decoding graph in the circuit-level noise model. If not specified, all edges have flip probability 0 and weight 1.

Return edge_weights:

A map from each edge in the decoding window to the pair (flip probability, weight).