Skip to content

Fix #636: ApplyNoise derives from BaseCommand - #639

Merged
thierry-martinez merged 7 commits into
TeamGraphix:masterfrom
thierry-martinez:fix-636
Nov 11, 2026
Merged

thierry-martinez merged 7 commits into
TeamGraphix:masterfrom
thierry-martinez:fix-636

Conversation

@thierry-martinez

Copy link
Copy Markdown
Collaborator

ApplyNoise now derives from BaseCommand, like other commands. It implements reindex, which maps both its nodes and its domain, and uses the concise repr from DataclassReprMixin.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

`ApplyNoise` now derives from `BaseCommand`, like other commands. It
implements `reindex`, which maps both its nodes and its domain, and
uses the concise `repr` from `DataclassReprMixin`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.98%. Comparing base (01ccb7e) to head (42925b0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #639      +/-   ##
==========================================
+ Coverage   89.97%   89.98%   +0.01%     
==========================================
  Files          49       49              
  Lines        8466     8447      -19     
==========================================
- Hits         7617     7601      -16     
+ Misses        849      846       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matulni matulni 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.

Thank you for the fix!

Comment thread tests/test_noise_model.py Resolved
Comment thread graphix/noise_models/noise_model.py Resolved
@matulni matulni linked an issue Nov 3, 2026 that may be closed by this pull request
thierry-martinez and others added 5 commits November 4, 2026 23:26
Following review: `DepolarisingNoise`, `TwoQubitDepolarisingNoise`,
`AmplitudeDampingNoise` and `TwoQubitAmplitudeDampingNoise` are now
frozen dataclasses using `DataclassReprMixin`, so that
`repr(DepolarisingNoise(0.1)) == "DepolarisingNoise(0.1)"`, and they
support value equality and hashing.

The `Probability` descriptor does not combine with dataclasses: the
descriptor itself is taken as the field default, and its `__set__`
cannot assign the private field of a frozen instance. The probability
is now checked in `__post_init__` with the new
`graphix.utils.check_probability`. The tutorial, which used the
descriptor in a dataclass and therefore failed, is updated accordingly.

Since noise instances are immutable, `ApplyNoise.reindex` can share
the noise with the original command; this is now documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pranav97nair pranav97nair 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.

Thanks for this change, LGTM!

@thierry-martinez
thierry-martinez merged commit 53855da into TeamGraphix:master Nov 11, 2026
24 checks passed
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.

[Bug]: ApplyNoise should derive from BaseCommand

3 participants