GPU-accelerated SPH neighbor search and operators built with NVIDIA Warp and PyTorch
Project description
sphWarpPlotting
sphWarpPlotting is a visualization layer for SPH particle data built on top of sphWarpCore.
It is designed to make SPH field inspection easy while keeping plotting configurable and update-friendly.
The library centers around two functions:
visualizeParticlesNew(...): build a plot from particle state, quantity, and plotting options.updatePlot(...): update an existing visualization state with new quantities and/or styling.
This repository also includes a full notebook demo in demo.ipynb and generated outputs in output/.
What This Library Does
- Visualizes particle scalar fields as scatter plots.
- Visualizes scalar fields on a regular grid (interpolated from particles).
- Applies SPH operations (for example gradients) during plotting.
- Maps vector/tensor quantities to scalars for coloring (
x,y,L2, etc.). - Overlays streamlines for vector fields.
- Supports stateful updates of an existing figure for interactive workflows.
Installation
From this repository:
pip install -e .
Notebook extras:
pip install -e .[notebooks]
Core API
from warpPlot import (
visualizeParticlesNew,
updatePlot,
PlottingOptions,
GridVisualization,
Mapping,
PlotScaling,
ColorMap,
StreamLineLocation,
)
Main Inputs
particleState:sphWarpCore.ParticleStatedomain:sphWarpCore.DomainDescriptionquantity: tensor to visualize (scalar or vector; can be mapped)options:PlottingOptions(...)for rendering and operation behavior
Main Output
visualizeParticlesNew returns a VisualizationState object containing figure/axis handles, filtered particle states, and artist handles used by updatePlot.
Minimal Example
import matplotlib.pyplot as plt
from warpPlot import visualizeParticlesNew, PlottingOptions, ColorMap
fig, ax = plt.subplots(1, 1, figsize=(6, 5))
state = visualizeParticlesNew(
fig,
ax,
particleState=particleState,
domain=domain,
quantity=f_smoothed,
options=PlottingOptions(
colorMap=ColorMap.rocket,
markerSize=4,
plotTitle="Smoothed Quantity",
),
)
fig.tight_layout()
Stateful Update Example
from warpPlot import updatePlot, ColorMap
updatePlot(
state,
particles=particleState,
domain=domain,
quantity=-f_smoothed,
colorMap=ColorMap.viridis,
)
Demo Gallery (from demo.ipynb)
1) Linear Gradient Validation
Computes a known linear field gradient with WarpSPH and compares against analytical reference.
2) WarpSPH vs DiffSPH Gradient Comparison
Visual side-by-side comparison of gradient components and their differences.
3) Scatter vs Grid Visualization
Shows the same smoothed scalar field as direct particle scatter and as a grid-mapped field.
4) Updating an Existing Plot State
Demonstrates stateful update of the same visualization object with new quantity/style settings.
5) On-the-fly Plotting Operation + Mapping
Computes gradient during plotting and maps to component views (Mapping.x, Mapping.y).
6) Grid + Streamlines
Shows mapped magnitude coloring with streamline overlay, sampled before mapping.
7) Streamline Figure Update
Stateful update of the streamline visualization.
Typical Workflow
- Build or load
particleStateanddomainfrom your SPH pipeline. - Choose a quantity (scalar or vector) to inspect.
- Configure
PlottingOptions:- colormap/scaling
- optional
plottingOperation - optional
mapping - optional
GridVisualizationand streamlines
- Call
visualizeParticlesNew(...). - Reuse returned state with
updatePlot(...)for iterative inspection.
Notes
mappingis essential when visualizing vector quantities as a color field.- Grid visualization is often easier to read for dense particle sets.
updatePlotis useful for simulation loops where geometry stays fixed but values change.
Running the Demo
Open and run all cells in demo.ipynb. The notebook saves figures into output/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphwarpplotting-0.4.0.tar.gz.
File metadata
- Download URL: sphwarpplotting-0.4.0.tar.gz
- Upload date:
- Size: 48.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3c1c267959be151fbd739683991beb18cf1282c89a45c50fb08af77da3e1387
|
|
| MD5 |
d49f63aac875691dc7542bbe0cc46a67
|
|
| BLAKE2b-256 |
f61205b2d82452940241df63c250caffb0ecec00e592da2a72d3ffe72116fdc3
|
File details
Details for the file sphwarpplotting-0.4.0-py3-none-any.whl.
File metadata
- Download URL: sphwarpplotting-0.4.0-py3-none-any.whl
- Upload date:
- Size: 57.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93957b0f50d6f776ecfb7fc843bcce983eeae644fb284edb0ac46dbe583db7be
|
|
| MD5 |
61501caecd330bc3bb3c3415f56c90b0
|
|
| BLAKE2b-256 |
f39324f57078f2495e5f724f8c302ceb1331beee6dc3745163adb073ff75ed77
|