Skip to content

Add Stim MPP stabilizer import#217

Open
masa10-f wants to merge 7 commits into
masterfrom
feat/qec-helper
Open

Add Stim MPP stabilizer import#217
masa10-f wants to merge 7 commits into
masterfrom
feat/qec-helper

Conversation

@masa10-f

Copy link
Copy Markdown
Collaborator

Summary

  • Add graphqomb.qec.stim_mpp utilities for extracting StabilizerCode inputs from Stim MPP layers.
  • Preserve sparse Stim qubit ids via dense-column mappings and import qubit coordinates.
  • Add optional graphqomb[stim] dependency metadata and lockfile entries.
  • Document the feature in CHANGELOG.md.

Validation

  • env PYTHONPATH=/home/masa10/git-repos/utftbmqc/ls-pattern-compile:/home/masa10/git-repos/utftbmqc/graphqomb uv run --no-sync ruff check
  • env PYTHONPATH=/home/masa10/git-repos/utftbmqc/ls-pattern-compile:/home/masa10/git-repos/utftbmqc/graphqomb uv run --no-sync pytest -q
  • env PYTHONPATH=/home/masa10/git-repos/utftbmqc/ls-pattern-compile:/home/masa10/git-repos/utftbmqc/graphqomb uv run --no-sync pyright graphqomb/qec/stim_mpp.py tests/test_stim_mpp.py

@masa10-f masa10-f marked this pull request as ready for review July 8, 2026 12:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be48e39c71

ℹ️ 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".

Comment thread graphqomb/qec/stim_mpp.py


def _target_pauli(target: stim.GateTarget) -> str:
if target.is_x_target:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle inverted MPP targets instead of dropping signs

When a Stim MPP product uses an inverted target such as MPP !Z5 or X2*!Y3*Z5, Stim flips the recorded measurement result, but this parser treats the target exactly like an uninverted Pauli target and loses that sign/constant offset. For circuits that use these valid MPP forms, the extracted stabilizer and any imported detector/logical parity rows no longer match the Stim circuit; if signs are not representable here, this should at least reject target.is_inverted_result_target instead of silently importing incorrect data.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant