Skip to content

Noise

LogicalNoiseModelABC

Bases: NoiseModelABC

Noise model for logical compilation.

Extends :class:NoiseModelABC with an abstract :meth:get_logical_initialize that returns the clean initialization kernel used to rewrite PhysicalInitialize nodes and the noisy initialization kernel that is applied after initialization (for example, via a noise-insertion pass).

get_logical_initialize abstractmethod

get_logical_initialize() -> tuple[
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
]

Return (clean_kernel, noisy_kernel) for logical initialization.

Both kernels must be provided. The clean kernel is used by InsertGates. The noisy kernel is used by InsertNoise when add_noise=True.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
169
170
171
172
173
174
175
176
177
178
179
180
181
@abc.abstractmethod
def get_logical_initialize(
    self,
) -> tuple[
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
]:
    """Return ``(clean_kernel, noisy_kernel)`` for logical initialization.

    Both kernels must be provided. The clean kernel is used by InsertGates.
    The noisy kernel is used by InsertNoise when ``add_noise=True``.
    """
    ...

NoiseModelABC

Bases: ABC

Abstract base class for noise models used during move-to-squin compilation.

This is the physical noise model interface. It defines noise kernels for physical operations (lane moves, CZ gates, idle periods, local/global rotations). Methods that return None indicate no noise is inserted for that operation.

For logical compilation that also needs initialization kernels, see :class:LogicalNoiseModelABC.

get_bus_idle_noise abstractmethod

get_bus_idle_noise(
    move_type: MoveType, bus_id: int
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]

Return the noise kernel applied to stationary qubits during a move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
90
91
92
93
94
95
@abc.abstractmethod
def get_bus_idle_noise(
    self, move_type: MoveType, bus_id: int
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]:
    """Return the noise kernel applied to stationary qubits during a move."""
    ...

get_cz_paired_noise

get_cz_paired_noise(
    zone_address: ZoneAddress,
) -> (
    ir.Method[
        [
            ilist.IList[qubit.Qubit, Len],
            ilist.IList[qubit.Qubit, Len],
        ],
        None,
    ]
    | None
)

Return the noise kernel for paired qubits during a CZ gate, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
35
36
37
38
39
40
41
42
def get_cz_paired_noise(
    self, zone_address: ZoneAddress
) -> (
    ir.Method[[ilist.IList[qubit.Qubit, Len], ilist.IList[qubit.Qubit, Len]], None]
    | None
):
    """Return the noise kernel for paired qubits during a CZ gate, or ``None``."""
    return None

get_cz_unpaired_noise abstractmethod

get_cz_unpaired_noise(
    zone_address: ZoneAddress,
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]

Return the noise kernel for unpaired qubits during a CZ gate.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
 97
 98
 99
100
101
102
@abc.abstractmethod
def get_cz_unpaired_noise(
    self, zone_address: ZoneAddress
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]:
    """Return the noise kernel for unpaired qubits during a CZ gate."""
    ...

get_global_r_noise

get_global_r_noise() -> (
    ir.Method[
        [ilist.IList[qubit.Qubit, Any], float, float], None
    ]
    | None
)

Return the noise kernel for global R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
56
57
58
59
60
def get_global_r_noise(
    self,
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float, float], None] | None:
    """Return the noise kernel for global R rotations, or ``None``."""
    return None

get_global_rz_noise

get_global_rz_noise() -> (
    ir.Method[[ilist.IList[qubit.Qubit, Any], float], None]
    | None
)

Return the noise kernel for global Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
44
45
46
47
48
def get_global_rz_noise(
    self,
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float], None] | None:
    """Return the noise kernel for global Rz rotations, or ``None``."""
    return None

get_lane_noise abstractmethod

get_lane_noise(
    lane: LaneAddress,
) -> ir.Method[[qubit.Qubit], None]

Return the noise kernel applied to a qubit after a lane move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
85
86
87
88
@abc.abstractmethod
def get_lane_noise(self, lane: LaneAddress) -> ir.Method[[qubit.Qubit], None]:
    """Return the noise kernel applied to a qubit after a lane move."""
    ...

