feat(imaging): DataDegrader for sparsity validation (#187)#240
Merged
KedoKudo merged 2 commits intofeature/172-2d-imagingfrom Feb 21, 2026
Merged
feat(imaging): DataDegrader for sparsity validation (#187)#240KedoKudo merged 2 commits intofeature/172-2d-imagingfrom
KedoKudo merged 2 commits intofeature/172-2d-imagingfrom
Conversation
…ion (#187) Adds DataDegrader to src/pleiades/imaging/degrader.py with three degradation methods: add_poisson_noise (photon-counting simulation), add_dead_pixels (open-beam detector dead elements), and degrade_to_level (L1-L4 presets). All operations are reproducible via random_seed. 36 unit tests in tests/unit/pleiades/imaging/test_degrader.py cover happy paths, edge cases, error handling, and statistical expectations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fb5408b to
2f2d014
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a DataDegrader class to simulate realistic noise and detector degradation in hyperspectral transmission data for algorithm validation. The implementation supports reproducible Poisson photon-counting noise, dead pixel simulation, and preset degradation levels (L1-L4) representing different data quality scenarios.
Changes:
- Added
DataDegraderclass with Poisson noise simulation and dead pixel injection - Implemented four preset degradation levels (L1=mild to L4=extreme)
- Comprehensive test suite with 36 unit tests covering all methods, edge cases, and reproducibility
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/pleiades/imaging/degrader.py | New DataDegrader class with add_poisson_noise, add_dead_pixels, and degrade_to_level methods |
| tests/unit/pleiades/imaging/test_degrader.py | Comprehensive test suite covering initialization, Poisson noise, dead pixels, degradation levels, error handling, and reproducibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DataDegraderclass insrc/pleiades/imaging/degrader.pyadd_poisson_noise(data, n_incident): Poisson photon-counting noise, clips to [0,1]add_dead_pixels(data, dead_fraction): sets random pixel spectra to 1.0, returns (data, mask)degrade_to_level(data, level): L1–L4 presets (L1=5000, L2=500, L3=100+5%dead, L4=20+10%dead)random_seedTest plan
pixi run pytest tests/unit/pleiades/imaging/test_degrader.py -v→ 36 passed🤖 Generated with Claude Code