About pyDVC
pyDVC is a Python-based implementation of the Discrete Voronoi Chain tessellation algorithm, originally introduced by Velic, May and Moresi (2009) [1]. This algorithm will perform a bounded tessellation of 3D point-cloud centre-of-mass data on a 3D voxel grid to a desired resolution. Although the algorithm is single-threaded, pyDVC utilises the Numba Python library for speed, and is usually reasonably quick for N~= 1000-10000 particles.
pyDVC can be found on pyPI and GitHub
Dependencies
numpy
numba
python>=3.6
Installation
If you want to install pyDVC to an existing Python virtual environment, simply run pip install pyDVC to install pyDVC and its dependencies.
If you want to set up a dedicated virtual environment for pyDVC, follow the instructions below, which assume you already have Python >= 3.6 installed on some sort of UNIX system which is accessible via python3.
- Create a folder to put your new virtual environment in:
mkdir env_pyDVC - Create a virtual environment using your system Python:
python3 -m venv ./env_pyDVC
- Activate your new virtual environment:
source ./env_pyDVC/bin/activate
- Install pyDVC with pip inside your new virtual environment:
pip install pyDVC
Usage
import numpy as np
from pyDVC import tessellate
# Generate 1000 particles
n_particles = 1000
# Give each particle a random 3D position from -0.5 to 0.5 in x, y and z
positions = np.random.rand(n_particles, 3) - 0.5
# Give each particle a random radius to use as the weight
weights = np.random.rand(n_particles) * 0.05
# Define the bounds of the tessellation
bounds = np.array([
[-0.5, 0.5],
[-0.5, 0.5],
[-0.5, 0.5]
])
# Define the number of cells (grid points) along each axis
n_cells = 100
# The bounding box side length is 1 (-0.5 to 0.5), so the size of each cell is 1/n_cells
cell_length = 1/n_cells
# Call the tessellation
ownership_array = tessellate(positions, bounds, cell_length, weights)
# Print the result
print(ownership_array)
References
[1] Velic, May and Moresi (2009). A Fast Robust Algorithm for Computing Discrete Voronoi Diagrams. J Math Model Algor. 8. 343-355. http://dx.doi.org/10.1007/s10852-008-9097-6
Metadata
Release files for pyDVC 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydvc-0.0.4.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyDVC-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / pydvc-0.0.4.tar.gz
| Download URL | pydvc-0.0.4.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9560184223e62da352fd9e38e69e8da50ba464223f9a23043f0667dbdfbdc8d2
|
|
BLAKE2b-256 checksum How to use checksums |
a1937281995c6be8a07ccfdc4dbcafec28a81a5442b4c6b70fa5b4012232c898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / pyDVC-0.0.4-py3-none-any.whl
| Download URL | pyDVC-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab35bc47de3067e534119d914593ff2aedb4d7f4aa4a506d86474b137f26b9c0
|
|
BLAKE2b-256 checksum How to use checksums |
5efa0d91dca87133cd1163b1e4957db74e79035dcaccd6ddf7fbffe3e6f1450f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|