get_local_r_noise

get_local_r_noise(
    locations: Sequence[LocationAddress],
) -> (
    ir.Method[
        [ilist.IList[qubit.Qubit, Any], float, float], None
    ]
    | None
)

Return the noise kernel for local R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
62
63
64
65
66
def get_local_r_noise(
    self, locations: Sequence[LocationAddress]
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float, float], None] | None:
    """Return the noise kernel for local R rotations, or ``None``."""
    return None

get_local_rz_noise

get_local_rz_noise(
    locations: Sequence[LocationAddress],
) -> (
    ir.Method[[ilist.IList[qubit.Qubit, Any], float], None]
    | None
)

Return the noise kernel for local Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
50
51
52
53
54
def get_local_rz_noise(
    self, locations: Sequence[LocationAddress]
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float], None] | None:
    """Return the noise kernel for local Rz rotations, or ``None``."""
    return None

get_logical_initialize

get_logical_initialize() -> tuple[
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ]
    | None,
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ]
    | None,
]

Return (clean_kernel, noisy_kernel) for logical initialization.

The clean kernel is used by InsertGates for the noiseless initialization. The noisy kernel, if not None, is invoked by InsertNoise after initialization to apply initialization noise.

Returns (None, None) by default, meaning no initialization is provided by the noise model.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
def get_logical_initialize(
    self,
) -> tuple[
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None] | None,
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None] | None,
]:
    """Return (clean_kernel, noisy_kernel) for logical initialization.

    The clean kernel is used by InsertGates for the noiseless initialization.
    The noisy kernel, if not None, is invoked by InsertNoise after initialization
    to apply initialization noise.

    Returns ``(None, None)`` by default, meaning no initialization is provided
    by the noise model.
    """
    return None, None

SimpleLogicalNoiseModel dataclass

SimpleLogicalNoiseModel(
    lane_noise: Method[[Qubit], None],
    idle_noise: Method[[IList[Qubit, Any]], None],
    cz_unpaired_noise: Method[[IList[Qubit, Any]], None],
    cz_paired_noise: Method[
        [IList[Qubit, Any], IList[Qubit, Any]], None
    ],
    global_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    local_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    global_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    local_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    logical_initialize_clean: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
    logical_initialize_noisy: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
)

Bases: LogicalNoiseModelABC, SimpleNoiseModel

Logical noise model based on :class:SimpleNoiseModel.

This class does not add new fields beyond :class:SimpleNoiseModel; it serves as a marker subclass that also satisfies :class:LogicalNoiseModelABC for logical compilation passes.

The logical_initialize_clean and logical_initialize_noisy fields are inherited from :class:SimpleNoiseModel and must both be set.

from_simple classmethod

from_simple(
    noise_model: SimpleNoiseModel,
    logical_initialize_clean: Method[
        [float, float, float, IList[Qubit, Any]], None
    ],
    logical_initialize_noisy: Method[
        [float, float, float, IList[Qubit, Any]], None
    ],
) -> SimpleLogicalNoiseModel

Create from an existing :class:SimpleNoiseModel plus init kernels.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
@classmethod
def from_simple(
    cls,
    noise_model: SimpleNoiseModel,
    logical_initialize_clean: ir.Method[
        [float, float, float, ilist.IList[qubit.Qubit, Any]], None
    ],
    logical_initialize_noisy: ir.Method[
        [float, float, float, ilist.IList[qubit.Qubit, Any]], None
    ],
) -> "SimpleLogicalNoiseModel":
    """Create from an existing :class:`SimpleNoiseModel` plus init kernels."""
    return cls(
        lane_noise=noise_model.lane_noise,
        idle_noise=noise_model.idle_noise,
        cz_unpaired_noise=noise_model.cz_unpaired_noise,
        cz_paired_noise=noise_model.cz_paired_noise,
        global_rz_noise=noise_model.global_rz_noise,
        local_rz_noise=noise_model.local_rz_noise,
        global_r_noise=noise_model.global_r_noise,
        local_r_noise=noise_model.local_r_noise,
        logical_initialize_clean=logical_initialize_clean,
        logical_initialize_noisy=logical_initialize_noisy,
    )

