diff --git a/src/mqt/qecc/cc_decoder/run_color_code_phenomenological_noise.py b/src/mqt/qecc/cc_decoder/run_color_code_phenomenological_noise.py index 1f7c35ab..c3cac426 100644 --- a/src/mqt/qecc/cc_decoder/run_color_code_phenomenological_noise.py +++ b/src/mqt/qecc/cc_decoder/run_color_code_phenomenological_noise.py @@ -1,4 +1,4 @@ -# This script is used to run the color code phenomenological noise simulation. +""" This script is used to run the color code phenomenological noise simulation.""" from __future__ import annotations import matplotlib.pyplot as plt diff --git a/src/mqt/qecc/cc_decoder/stim_interface/__init__.py b/src/mqt/qecc/cc_decoder/stim_interface/__init__.py index e69de29b..37ec3dfc 100644 --- a/src/mqt/qecc/cc_decoder/stim_interface/__init__.py +++ b/src/mqt/qecc/cc_decoder/stim_interface/__init__.py @@ -0,0 +1 @@ +""" init py file for stim_interface module """ \ No newline at end of file diff --git a/src/mqt/qecc/cc_decoder/stim_interface/color_code_stim.py b/src/mqt/qecc/cc_decoder/stim_interface/color_code_stim.py index d1521f83..97274db7 100644 --- a/src/mqt/qecc/cc_decoder/stim_interface/color_code_stim.py +++ b/src/mqt/qecc/cc_decoder/stim_interface/color_code_stim.py @@ -1,14 +1,14 @@ -# Generate stim circuit for the 2D color code +"""Generate stim circuit for the 2D color code""" from __future__ import annotations - -import itertools as it from typing import Any - +import stim +import itertools as it import numpy as np import stim def neighbors(perm: np.NDArray[int]) -> list[np.NDArray[int]]: + """ Return the neighbors of a lattice point in the 2D color code.""" node_sw = (perm[0] + 1, perm[1], perm[2] - 1) node_se = (perm[0], perm[1] + 1, perm[2] - 1) node_e = (perm[0] - 1, perm[1] + 1, perm[2]) @@ -19,6 +19,7 @@ def neighbors(perm: np.NDArray[int]) -> list[np.NDArray[int]]: def gen_pcm_and_logical(distance: int) -> tuple[np.NDArray[bool], set[int]]: + """Generate the parity check matrix and logical operator for the 2D color code.""" lattice_points_to_qubit_index, ancilla_qubit_to_lattice_points = {}, {} qubit_count, ancilla_qubit_count = 0, 0 logical_operator = set() @@ -46,6 +47,7 @@ def gen_pcm_and_logical(distance: int) -> tuple[np.NDArray[bool], set[int]]: def add_checks_one_round(pcm: np.NDArray[int], circuit: Any, detectors: bool, error_probability: float) -> Any: + """ Add one round of checks to the circuit.""" for check in pcm: if error_probability == 0: mpp_X_instruction = "MPP " @@ -68,9 +70,9 @@ def add_checks_one_round(pcm: np.NDArray[int], circuit: Any, detectors: bool, er return circuit -def gen_stim_circuit_memory_experiment( - pcm: np.NDArray[int], logical_operator: np.NDArray[int], distance: int, error_probability: float -) -> Any: +def gen_stim_circuit_memory_experiment(pcm: np.NDArray[int], logical_operator: np.NDArray[int], + distance: int, error_probability: float) -> Any: + """Generate a stim circuit for a memory experiment on the 2D color code.""" data_qubits = range(len(pcm[0])) circuit = stim.Circuit() circuit.append("R", data_qubits)