Dev metrics - #4
Merged
Merged
Conversation
…rison Single scalar noise-corrected scores were hard to trust as "the right metric" for filter comparison. Each A-B diff map (std, LoG, gradient, wavelet, Weber, plus the raw normalised-image diff) now also yields a subsampled pixel-value distribution, split by the same shared nebula/background masks already used for the noise-corrected scores, rendered as one combined violin+IQR-box figure alongside the existing per-scale maps and tables. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nd correlation plots Section 8 (Spatial Detail) previously summarised A-vs-B agreement as a plain per-pixel difference, which conflates images at different absolute brightness scales and buries the signal this report exists to surface: which filter preserves more structure/contrast. - Replace the A-B diff with log10(|A|/|B|) across every metric family (std, LoG, gradient, wavelet, Weber, original) - panels, diff-panel colour maps, the Section 8a violin plots, and the Report Inspector's exported label all now reflect the ratio metric. - Add a mask illustration figure (translucent nebula/background overlay on Image A) explaining how the shared masks used by the violin and correlation plots are detected. - Add a new Section 8g: per-scale correlation scatter plots (A vs B, 1:1 reference line) for all 14 metric/scale combinations, with full unclipped axis ranges plus dual linear fits (whole-population and tail-restricted) so divergence in the high-detail regime is visible and quantified separately from bulk agreement. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Each spatial-detail metric group (e.g. "Local sigma, kernel 3px") used to render as a tall 3x1 stack (Image A, Image B, log-ratio diff) plus a separate standalone cross-section image glued on below it when a crosshair was set - visually awkward and treating the cross-section as a bolt-on. - _plot_side_by_side now renders a 2x2 grid (A | B on top, log-ratio diff | cross-section on bottom) via a new xs_data parameter, always at the same geometry whether or not a crosshair is set (blank bottom-right panel when it isn't). - _plot_cross_section is replaced by _draw_cross_section, which draws into an existing Axes instead of creating its own Figure - one image per group instead of two. - All 5 metric families (std, LoG, gradient, wavelet, Weber) sample the cross-section before building the figure, and the noise-normalised variant now gets its own real cross-section (sampled from the noise-normalised arrays) instead of no cross-section at all. - Weber contrast gains crosshair/cross-section support for the first time, matching the other four families. - report_builder.py: removed the now-unused paired_figs_for/xs_figs_for helpers, relocated the cross-section methodology note to apply globally, and reworded captions across 8b-8f for the new embedded-panel layout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A release build silently hung on the ubuntu-latest apt-get step for the full default 6-hour job timeout before being canceled. Bound job and apt-get step durations so a future hang fails in minutes, not hours. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…pe background calc Cross-section panels no longer plot a distracting A-B diff trace on a twinx axis; per-scale correlation scatters now sit directly next to their matching map figure (8b-8f) instead of in one late "8g" dump, fixing a latent alphabetic mis-ordering (std_10px before std_3px) along the way. Also confirmed the nebula/background mask already uses full-image background stats, not the ROI, and closed a real inefficiency found while checking: estimate_background() is now idempotent and precomputed once per image object before parallel analyzer dispatch, instead of being recomputed by every one of the 6 analyzers that touch the same AstroImage instance. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Section 8 was crashing with "index -1 is out of bounds for axis 0 with size 0" whenever a previously-drawn ROI outlived the image pair it was drawn on: MainWindow._roi is never cleared on a new image load, so a stale, now out-of-bounds ROI silently slices to a zero-size array (NumPy doesn't raise on an out-of-range slice), which only fails much later and far from the cause, deep inside np.percentile. Power Spectrum and Edge Detection have the identical unguarded ROI slice, so validate once at the actual boundary (MainWindow._on_run, the only path that constructs AnalysisThread) instead of patching every analyzer: an out-of-bounds ROI is now cleared with an explanatory warning rather than silently corrupting downstream arrays. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tter Each Section 8 metric-family figure gains a third row: a histogram of the log-ratio map's pixel distribution, colour-matched to the log-ratio panel above it, making the A-vs-B divergence easier to read at a glance. The adjacent per-pixel correlation scatter plots drop their overall/tail regression fit lines (kept the 1:1 reference) in favour of coloring each point by its own log-ratio value on the same bwr scale, linking the scatter back to the map instead of adding two more lines to interpret. Co-Authored-By: Claude Sonnet 5 <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.
Section 8 (Spatial Detail Comparison) rework: replaces the plain A−B pixel difference with a log10(|A|/|B|) ratio metric across every metric family (std, LoG, gradient, wavelet, Weber), and layers on a series of readability improvements on top of it — pixel-distribution violin plots, a shared nebula/background mask illustration, per-scale correlation scatter plots, cross-sections embedded directly into each map figure, and (this session) a log-ratio histogram row plus decluttered, color-linked correlation scatter points. Also includes one crash fix (stale ROI) and one CI reliability fix (job timeouts).
Replace Section 8's diff metric with log-ratio (5240b0e) — A−B diff conflated images at different absolute brightness scales; log10(|A|/|B|) is now used everywhere, plus a new mask illustration figure and per-pixel correlation scatter plots.
Add Section 8a violin-plot distributions (9752f22) — each diff map also renders a subsampled pixel-value distribution split by nebula/background mask, so single scalar noise-corrected scores aren't the only signal to trust.
Merge cross-sections into a single 2×2 grid (1c7ecc1) — cross-section profiles moved from a separate bolt-on image into the bottom-right panel of each map figure; Weber contrast gains cross-section support for the first time.
Simplify cross-sections, interleave correlation plots, dedupe background calc (72ab113) — dropped a distracting twinx diff trace, moved correlation scatters next to their matching map (fixing an alphabetic mis-ordering), and made estimate_background() idempotent so it's computed once per image instead of redundantly by every analyzer.
Add log-ratio histograms, declutter correlation scatter (bd10854, this session) — each map figure gains a third-row histogram of the log-ratio map's pixel distribution, color-matched to the map above it; correlation scatter points are now colored by their own log-ratio value (same bwr scale) instead of drawing two regression fit lines.
Clear and warn on a stale ROI (8d9219f) — fixes a crash (index -1 is out of bounds) when a previously-drawn ROI outlives the image pair it was drawn on; validated once at MainWindow._on_run() instead of patching every analyzer.
CI: add timeout-minutes to fail fast on runner hangs (298217b) — bounds job/step duration so a hung release build fails in minutes, not the 6-hour default.
Files touched: analysis/image_filters.py (+562/−
150), report/report_builder.py (+318/−90), gui/main_window.py, gui/analysis_thread.py, core/astro_image.py, core/models.py, .github/workflows/{ci,release}.yml, tests/test_analysis/test_spatial_detail.py (+117 new tests), CLAUDE.md.