From dd3297dd3824be44b5c8b7a1630664fef7def42b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:07:22 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20pre-commit=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run_color_code_phenomenological_noise.py | 3 ++- .../qecc/cc_decoder/stim_interface/__init__.py | 2 +- .../stim_interface/color_code_stim.py | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) 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 c3cac426..13947ffa 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,5 @@ -""" 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 37ec3dfc..1acba125 100644 --- a/src/mqt/qecc/cc_decoder/stim_interface/__init__.py +++ b/src/mqt/qecc/cc_decoder/stim_interface/__init__.py @@ -1 +1 @@ -""" init py file for stim_interface module """ \ No newline at end of file +"""init py file for stim_interface module.""" 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 97274db7..1ad3db18 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,16 @@ -"""Generate stim circuit for the 2D color code""" +"""Generate stim circuit for the 2D color code.""" + from __future__ import annotations -from typing import Any -import stim + import itertools as it +from typing import Any + 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.""" + """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]) @@ -47,7 +49,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.""" + """Add one round of checks to the circuit.""" for check in pcm: if error_probability == 0: mpp_X_instruction = "MPP " @@ -70,8 +72,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()