surface_sim.detectors.Detectors#

class Detectors(anc_qubits, frame, anc_coords=None, include_gauge_dets=False, include_empty_detectors=True)[source]#
__init__(anc_qubits, frame, anc_coords=None, include_gauge_dets=False, include_empty_detectors=True)[source]#

Initalises the Detectors class.

Parameters:
anc_qubits

List of ancilla qubits. The detector ordering will follow this list.

frame

Detector frame to use when building the detectors. The options for the detector frames are described in the Notes section.

anc_coords

Ancilla qubit coordinates that are added to the detectors if specified. The coordinates of the detectors will be (*ancilla_coords[i], r), with r the number of rounds (starting at 0).

include_gauge_dets

Flag to include or not the definition of gauge detectors. By default, False.

include_empty_detectors

Flag to include or not the definition of empty detectors, that is detectors that will always be 0 because they do not have any measurement associated with it. This can happen in the first QEC cycle after a logical reset, when not defining detectors for all the stabilizers… By default, True.

Notes

Detector frame 'post-gate' builds the detectors in the basis given by the stabilizer generators of the last-measured QEC round.

Detector frame 'pre-gate' builds the detectors in the basis given by the stabilizer generators of the previous-last-measured QEC round.

Detector frame 'gate-independent' builds the detectors as m_{a,r} ^ m_{a,r-1} independently of how the stabilizer generators have been transformed.

Methods

activate_detectors(anc_qubits[, gauge_dets])

Activates the given ancilla detectors.

build_from_anc(get_rec, anc_reset[, anc_qubits])

Returns the stim circuit with the corresponding detectors given that the ancilla qubits have been measured.

build_from_data(get_rec, anc_support, ...[, ...])

Returns the stim circuit with the corresponding detectors given that the data qubits have been measured.

deactivate_detectors(anc_qubits)

Deactivates the given ancilla detectors.

from_layouts(*layouts[, frame, ...])

Creates a Detectors object using the information from the layouts.

load_state(filename)

Loads the state inside the given YAML file.

new_circuit()

Resets all the current generators and number of rounds in order to create a different circuit.

store_state(filename)

Stores the current state to the given YAML file.

update(new_stab_gens, new_stab_gens_inv)

Update the current stabilizer generators with the dictionary descriving the effect of the logical gate.