deltakit.explorer.simulation.simulate_with_stim#
- deltakit.explorer.simulation.simulate_with_stim(stim_circuit: str | Circuit, shots: int, result_file: str | Path | None = None, client: Client | None = None) tuple[Measurements, LeakageFlags | None]#
This method simulates the circuit using a Clifford STIM simulator. Clifford simulation is fast, and supports large numbers of qubits, but is limited in the set of gates one may use, and noise mechanisms.
- Parameters:
stim_circuit (str | stim.Circuit) – Circuit in STIM language.
shots (int) – Number of shots.
result_file (Optional[str | Path]) – If provided, saves the data to this file. If None, saves them in RAM. This is useful, when you run large local simulations, and want to save measurements directly to the disk. Not supported for cloud calls.
client (Optional[Client]) – If provided, performs the simulation using the client. Required if stim_circuit includes leakage. Currently implemented only when result_file is
None.
- Returns:
(Measurements, Leakage). Leakage may be None.
- Return type:
Tuple[Measurements, Optional[LeakageFlags]]
Examples
Running a circuit 1000 times and saving to a b8 file:
meas = simulation.simulate_with_stim( stim_circuit=noisy_circuit, shots=1000, result_file="results.b8", )Running a circuit 1000 times and saving to RAM:
meas = simulation.simulate_with_stim( stim_circuit=noisy_circuit, shots=1000, )