v0.3.1 — Internal cleanup and PEC crash fix
Internal cleanup release. No API changes — drop-in upgrade with pip install -U emrg.
Fixed
_compute_pec_samplesno longer crashes on deep circuits. Forcing--technique pecon a circuit deep enough that the overhead estimate saturated tomath.infraisedOverflowError. It now returnsPEC_MAX_SAMPLESforinfandnanoverheads, so the CLI andgenerate_recipe()degrade gracefully instead of aborting.
Performance
-
analyze_circuitruns 9–44% faster on circuits with 20+ qubits. Layer heterogeneity and non-Clifford counting now share a single DAG traversal instead of building the DAG twice. Measured on the benchmark suite:- Random 20q: −17% (1.09 ms → 0.91 ms)
- Random 30q: −44% (3.68 ms → 2.07 ms)
- Random 50q: −23% (6.52 ms → 5.02 ms)
Small circuits see similar relative wins; absolute time is already sub-millisecond.
Changed
run_previewnow catches only(ValueError, RuntimeError, ImportError, NotImplementedError)instead of everyException. Real programmer errors — wrong observable shape, Mitiq API drift, unexpected types — now surface instead of being silently wrapped as a user-facing warning. Failures also emit a debug traceback vialogging.getLogger("emrg.preview"); enable it withlogging.basicConfig(level=logging.DEBUG).emrg[preview]no longer pullsqiskit-aer(never imported).- New
emrg[qasm3]extra installsqiskit_qasm3_importfor OpenQASM 3 input. - Development status classifier: Alpha → Beta.
Internal
Quality pass on the cleanup front — no behavior change for users:
- Removed dead code:
_make_noiseless_executor(superseded by_make_executor(0.0, ...)) and a stale no-op branch informat_preview. - Consolidated observable string parsing (
Z0,Z1, ...,ZZ) into one classifier used by both parse and label paths. - Relocated the
make_featurestest helper intotests/conftest.py. - Pytest now runs with
--strict-markers --strict-config -ra.
Verification
- 366 → 369 tests (three new regression tests pin the PEC overflow fix).
- Coverage held at 96%.
ruff checkclean.- Benchmark suite passes end-to-end including ZNE, PEC, and CDR fidelity comparisons.
Full Changelog: v0.3.0...v0.3.1