Skip to content

feat: add amplitude damping noise model#522

Open
huhaha120 wants to merge 1 commit into
TeamGraphix:masterfrom
huhaha120:codex/graphix-amplitude-damping-noise
Open

feat: add amplitude damping noise model#522
huhaha120 wants to merge 1 commit into
TeamGraphix:masterfrom
huhaha120:codex/graphix-amplitude-damping-noise

Conversation

@huhaha120
Copy link
Copy Markdown

Summary

  • Add single-qubit and two-qubit amplitude damping Kraus channels.
  • Add AmplitudeDampingNoise, TwoQubitAmplitudeDampingNoise, and AmplitudeDampingNoiseModel.
  • Export the new noise model through graphix.noise_models.
  • Add tests covering Kraus operators, noise-model transpilation, and density-matrix application.

Closes #497

Test Soundness

  • tests/test_kraus.py checks that the one-qubit channel matches the Nielsen-Chuang amplitude damping Kraus operators and that the two-qubit channel is the tensor product of the one-qubit channel on both qubits.
  • tests/test_noise_model.py checks that each pattern command receives the expected one- or two-qubit amplitude damping noise at the same insertion points as the existing depolarising model.
  • tests/test_noisy_density_matrix.py checks physical action on density matrices:
    • an excited state decays to diag(gamma, 1-gamma);
    • a simple Hadamard MBQC pattern with measurement-channel damping matches the closed-form diagonal result.

Tests

uv run --python 3.11 --with-editable . --with pytest python -m pytest -o addopts='' tests/test_kraus.py tests/test_noise_model.py tests/test_noisy_density_matrix.py -q
uv run --python 3.11 --with-editable . --with ruff ruff check graphix/channels.py graphix/noise_models/amplitude_damping.py graphix/noise_models/__init__.py tests/test_kraus.py tests/test_noise_model.py tests/test_noisy_density_matrix.py
uv run --python 3.11 --with-editable . --with ruff ruff format --check graphix/channels.py graphix/noise_models/amplitude_damping.py graphix/noise_models/__init__.py tests/test_kraus.py tests/test_noise_model.py tests/test_noisy_density_matrix.py
git diff --check

Results:

  • 49 passed
  • All checks passed!
  • 6 files already formatted
  • git diff --check produced no output

Notes

  • I used -o addopts='' locally because the repository's default pytest addopts include --benchmark-autosave, which requires the dev benchmark plugin. The focused tests above do not use benchmarking.
  • AI assistance was used while drafting this change. I reviewed the implementation, corrected the analytical test expectation, and verified it with the tests and lint commands above.

@huhaha120 huhaha120 force-pushed the codex/graphix-amplitude-damping-noise branch from 43e5a7f to 7fa44d5 Compare June 3, 2026 02:23
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.85%. Comparing base (6dd835a) to head (7fa44d5).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
graphix/noise_models/amplitude_damping.py 87.87% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #522   +/-   ##
=======================================
  Coverage   88.85%   88.85%           
=======================================
  Files          49       50    +1     
  Lines        7135     7207   +72     
=======================================
+ Hits         6340     6404   +64     
- Misses        795      803    +8     

☔ 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.

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.

Implement amplitude damping noise model

1 participant