fix(viz): draw kept seeds on top of filtered ones in visualize_seeds - #343
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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>
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.
What
Make
visualize_seedsalways render kept (True) seeds on top of filtered-out (False) seeds.Why
Follow-up to #340.
visualize_seedsplotted every seed as a singlehv.Pointslayer, 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
Pointslayers, filtered-out seeds first and kept seeds last: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_cmapmapping. The unmasked path keeps its single white layer. Point sizing (size_indexreproduction from #340) and hover are unchanged.Tests
Added
TestVisualizeSeedspinning that the topPointslayer 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/