
Py-SPHViewer 2 is a high-performance Python package for the rapid visualization of Smoothed Particle Hydrodynamics (SPH) data.
Built on a completely rewritten C++ backend powered by the Smooth Mesh Library (SMESHL), version 2.0 uses a novel Sparse Multi-Scale Grid algorithm (as described in Benitez-Llambay 2025) to place particles on a grid using an Adaptive Mesh Refinement (AMR) approach. This architecture allows Py-SPHViewer 2 to be orders of magnitude faster than its predecessor, while achieving consistent results, mitigating aliasing, and enabling the generation of very high-resolution images of entire cosmological volumes in seconds. For very large simulations, the bottleneck are now the particles, not the rendering process!
Get started by watching this short tutorial:
Further tutorials and documentation are provided in the GitHub repository’s documentation, and in the form of Jupyter Notebooks. Check this out:
Py-SPHViewer 2 is now distributed as a standard Python package. We provide pre-compiled wheels for Linux, Windows, and macOS (both Intel and Apple Silicon), meaning you no longer need to manually compile it by hand.
Simply run the following command in your terminal:
pip install py-sphviewer2
The development version is available on GitHub.
To clone, compile, and install manually, use the following commands:
git clone https://github.com/alejandrobll/py-sphviewer2.git
cd py-sphviewer2
pip install -e .
The core algorithm is designed to handle the massive data scales of upcoming flagship simulations. If you are working with extremely large datasets (billions of particles) or require custom features for specific simulation codes, please feel free to contact me.