Python bindings for splashsurf, a surface reconstruction library for SPH simulations.
Project description
pySplashsurf
pySplashsurf provides Python bindings for splashsurf, an open source surface reconstruction library for particle data from SPH simulations.
Detailed information on the surface reconstruction and library itself and its API can be found on the project website (splashsurf.physics-simulation.org) or the main repository.
Installation
Requires Python version 3.10+
pip install pysplashsurf
To install pysplashsurf with meshio support (which adds some additional IO functionality), use
pip install pysplashsurf[meshio]
This will add support for the .bgeo file extension to meshio, so that particle data in the BGEOV format can be read using meshio.
Meshio is also required for the write_to_file method from the bindings to work.
The rest of the package, including the CLI, will still work even if meshio is not installed.
Usage
pySplashsurf can either be used as a library in Python scripts or as a command line tool that provides the same interface as the original Rust splashsurf CLI itself.
CLI
To use the CLI, you can use the pysplashsurf command after installing the package:
pysplashsurf --help
For example, to reconstruct a surface from particle data in a VTK file with some smoothing:
pysplashsurf reconstruct particles.vtk -r=0.025 -l=2.0 -c=0.5 -t=0.6 --mesh-smoothing-weights=on --mesh-smoothing-iters=15 --normals=on --normals-smoothing-iters=10
For more information on the CLI and its arguments, refer to the splashsurf documentation.
Library
Example to reconstruct the surface from an input file, apply some post-processing methods and write the data back to a file:
import meshio
import numpy as np
import pysplashsurf
# Load particles from mesh file
mesh = meshio.read("input.vtk")
particles = np.array(mesh.points, dtype=np.float64)
# Reconstruct the points/particles with some post-processing
mesh_with_data, reconstruction = pysplashsurf.reconstruction_pipeline(
particles,
particle_radius=0.025,
rest_density=1000.0,
smoothing_length=2.0,
cube_size=0.5,
iso_surface_threshold=0.6,
mesh_smoothing_weights=True,
mesh_smoothing_weights_normalization=13.0,
mesh_smoothing_iters=25,
normals_smoothing_iters=10,
mesh_cleanup=True,
compute_normals=True,
subdomain_grid=True,
subdomain_num_cubes_per_dim=64,
output_mesh_smoothing_weights=True
)
# Write the mesh with attributes to file using meshio
mesh_with_data.write_to_file("surface.vtk")
The reconstruction_pipeline method provides (mostly) the same arguments as the splashsurf binary CLI.
It may be necessary to specify the dtype of a function input (as done for particles in the example) so that the bindings know what data type to use internally.
The extension supports single (np.float32) and double precision floats (np.float64).
Build instructions
You can also manually build the package from the source code:
- Clone the repository
cdto thepysplashsurfdirectory- Create an environment from
python_environment.yamland activate it- It is recommended to create it in a subfolder, e.g.
conda env create --prefix ./env -f python_environment.yaml - Then activate it using
conda activate ./env
- It is recommended to create it in a subfolder, e.g.
- Now, to build the project, use maturin:
maturin develop- Maturin automatically installs the resulting binary in your python environment
- Set the release flag
-ror--releaseto build an optimized binary, however, compilation time will be slightly longer
Documentation Build
To generate the Sphinx documentation, make sure that the package is installed through, e.g., maturin, and then run make html in the pysplashsurf/pysplashsurf/docs directory.
The resulting HTML files will be in pysplashsurf/pysplashsurf/docs/build/html.
Stub File Generation
To automatically generate a stub file for the package, run cargo run --bin stub_gen --no-default-features from the root project folder (from pysplashsurf/).
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 Distributions
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 pysplashsurf-0.14.1.0.tar.gz.
File metadata
- Download URL: pysplashsurf-0.14.1.0.tar.gz
- Upload date:
- Size: 484.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8304e3c923a8b5c6b59e9d9091fb868012053d48ae9bddf907354bd70ce063ac
|
|
| MD5 |
21963b91b79e0b0c2b2a5657fe2ef497
|
|
| BLAKE2b-256 |
20c059a4a1a6a99c691f4fc6e254a73b4fa64986fb1ce66d2329fb4263f7c238
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
060f5f1e91b226ec50fe8271df0e8db2f4351b3db8349b798aa41d74d8873905
|
|
| MD5 |
7698a7333a3515d6bf3a57171ca87656
|
|
| BLAKE2b-256 |
f6cf8a6da08522f6f7f0c8d1ddd8282b450f0e83b25ac129ef54873373092bf2
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0cb601a46c2df54d7e8a4b31ac840e67bbc123d52dfe3e2bc2506314139f910
|
|
| MD5 |
0e0fc7ab50d3cf979db02e45f586be1c
|
|
| BLAKE2b-256 |
d20bdc9b881ae0c970601ad71c04b4e9ac311388c572aca51c596b33ea916c6c
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-win32.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-win32.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.10+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5adcd387f77f80bef2e3fe05e176ba83e950e7ec524f5c3ad4a9d0764de4c80c
|
|
| MD5 |
4279e2fdc2adb4a1bde4c45bc3424433
|
|
| BLAKE2b-256 |
b27150fa4018144c9a14d94075f71c677d5b6c8e7dcc5ce27ab114dbfb2130ab
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a96c2e8350b14715a9c13987ece9747cbfca30736f9d95e27edf61c5978510
|
|
| MD5 |
dc53faef9ee4aa306308315dd12ad509
|
|
| BLAKE2b-256 |
16f61870e6faadb0eae58c2ac4c03e47ecff954717d5da68de8d43e41b037c66
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0efaa134417426b2a5739794c06920e2181f8fb331752068726a7f6c73e0826f
|
|
| MD5 |
3476460e3093a0e5c2dbb1adbf483a56
|
|
| BLAKE2b-256 |
1726e4b5356840220b535fc6585028d1cb805758c26084b114153508fa382c36
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ecbe468c93d7fbc3af4a410801a2468b822f8a5406d0ce7289614003d331d64
|
|
| MD5 |
0fa19d81a4c67925b194790ab85ec36b
|
|
| BLAKE2b-256 |
4075dcaa1d59b01ea9966b3c18d9782bae2ffc3a37cd2b4e2236673ff3830339
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79b150436365258ef5c6eb88ba8bb995b481b559e55a681706d1c17077a25b13
|
|
| MD5 |
a0687d3f6d1f84bdcaa68b6c2e9ff6cb
|
|
| BLAKE2b-256 |
02821df59fe9980b34f30dae65296d4af04e5cf17cb4ecb5eb93d25cd516b1f0
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0bf294ed8eecdf499bb7821a5fb1d7cb5c79a7801e73aebadba13e50d073508
|
|
| MD5 |
1548174c0b49a8e48c2c5dc520609109
|
|
| BLAKE2b-256 |
eff13ef801ccbc42d2f6b862511587bfce8b8e974379f711bcdb2fe125288c01
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
758af61529e868be1dd8bfd57cfc8549cfda1a31caec76a0107a879511d04572
|
|
| MD5 |
125b34b32e835c42622077cc717e9d84
|
|
| BLAKE2b-256 |
ce9e9afca118186d324d68a30db82ad3a97338a9f2802ffd333c0a0c25a36c76
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6b98725ded001b20a58e189218ecd5e9b842ecd12b70d1a5468425301afa743
|
|
| MD5 |
94371fd866e357526eb1f060744e4fef
|
|
| BLAKE2b-256 |
2e82b919bf251d78d1697d46e5a5baa11a4e47b19733b8286520b8edf121880f
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-manylinux2010_i686.manylinux2014_i686.manylinux_2_12_i686.manylinux_2_17_i686.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-manylinux2010_i686.manylinux2014_i686.manylinux_2_12_i686.manylinux_2_17_i686.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.10+, manylinux: glibc 2.12+ i686, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b90a2bcb36ced23f9ef726affabd75dc374264f5ec0dc44e0dcac683a856d2a1
|
|
| MD5 |
035669372d902701cf25b654f0f04e4c
|
|
| BLAKE2b-256 |
87ce3df4bb87f4d86e3ef00308e7e8703c0204703e141ba0b80cbca2dacca228
|
File details
Details for the file pysplashsurf-0.14.1.0-cp310-abi3-macosx_14_0_arm64.whl.
File metadata
- Download URL: pysplashsurf-0.14.1.0-cp310-abi3-macosx_14_0_arm64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10+, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02b4611637ed24995fb5431b11a023def834d30decd890f28199da8d0ffce7a9
|
|
| MD5 |
c8bd50653a170ca0f47167960ac3fdf9
|
|
| BLAKE2b-256 |
61aa7ce5cad68114741af6fe24ca9eac8ccf2bdb03cac7e5ad4a3c42a26aee4a
|