Skip to content

Fix MR-family measurement noise double counting#124

Merged
rafaelha merged 1 commit into
mainfrom
rafaelha/fix_mr_gate_noise
Apr 25, 2026
Merged

Fix MR-family measurement noise double counting#124
rafaelha merged 1 commit into
mainfrom
rafaelha/fix_mr_gate_noise

Conversation

@rafaelha

@rafaelha rafaelha commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

The MR, MRX, MRY channels with finite bit flip probability incorrectly applied two bitflip channels instead of one.

  • Remove the extra pre-measurement error channel from MR, MRX, and MRY
  • Add parser-level coverage for probability-bearing instructions and MR-family noise semantics
  • Document the fix in the changelog

…t noise

- Fixed `MR`, `MRX`, and `MRY` functions to ensure measurement flip probability is not counted as both a pre-measurement Pauli error and a measurement-result flip.
- Added unit tests to verify that MR-family instructions correctly handle measurement noise without double-counting.
- Updated CHANGELOG to reflect these changes.
@rafaelha rafaelha added the category: bug Something isn't working label Apr 24, 2026
@rafaelha rafaelha requested a review from Copilot April 24, 2026 21:23
@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-25 11:31 UTC

@github-actions

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2340 2269 97% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/tsim/core/instructions.py 99% 🟢
TOTAL 99% 🟢

updated for commit: 680b1e3 by action🐍

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an issue in the Stim-to-GraphRepresentation parser/execution path where MR-family demolition measurements with a nonzero flip probability were applying the same flip noise twice.

Changes:

  • Remove the redundant pre-measurement x_error application from MR, MRX, and MRY instruction handlers (leaving the single flip-noise application done by m(..., p=...)).
  • Add unit tests covering probability-bearing instructions and specifically verifying MR-family doesn’t create two independent noise channels for a single probability.
  • Document the behavioral fix in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/unit/core/test_parse.py Adds parser-level unit tests for probability-bearing instructions, including MR-family noise semantics.
src/tsim/core/instructions.py Removes redundant noise injection from MR-family wrappers to prevent double-counting.
CHANGELOG.md Notes the MR-family double-counting fix in the Unreleased section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md
Comment thread test/unit/core/test_parse.py
@rafaelha rafaelha merged commit 05c55a4 into main Apr 25, 2026
14 checks passed
@rafaelha rafaelha deleted the rafaelha/fix_mr_gate_noise branch April 25, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants