PySplashSurf
raw JSON → 0.14.1.0 verified Fri May 01 auth: no python
Python bindings for splashsurf, a high-performance surface reconstruction library for SPH (Smoothed Particle Hydrodynamics) simulations. Current version 0.14.1.0, release cadence irregular; follows the underlying C++ library.
pip install pysplashsurf Common errors
error ImportError: cannot import name 'reconstruct_surface' from 'splashsurf' ↓
cause Old version of the library (pre-0.12) where function was named differently or not exported at top level.
fix
Upgrade to latest version:
pip install --upgrade pysplashsurf. If still fails, check installed version with pip show pysplashsurf. error ValueError: Buffer dtype mismatch, expected 'float64' but got 'float32' ↓
cause Particle positions array has dtype float32 instead of float64.
fix
Convert positions to float64 before calling:
positions = positions.astype(np.float64). error Segmentation fault (core dumped) ↓
cause Non-contiguous array (e.g., transpose or slice) passed to the C++ backend.
fix
Make array contiguous:
positions = np.ascontiguousarray(positions). Warnings
breaking The Python API changed between version 0.11.x and 0.12.x: the function `reconstruct_surface` now returns a tuple `(vertices, faces)` instead of a namedtuple-like object. Old code using attribute access will break. ↓
fix Update code to unpack the tuple: `vertices, faces = reconstruct_surface(positions)`.
gotcha Input particle positions must be a contiguous numpy array of dtype float64 (double precision). Using float32 or non-contiguous arrays (e.g., slices) may cause segmentation faults or incorrect results. ↓
fix Ensure positions are `np.ascontiguousarray(positions, dtype=np.float64)`.
gotcha On macOS with Apple Silicon, the pip-installed wheel may fall back to a slow pure-Python fallback if the native binary is not available. Install from conda-forge or build from source for optimal performance. ↓
fix Use `conda install -c conda-forge pysplashsurf` or build from source following the GitHub instructions.
Imports
- reconstruct_surface wrong
import splashsurf; splashsurf.reconstruct_surfacecorrectfrom splashsurf import reconstruct_surface - compute_normals
from splashsurf import compute_normals - mesh_to_obj
from splashsurf import mesh_to_obj
Quickstart
import numpy as np
from splashsurf import reconstruct_surface
# Example: random particle positions
positions = np.random.rand(1000, 3).astype(np.float64)
# Reconstruct surface (returns vertices, faces as numpy arrays)
vertices, faces = reconstruct_surface(positions)
print(f"Surface: {len(vertices)} vertices, {len(faces)} faces")