Py-SPHViewer is a parallel Python package designed for visualizing and exploring N-body and hydrodynamics simulations using the Smoothed Particle Hydrodynamics (SPH) scheme. The package estimates an underlying scalar field (such as the density field) traced by a finite number of particles, producing not only visually appealing images but also scientifically valuable insights.
Additionally, Py-SPHViewer allows users to explore simulated volumes through various projections.
Intensive calculations are executed in parallel using C code, which requires OpenMP. As with any Python package, it can be used interactively in a Python shell, IPython, or Jupyter Notebook.
The latest stable version of Py-SPHViewer is typically available on the Python Package Index (or PyPI for short). This is the easiest method to get Py-SPHViewer running on your system, and we encourage users to follow this approach:
pip install py-sphviewer --user
The development version is available on GitHub.
To clone, compile, and install this version, use the following commands:
git clone https://github.com/alejandrobll/py-sphviewer.git
cd py-sphviewer
python setup.py install
Py-SPHViewer is licensed under the GNU GPL v3 and was initiated by Alejandro Benitez-Llambay. This program is distributed in the hope that it will be useful, but without any warranty.
Individuals or organizations that use Py-SPHViewer are encouraged to cite the code.
If Py-SPHViewer has significantly contributed to a research project leading to a publication, please acknowledge it by citing the project and using the following DOI as a reference:
Alejandro Benitez-Llambay. (2015). py-sphviewer: Py-SPHViewer v1.0.0. Zenodo. 10.5281/zenodo.21703
You may also use the following BibTeX entry:
@misc{alejandro_benitez_llambay_2015_21703,
author = {Alejandro Benitez-Llambay},
title = {py-sphviewer: Py-SPHViewer v1.0.0},
month = jul,
year = 2015,
doi = {10.5281/zenodo.21703},
url = {http://dx.doi.org/10.5281/zenodo.21703}
}
Some scientific papers that have utilized Py-SPHViewer are listed at the end of this page.
The tutorials below will give you a good overview of what Py-SPHViewer is capable of:
If you prefer to get started with Py-SPHViewer first and explore the tutorials later, please continue reading below:
To get started with Py-SPHViewer, please check the available examples in the Tutorials section. One of the simplest examples that demonstrates the power of Py-SPHViewer is as follows:
Download this HDF5 file and run:
import h5py
from sphviewer.tools import QuickView
with h5py.File('darkmatter_box.h5py','r') as f:
pdrk = f['PartType1/Coordinates'].value
QuickView(pdrk, r='infinity')
which produces the following image:
The result is very impressive given the low-resolution of the simulated volume (only 32768 dark matter particles).
High-resolution cosmological simulations might result in extremely amusing results, such as the one shown in the next video:
Some more technical details about Py-SPHViewer can be found in the following link: