deltakit.explorer.Client.trim_circuit_and_detectors#

Client.trim_circuit_and_detectors(stim_circuit: str | Circuit, detectors: DetectionEvents) tuple[str, DetectionEvents]#

Trims a circuit to remove redundant detectors (detectors that do not affect the observable). It then compares the trimmed circuit to the original to make a list of the removable detectors that are then used to also trim the detector data.

Trimming a circuit:

removing detectors that are not associated with any obervables.

Trimming detector data:

having removed detectors from the circuit as per the above definition, remove those same detectors from the given detector data.

Parameters:
  • stim_circuit (str | stim.Circuit) – Noisy STIM circuit.

  • detectors (DetectionEvents) – Corresponding detectors.

Returns:

Tuple[str, DetectionEvents]

Tuple containing trimmed circuit and detection events.

Examples

Trim a disconnected circuit and related detection events, keeping only the part of it, connected to observables:

trimmed_circuit, trimmed_dets = client.trim_circuit_and_detectors(
    stim_circuit=noisy_circuit,
    detectors=detectors,
)