v0.2.9 -- Preview Mode
What's New
Preview mode -- EMRG can now simulate your circuit with noise and show the before/after effect of its recommended mitigation, before you spend real hardware shots.
CLI
emrg generate circuit.qasm --preview
emrg generate circuit.qasm --preview --noise-level 0.03 --observable ZZ
emrg generate circuit.qasm --preview --technique pec --noise-model
Python API
result = generate_recipe(qc, preview=True, noise_level=0.01)
print(result.preview.error_reduction) # e.g. 77.5How it works
Preview runs a Cirq DensityMatrixSimulator with per-gate depolarizing noise. It computes ideal, noisy, and mitigated expectation values using the actual recipe EMRG generated (ZNE factory + scaling method, or PEC with depolarizing representations). Results are displayed in a comparison box in the terminal.
Limitations
- Density matrix simulation caps at 10 qubits. Larger circuits skip with a warning.
- Wide circuits (8-10 qubits) have gate-count budgets to keep simulation under 30 seconds.
- PEC preview uses 200 samples for speed. Results are approximate.
- Requires
cirq-core. Install withpip install emrg[preview]. Base package works without it.
Other changes
--noise-levelflag validated to range 0 < p <= 0.5run_preview()andPreviewResultexported from public APIpreviewparameter added togenerate_recipe()[preview]optional dependency group in pyproject.toml- 319 tests, zero lint warnings