Add Stim circuit importer#224
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (37.28%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## feat/qec-helper #224 +/- ##
==================================================
Coverage ? 79.85%
==================================================
Files ? 28
Lines ? 4219
Branches ? 731
==================================================
Hits ? 3369
Misses ? 698
Partials ? 152 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 740221185c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| *, | ||
| context: _ImportContext, | ||
| ) -> _Fragment: | ||
| circuit = Circuit(len(context.stim_to_qubit)) |
There was a problem hiding this comment.
Avoid creating identity wires for every tick block
When a tick-separated unitary block touches only some of the global Stim qubits, such as H 10 before a later MPP X10*Z12, this full-width Circuit creates an idle wire whose single graph node is both an input and an output. On the next compose for that same qindex, the matched output node is excluded and then remapped again as a graph1 input, leaving no node_map1 entry and causing the importer to raise KeyError instead of producing a pattern. Build each fragment only over the qubits present in that block, or handle these input/output identity nodes during composition.
Useful? React with 👍 / 👎.
This reverts commit 62e9419.
Summary
Validation
uv run --extra stim pytest tests/test_stim_importer.py tests/test_stim_mpp.py tests/test_qec.py -quv run --extra stim pytest tests/test_stim_compiler.py tests/test_ptn_format.py::test_roundtrip_preserves_logical_observables_for_stim tests/test_ptn_format.py::test_roundtrip_preserves_detectors_for_stim -quv run --no-sync pyright graphqomb/stim_importer.pyuv run --no-sync ruff check