surface_sim.detectors.Detectors.build_from_anc#

detectors.Detectors.build_from_anc(get_rec, anc_reset, anc_qubits=None)#

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

Parameters:
get_rec

Function that given qubit_label, rel_meas_id returns the corresponding stim.target_rec. The intention is to give the Model.meas_target method.

anc_reset

Flag for if the ancillas are being reset in every QEC round.

anc_qubits

List of the ancilla qubits for which to build the detectors. By default, builds all the detectors.

Returns:
detectors_stim

Detectors defined in a stim circuit.

Notes

This function assumes that all QEC rounds happen at the same time for all logical qubits. It is not possible to have some qubits performing some logical gates and some qubits performing QEC rounds. This is because the dicts for updating the qubits are stored globally, not per ancilla qubit.