I am testing a fault tolerant error correction scheme for a quantum error correcting code in the following way:

  1. Construct my circuit (data and ancilla qubits)
  2. Perform a round of error correction (set of projective measurements onto the ancilla qubits)
  3. Apply corrections based on the extracted syndromes
  4. Detect a logical error (by extracting the Pauli Frame and checking if the Pauli String anti-commutes with my logical operators)

I am having trouble with step 4 since I am not sure if stim allows you to extract the final Pauli Frame (as mentioned here: extracting the Pauli error on the data qubits at the end of circuit in stim).

Now, the reason I am asking this question is because the tagged answer is old(er), and also since (looking at other answers here) it seems there might be many ways of doing what I'm trying to do e.g. Tableau Simulation, using a Detector Error Model, etc.

I am trying to build a mental model of using stim properly/trying to find a de-facto way of running experiments like these where I want to use stim ONLY as a PF/circuit simulation tool where I can sample the Pauli Frame i.e. (X,Z) tuples for each data qubit where X(or Z)=1 means qubit has an X error w.r.t. an initial reference state.

Thank you.

  • $\begingroup$ Hi and welcome to Quantum Computing SE. Could you please be more specific on troubles you have? $\endgroup$ Apr 28, 2023 at 6:10
  • 1
    $\begingroup$ Sorry @martinvesely, I didn't see your comment. My trouble was that I couldn't find an API that gave me access to the underlying Pauli Frame. Having this information is useful for developing and testing my experiments. $\endgroup$
    – ababar
    Apr 30, 2023 at 17:27

1 Answer 1


There's an open issue to expose stim's Frame simulator to the python API, but it's not completed and not actively being worked on at the moment. That's the feature that would enable what you want.

Something to maybe keep in mind is that, on real hardware, you don't get access to this information. Being able to peek at which errors "really" occurred is helpful for learning and debugging, but ultimately in practice things have to be able to work end to end without this information. A more physically grounded approach is to make a circuit that starts and ends with perfect measurements of all observables and stabilizers. Noiseless measurements may be inplausible, but they at least don't imply violations of the Heisenberg uncertainty principle the way extracting the entire error frame does.

  • $\begingroup$ Yes indeed, but, as you said, this info is really helpful for debugging and development. Btw, if the issue isn’t too complicated, I can pick up the task! $\endgroup$
    – ababar
    Apr 29, 2023 at 7:55
  • $\begingroup$ @ababar The amount of work is high (~50 methods each tested and documented). The API design complexity is medium. The technical complexity is low; it's nearly all plumbing. $\endgroup$ Apr 29, 2023 at 16:40
  • $\begingroup$ I wouldn't mind taking a stab at this. At the very least it will help me understand the tool better. The ticket doesn't seem to have a lot of details so I'd appreciate it if you could share some more information (filenames, tests, etc) with me:) $\endgroup$
    – ababar
    Apr 30, 2023 at 1:46
  • $\begingroup$ @ababar I added a bunch of details to the issue. You can email me if you want more guidance. $\endgroup$ Apr 30, 2023 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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