Skip to content

circuit.explain_detector_error_ model_errors() mixing Y and Z terms #1005

@mpstafford

Description

@mpstafford

I'm trying to use the explained Detector Error Model and have seen behaviour where the ExplainedError displays the wrong fault mechanism when the error contains Y and Z operators.

Consider the circuit below

stim.Circuit( """ R 0 1 PAULI_CHANNEL_2(i) 0 1 M 0 1 DETECTOR(0) rec[-2] DETECTOR(1) rec[-1] """

where PAULI_CHANNEL_2(i) has all zeros in the argument except for the i'th term. I would expect each detector to flip when the quibt being measured is hit by an X or Y component.

I get the DEM with

dem = circuit.detector_error_model( decompose_errors=False, approximate_disjoint_errors=False, allow_gauge_detectors=False )

and look at what is generated for each i. Indeed, when I construct the DEM I see the correct behaviour. However when I try to look at the explained DEM each time I see confusing behaviour.

For example, with i=1 (piy non-zero) I see

error(0.1000000000000000056) D1 detector(0) D0 detector(1) D1

And with i=2 (piz)

detector(0) D0 detector(1) D1

ExplainedError { dem_error_terms: D1[coords 1] CircuitErrorLocation { flipped_pauli_product: Y1 Circuit location stack trace: (after 0 TICKs) at instruction #2 (PAULI_CHANNEL_2) in the circuit at targets #1 to #2 of the instruction resolving to PAULI_CHANNEL_2(0, 0, 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 0 1 } }

I would expect the explanation for the Y error to be coupled with the non-trivial DEM. If I work through all the errors I see

Actual Error DEM Explained Error
IX D1 D1 X1
IY D1 [ ]
IZ [ ] D1 Y1
XI D0 D0 X0
XX D0 D1 D0 D1 X0*X1
XY D0 D1 D0 X0*Z1
XZ D0 D0 D1 X0*Y1
YI D0 [ ]
YX D0 D1 D1 Z0*X1
YY D0 D1 [ ]
YZ D0 D1 Z0*Y1
ZI [ ] D0 Y0
ZX D1 D0 D1 Y0*X1
ZY D1 D0 Y0*Z1
ZZ [ ] D0 D1 Y0*Y1

If you swap the Explained error rows interchanging Y - Z it would match up with what I expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions