# Tag Info

Accepted

### What is the meaning of "shots" and "rounds" in Stim?

A shot is a full run of a circuit. If your circuit contains 100 measurements, sampling a shot from that circuit will produce 100 bits of measurement information. A round is a concept used by the ...
• 21.8k
Accepted

### Performing a generic single-qubit Pauli error channel in stim

Update: Since v1.4, stim supports custom pauli channels PAULI_CHANNEL_1(px, py, pz) and PAULI_CHANNEL_2(pix, piy, ..., pzz). ...
• 21.8k
Accepted

### 'Best practices' for making Stim run as fast as possible?

Output format: Use a bit packed output format that has 8 results per byte instead of 1. In the python bindings, this means calling sample_bit_packed instead of <...
• 21.8k

### Measuring entanglement entropy using a stabilizer circuit simulator

I think stim is the right tool for the job here, because it gives you access to the stabilizer generators and also it defines stim.PauliString which you can use to ...
• 21.8k
Accepted

### How can I visualize a stim circuit?

There's not an "official" viewer, but there's a few different things you can do. They're all a bit janky. You can combine the stimcirq and ...
• 21.8k
Accepted

### Incorporating Idling Errors while using Stim

No, there's no simple built-in way. You have to do it for yourself. This was an intentional design choice, which I will now attempt to justify because I do realize it's inconvenient. Stim has no ...
• 21.8k
Accepted

### How do I initialize stim's tableau simulator to a random tableau?

You can use stim.TableauSimulator.set_inverse_tableau to change the tableau simulator's state to a specific tableau, such as a random tableau from ...
• 21.8k
Accepted

### Efficient Way to Create an LUT in Stim

The simplest thing to do would be to make a pair of collections.Counters, sample the circuit millions of times, and add the result-flipped cases into one counter ...
• 21.8k
Accepted

### Measurement bitstrings to detection event bitstrings in stim

You can use stim.Circuit.compile_m2d_converter to get an object that converts measurements into detection event data (and optionally also observable flip data). The ...
• 21.8k

### Simulating flag qubits and conditional branches using Stim

This is definitely a place where you'll struggle to use Stim. It's possible but it's not nice. It could still be worth your time just because you don't have to eg. manually write code to turn a ...
• 21.8k
Accepted

### Computing expectation value of a Pauli string on stabilizer states

You can use stim.TableauSimulator.peek_observable_expectation to compute the expected value of Pauli product observables without affecting the simulator's state: <...
• 21.8k
Accepted

### How to import a generic stabilizer code in stim

Stim is very much a circuit focused simulator. It speaks quantum operations, not stabilizer configurations, so you have to convert your table of stabilizers into a stabilizer circuit. This is a bit ...
• 21.8k

### How do I pick a random Clifford operation in Stim?

The method stim.Tableau.random(n) generates a uniformly random n-qubit Clifford operation, using the algorithm from "Hadamard-free circuits expose the ...
• 21.8k
Accepted

### Measuring entanglement entropy using a stabilizer circuit simulator

With the help of Craig Gidney and some others, I was able to pin down the procedure to calculate the entropy. Here are the steps. Create your circuit with a stabilizer simulator This can be done with ...
• 135
Accepted

### How to perform encoding and syndrome measurement in stim

You can use the MPP instruction to measure a Pauli product. For example, if one of the prepared stabilizers is $X_1 \cdot Z_2 \cdot Y_3 = +1$ then you can do: ...
• 21.8k
Accepted

No, the python API doesn't support adding comments. Neither does the underlying C++ API, actually. Comments are completely discarded by the parser, and the circuit struct has no fields for storing ...
• 21.8k
Accepted

### How do I add an MPP operation to a stim circuit using append_operation?

You can use stim.target_x(qubit), stim.target_y(qubit), and stim.target_z(qubit) to make the ...
• 21.8k
Accepted

### compatibility of stim's error model with conventional decoding schemes

is it correct to say that the output of the decoder xor the logical observable, sampled using OBSERVABLE_INCLUDE, gives the output of a "stanard" decoder, created using a matching matrix and ...
• 21.8k
Accepted

### Use stim to simulate d=3 Bacon-Shor's code

Now that v1.8.0 is out I can use the new explain_detector_error_model_errors feature to find the circuit error causing the symptoms ...
• 21.8k
Accepted

### Where do lines like "error(0.00033) D0 D9 L0 ^ D7 ^ D8" come from in a stim detector error model?

[What does error(0.0033) D0 D9 L0 ^ D7 ^ D8 mean?] It is declaring an error mechanism that occurs 0.33% of the time. When this error occurs, it simultaneously ...
• 21.8k
Accepted

### Is there any reasonably efficient way of performing qudit circuit simulations using Stim?

Stim only speaks qubits, not qudits. All of the supported gates are qubit gates, and all of the internal data structures are for specifically the qubit case. There are no plans to add native support ...
• 21.8k

### Is there any reasonably efficient way of performing qudit circuit simulations using Stim?

Since you're mentioning Stim, I guess you mean stabilizer circuits. I do not know about the capabilities of Stim, but judging from the documentation, it seems to work only for qubits. Nevertheless, ...
• 3,027
Accepted

### nonlinear behavior of $1/\Lambda$ in surface code simulations around threshold

You are underappreciating how much of an approximation that equation is supposed to be. the simulation results, I get that 1/Λ behaves very nonlinearly when crossing the threshold Yes, everything is ...
• 21.8k

### How can I visualize a stim circuit?

You can use stimcirq to convert your Stim circuit into a Cirq circuit then visualize it: ...
• 4,010

### How can I apply 2 qubit pauli operator error instead of CNOT operator in stim code?

You can use CORRELATED_ERROR to introduce probabilistic Pauli products. CNOT 0 1 CORRELATED_ERROR(0.001) X0 X1 You can also use ...
• 21.8k
1 vote
Accepted

### Is there any implementation in stim that takes correlated edges into consideration?

When you call stim.Circuit.detector_error_model to extract a matching graph from an annotated circuit, you can add the argument ...
• 21.8k
1 vote
Accepted

### Adding dephasing to stim's generated surface code circuits

Stim's circuit generation is really just for getting started; it doesn't provide highly detailed options for controlling exactly what kind of noise to apply. There's too many variations in what sorts ...
• 21.8k
1 vote
Accepted

### extracting the Pauli error on the data qubits at the end of circuit in stim

There is no option to sample the final Pauli frame exposed to stim's python API (as of 1.18). The closest you can get is to add measurement operations at the end of the circuit, which will be flipped ...
• 21.8k
1 vote

### when calculating code thresholds, why do we need to take a number of rounds that scales with the code distance?

(Note: you should take more data so those curves have less noise. You might also want to plot standard deviations of some sort so you can see the noise. The Stim example keeps to really low rep rates ...
• 21.8k
1 vote

### Simulating flag qubits and conditional branches using Stim

This might come a bit late, but I am also interested in running stim with branching. To facilitate this, I wrote a piece of code that turns a stim program into an iterator that breaks a program into ...
• 988

Only top scored, non community-wiki answers of a minimum length are eligible