Enhance interactive 3D viz: overlays, server-side rendering, fast playback#1310
Enhance interactive 3D viz: overlays, server-side rendering, fast playback#1310sbryngelson merged 2 commits intoMFlowCode:masterfrom
Conversation
|
(review resolved) |
c04b08f to
a8c6c48
Compare
|
(review resolved) |
a8c6c48 to
c097d2f
Compare
|
(review resolved) |
c097d2f to
d46ca53
Compare
Claude Code ReviewHead SHA: d46ca53 Files changed (3):
Summary
Findings1.
|
…yback Major interactive visualization improvements: **New features:** - Contour overlays (2D/3D), isosurface/isovolume mixing - Solid color isosurfaces, opacity control, improved timestep slider - Server-side rendering via kaleido on Linux for fast 3D playback over SSH **Playback performance:** - Aggressive data prefetch: 3 workers, 15 steps ahead, 40-entry cache - 3D mesh prefetch: 3 workers, 50K cell budget during playback - Force Dash patch path during playback to avoid full re-renders - Prefetch keeps cache warm so playback hits ~0.002s/frame **Dependencies:** - Add kaleido for server-side Plotly figure rendering (Linux SSH) - Remove pyvista (replaced by kaleido) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d46ca53 to
7652c9f
Compare
Claude Code ReviewHead SHA: Files changed: 3
Summary
Findings1.
Consider using a platform marker or optional extras: "kaleido; sys_platform == 'linux'",or move to 2. Kaleido disabled permanently on any render failure ( except Exception as _kal_exc:
_KALEIDO_OK = FalseA transient failure (OOM on a very large mesh, a one-off encoding error) permanently disables kaleido for the entire session. Only import failures ( 3. # line ~1027 (inside 3D block)
_has_overlay_3d = overlay_var and overlay_var != '__none__'
...
# line ~1317 (inside 2D block, same callback)
_has_overlay = overlay_var and overlay_var != '__none__'Two different names compute the identical expression. This is harmless but could lead to accidental divergence if conditions differ in future edits. Unifying to one variable at the top of 4. _ov_tf = _tf(_ov_3d_raw)
_ov_vmin = float(np.nanmin(_ov_tf))
_ov_vmax = float(np.nanmax(_ov_tf))
5. In 2D and 3D-slice mode, int(overlay_nlevels or 3), # used as iso_n for overlay isosurfaceThe slider is labeled "Levels" and ranges 1–20 with default 5. Isosurfaces are typically 1–5; contour lines 5–20. This dual semantics may produce unexpected results (e.g., 20 overlay isosurfaces on a coarse mesh) and the label won't make sense for the 3D overlay case. A dedicated "Overlay iso count" slider or dynamic label update would help. Improvement opportunities
|
Claude Code ReviewHead SHA: e0cb2ed Files changed: 3
Summary
Findings1. "kaleido",The kaleido path is only exercised on Linux during playback ( 2. Axis transposition in px = _interp_indices(contour[:, 0], x_cc) # contour[:,0] is ROW index
py = _interp_indices(contour[:, 1], y_cc) # contour[:,1] is COL index
3. Kaleido permanently disabled after first transient failure except Exception as _kal_exc:
_KALEIDO_OK = False # never re-enabled for the lifetime of the serverA single OOM, timeout, or transient kaleido crash permanently silences server-side rendering for the rest of the session. Users would have to restart the viz server. Consider a retry counter (e.g. disable after N consecutive failures) or simply log and skip the current frame rather than blacklisting kaleido globally. 4. Overlay isosurface always uses the primary variable's log transform _ov_vx, ... = _compute_isomesh(
_ov_ds, _ox, _oy, _oz,
_tf, # ← primary variable's transform
_ov_ilo, _ov_ihi,
...
)
5. Minor / Nits
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes introduce a 3D mesh prefetch cache system and server-side rendering capabilities using Kaleido, along with UI enhancements for contour overlays. The step cache is expanded to retain more timesteps, the prefetch thread pool is scaled up, and new helper functions support 3D mesh caching, Kaleido availability detection, and contour computation for both 2D and 3D data. The interactive rendering flow is extended to support cached mesh reuse and server-side image rendering, with new UI controls for overlay parameters and visibility toggles. A new Kaleido dependency is added to the project configuration. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.Add a .trivyignore file to your project to customize which findings Trivy reports. |
There was a problem hiding this comment.
Pull request overview
This PR enhances the interactive 3D visualization tool with contour overlays (2D and 3D), solid color isosurfaces, opacity controls, server-side rendering via kaleido for fast 3D playback over SSH, and aggressive data/mesh prefetching. It replaces the dropdown timestep selector with a slider and removes the pyvista dependency in favor of kaleido.
Changes:
- Added kaleido-based server-side Plotly rendering for 3D playback on Linux, with contour overlay support (2D
find_contours+ 3D slice contours), isosurface/isovolume overlay mixing, solid-color isosurface option, and opacity controls. - Replaced the timestep dropdown with a slider and improved playback performance with adaptive frame-rate limiting, 3D mesh prefetching (50K cell budget, 3 workers), and a 40-entry mesh cache.
- Increased step cache size from 20→40 entries and prefetch workers from 1→3 for faster data pipeline throughput.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
toolchain/pyproject.toml |
Added kaleido dependency for server-side image export |
toolchain/mfc/viz/interactive.py |
Core changes: kaleido rendering, contour overlays, 3D mesh prefetch cache, new UI controls, timestep slider, adaptive frame pacing |
toolchain/mfc/viz/_step_cache.py |
Increased cache size to 40 and prefetch workers to 3 |
| # If loaded via single-var mode, we need to load the overlay | ||
| # variable separately. |
| NOTE: uses a 50K cell budget (vs 500K for interactive). This is | ||
| intentional — faster prefetch keeps the cache ahead of playback. | ||
| On pause the first render serves the coarse mesh instantly; the next | ||
| callback recomputes at full 500K resolution. The cache key omits | ||
| the budget so the coarse entry is replaced on the full-res recompute. |
Claude Code ReviewHead SHA: e0cb2ed
Summary
FindingsBug — Overlay isosurface uses primary variable's log transform (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1310 +/- ##
=======================================
Coverage 45.36% 45.36%
=======================================
Files 70 70
Lines 20515 20499 -16
Branches 1954 1953 -1
=======================================
- Hits 9306 9300 -6
+ Misses 10082 10074 -8
+ Partials 1127 1125 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Dependencies
kaleidofor server-side Plotly image export (Linux SSH playback)pyvista(replaced by kaleido — simpler, identical visual output)Test plan
./mfc.sh precheck -j 8passes./mfc.sh viz <2d_dir> -i) works as before🤖 Generated with Claude Code