get_logical_initialize

get_logical_initialize() -> tuple[
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
]

Return (clean_kernel, noisy_kernel) for logical initialization.

Both kernels must be provided. The clean kernel is used by InsertGates. The noisy kernel is used by InsertNoise when add_noise=True.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
196
197
198
199
200
201
202
203
204
205
206
207
208
def get_logical_initialize(
    self,
) -> tuple[
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
]:
    assert (
        self.logical_initialize_clean is not None
    ), "logical_initialize_clean must be set"
    assert (
        self.logical_initialize_noisy is not None
    ), "logical_initialize_noisy must be set"
    return self.logical_initialize_clean, self.logical_initialize_noisy

SimpleNoiseModel dataclass

SimpleNoiseModel(
    lane_noise: Method[[Qubit], None],
    idle_noise: Method[[IList[Qubit, Any]], None],
    cz_unpaired_noise: Method[[IList[Qubit, Any]], None],
    cz_paired_noise: Method[
        [IList[Qubit, Any], IList[Qubit, Any]], None
    ],
    global_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    local_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    global_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    local_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    logical_initialize_clean: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
    logical_initialize_noisy: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
)

Bases: NoiseModelABC

A concrete noise model that applies the same noise kernel for each operation type.

Unlike :class:NoiseModelABC, which allows different noise per zone or location, this model uses a single kernel per operation category (e.g. one kernel for all lane moves, one for all CZ gates). Created by :func:~bloqade.lanes.noise_model.generate_simple_noise_model.

get_bus_idle_noise

get_bus_idle_noise(move_type: MoveType, bus_id: int)

Return the noise kernel applied to stationary qubits during a move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
137
138
def get_bus_idle_noise(self, move_type: MoveType, bus_id: int):
    return self.idle_noise

get_cz_paired_noise

get_cz_paired_noise(zone_address: ZoneAddress)

Return the noise kernel for paired qubits during a CZ gate, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
143
144
def get_cz_paired_noise(self, zone_address: ZoneAddress):
    return self.cz_paired_noise

get_cz_unpaired_noise

get_cz_unpaired_noise(zone_address: ZoneAddress)

Return the noise kernel for unpaired qubits during a CZ gate.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
140
141
def get_cz_unpaired_noise(self, zone_address: ZoneAddress):
    return self.cz_unpaired_noise

get_global_r_noise

get_global_r_noise()

Return the noise kernel for global R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
146
147
def get_global_r_noise(self):
    return self.global_r_noise

get_global_rz_noise

get_global_rz_noise()

Return the noise kernel for global Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
152
153
def get_global_rz_noise(self):
    return self.global_rz_noise

get_lane_noise

get_lane_noise(lane: LaneAddress)

Return the noise kernel applied to a qubit after a lane move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
134
135
def get_lane_noise(self, lane: LaneAddress):
    return self.lane_noise

get_local_r_noise

get_local_r_noise(locations: Sequence[LocationAddress])

Return the noise kernel for local R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
149
150
def get_local_r_noise(self, locations: Sequence[LocationAddress]):
    return self.local_r_noise

get_local_rz_noise

get_local_rz_noise(locations: Sequence[LocationAddress])

Return the noise kernel for local Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
155
156
def get_local_rz_noise(self, locations: Sequence[LocationAddress]):
    return self.local_rz_noise

get_logical_initialize

get_logical_initialize()

Return (clean_kernel, noisy_kernel) for logical initialization.

The clean kernel is used by InsertGates for the noiseless initialization. The noisy kernel, if not None, is invoked by InsertNoise after initialization to apply initialization noise.

Returns (None, None) by default, meaning no initialization is provided by the noise model.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
131
132
def get_logical_initialize(self):
    return self.logical_initialize_clean, self.logical_initialize_noisy