Skip to content

feat: unify image stats and use ihist#249

Merged
tlambert03 merged 11 commits intopyapp-kit:mainfrom
tlambert03:ihist
Mar 8, 2026
Merged

feat: unify image stats and use ihist#249
tlambert03 merged 11 commits intopyapp-kit:mainfrom
tlambert03:ihist

Conversation

@tlambert03
Copy link
Copy Markdown
Member

this consolidates two image statistics paths that used to be serial and independent (calculation of clims and the conditional calculation of histograms) into a single compute_image_stats, backed by ihist (thanks @marktsuchida !)

Scenario Old (ms) New (ms) Speedup Strategy
uint8, hist+minmax 5.35 0.33 16x ihist → minmax from counts
uint16, hist+percentile 35.44 1.00 35x ihist → percentile from CDF
uint16 12-bit, hist+minmax 5.41 0.46 12x ihist(bits=12) → minmax from counts
float32, hist+minmax 60.28 19.71 3.1x nanmin/maxnp.histogram(256)
uint16, no hist, percentile 28.06 1.00 28x ihist → percentile from CDF
float32, no hist, minmax 0.34 0.33 1x nanmin/nanmax (unchanged)
float32, no hist, stddev 8.73 8.73 1x nanmean/nanstd (unchanged)

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 95.08197% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.96%. Comparing base (41e6da6) to head (b0358dc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ndv/controllers/_image_stats.py 94.50% 5 Missing ⚠️
src/ndv/controllers/_channel_controller.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #249      +/-   ##
==========================================
+ Coverage   86.85%   86.96%   +0.11%     
==========================================
  Files          46       47       +1     
  Lines        5347     5441      +94     
==========================================
+ Hits         4644     4732      +88     
- Misses        703      709       +6     

☔ View full report in Codecov by Sentry.
📢 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.

@tlambert03 tlambert03 merged commit 1f05e52 into pyapp-kit:main Mar 8, 2026
63 checks passed
@tlambert03 tlambert03 deleted the ihist branch March 8, 2026 22:49
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