0
$\begingroup$

If I have a line in a DEM e.g.

error(0.001) D0

is there an easy way to see which circuit faults in the original circuit contributed to that error mechanism?

$\endgroup$

1 Answer 1

2
$\begingroup$

Use stim.Circuit.explain_detector_error_model_errors, like this:

circuit = ...
dem_errors_to_explain = stim.DetectorErrorModel("""
    error(1) D0
""")

circuit_errors = circuit.explain_detector_error_model_errors(
    dem_filter=dem_errors_to_explain,
    reduce_to_one_representative_error=True,
)

The result is a list of stim.ExplainedError objects (in this case the list only has one item, since we only asked to explain one error).

Note that these circuit error describing objects have a lot of fields. The easiest way to understand them is to start by just printing them out and see what's listed. The reduce_to_one_representative_error argument simplifies things by making each explained error only contain the simplest stim.CircuitErrorLocation, instead of all of them. You'll then get something like:

>>> print(circuit_errors[0])

Explained Error {
    dem_error_terms D0[coords 1,2,3]
    CircuitErrorLocation {
        flipped_pauli_product: Y0[coords 0,0]
        Circuit location stack trace:
            (after 10 TICKs)
            at instruction #3 (DEPOLARIZE1) in the circuit
            at target #1 of the instruction
            resolving to DEPOLARIZE1(0.01) 0[coords 0,0]
    }
}

Note that if you get something like this:

Explained Error {
    dem_error_terms D0[coords 1,2,3]
    [no single circuit error had these exact symptoms]
}

you may have accidentally used a version of your circuit that had no noise in it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.