deltakit.explorer.Client.simulate_stim_circuit#

Client.simulate_stim_circuit(stim_circuit: str | Circuit, shots: int) tuple[Measurements, LeakageFlags | None]#

Simulate STIM circuit with Deltakit client.

Parameters:
  • stim_circuit (str | stim.Circuit) – Any STIM circuit. May include leakage instructions.

  • shots (int) – Number of shots.

Returns:

(Measurements, Leakage). Leakage may be None.

Return type:

Tuple[Measurements, Optional[LeakageFlags]]

Examples

Generate and simulate a circuit with leakage:

compiled_circuit = client.generate_circuit(
    types.QECExperimentDefinition.get_rotated_planar_z_quantum_memory(
        distance=distance,
        num_rounds=num_rounds,
        basis_gates=["CZ", "H", "MZ", "RZ"],
    )
)
# Add leakage noise
leakage_noise_model = types.SI1000NoiseModel(p=0.001, p_l=0.001)
noisy_circuit = client.add_noise(
    stim_circuit=compiled_circuit,
    noise_model=leakage_noise_model,
)
measurements, leakage = client.simulate_stim_circuit(
    stim_circuit=noisy_circuit,
    shots=num_shots,
)