Skip to content

fix(viz): draw kept seeds on top of filtered ones in visualize_seeds - #343

Merged
daharoni merged 6 commits into
masterfrom
fix/visualize-seeds-zorder
Jun 26, 2026
Merged

fix(viz): draw kept seeds on top of filtered ones in visualize_seeds#343
daharoni merged 6 commits into
masterfrom
fix/visualize-seeds-zorder

Conversation

@daharoni

@daharoni daharoni commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What

Make visualize_seeds always render kept (True) seeds on top of filtered-out (False) seeds.

Why

Follow-up to #340. visualize_seeds plotted every seed as a single hv.Points layer, colored by the mask column (True = white/kept, False = red/rejected). With one layer, the draw order is just the seeds dataframe's row order, so after a refinement step a rejected (red) seed can land on top of and hide a kept (white) seed. There was no guarantee that good seeds stayed visible.

Change

Split the masked path into two overlaid Points layers, filtered-out seeds first and kept seeds last:

return im * false_pts * true_pts

Overlay order is the only contractual z-order in HoloViews (within-layer row order is backend-dependent), so kept seeds are now reliably on top regardless of dataframe order or backend. Per-layer fixed colors replace the cmap/pt_cmap mapping. The unmasked path keeps its single white layer. Point sizing (size_index reproduction from #340) and hover are unchanged.

Tests

Added TestVisualizeSeeds pinning that the top Points layer contains only the kept (True) seeds and the bottom only the rejected (False) seeds, with interleaved input so a single-layer plot would mix them. Also covers the unmasked single-layer case. All pass locally on HoloViews 1.23 / bokeh.

🤖 Generated with Claude Code


📚 Documentation preview 📚: https://minian--343.org.readthedocs.build/en/343/

daharoni and others added 4 commits June 26, 2026 00:49
visualize_seeds plotted all seeds as a single hv.Points layer and colored them
by the mask column (True=white kept, False=red rejected). With one layer, the
draw order is just the seeds dataframe row order, so after a refinement step a
rejected (red) seed could land on top of and hide a kept (white) seed.

Split the masked path into two overlaid Points layers, filtered-out seeds first
and kept seeds last. Overlay order is the only contractual z-order in
HoloViews, so kept seeds are now always rendered on top regardless of row
order or plotting backend. Per-layer fixed colors replace the cmap mapping, so
pt_cmap is no longer needed. The unmasked path keeps its single white layer.

Add regression tests pinning that the top Points layer holds only the kept
(True) seeds and the bottom only the rejected (False) seeds, plus the unmasked
single-layer case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The overlay now carries a title reporting how many seeds the mask kept
(true/white) versus filtered out (false/red), counted from the same subsets
that are plotted so the header can never disagree with the points. The
unmasked plot shows the total seed count. Tests assert both headers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

daharoni and others added 2 commits June 26, 2026 08:35
Collapse the three near-identical hv.Points(...).options(color=..., **opts_pts)
calls in visualize_seeds into one local helper, and share a single module-level
_max_proj fixture between the two test classes instead of duplicating the
identical zeros DataArray. No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@daharoni
daharoni merged commit 86f2649 into master Jun 26, 2026
7 checks passed
@daharoni
daharoni deleted the fix/visualize-seeds-zorder branch June 26, 2026 16:02
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