deltakit.circuit.trim_detectors#
- deltakit.circuit.trim_detectors(stim_circuit: Circuit, dem_detectors_to_eliminate: Iterable[int]) Circuit#
Uses deltakit_circuit to remove a given set of detectors from a stim circuit and returns the new stim circuit
- Parameters:
stim_circuit (stim.Circuit) – A stim circuit from which detectors are to be removed
detectors_to_eliminate (Iterable[int]) –
A set of detectors to be removed. A detector to be removed should be specified via an integers in a list. The integers associated with a detector must be determined in the same way as integers are assigned to detectors via stim.Circuit.detector_error_model.
Importantly, if a stim file specifies a detector within a repeat block then to remove this detector you have to list all indices that that detector would be associated with in its corresponding detector error model, else the detector will not be eliminated and a warning will be raised. For example, given
each detector will occur three times in a DEM and have the indices [0, 2, 4] and [1, 3, 5] respectively. So, if removal of the first detector is done by specifying only index [0] for elimination a warning will be raised and the detector will not be removed as this is ambiguous.
Any number of nested repeat blocks is supported and this explains some of the code’s complexity.
- Returns:
A copy of the original stim circuit without the detectors specified via detectors_to_eliminate
- Return type:
stim.Circuit