Python package for building isosurfaces from 3D scalar fields
Project description
PyTessel
Purpose
Python package for building isosurfaces from 3D scalar fields
Installation
Anaconda
conda install -c ifilot pyqint
PyPi
pip install pytessel
Usage
from pytessel import PyTessel
import numpy as np
def main():
pytessel = PyTessel()
# generate some data
x = np.linspace(0, 10, 50)
# the grid is organized with z the slowest moving index and x the fastest moving index
grid = np.flipud(np.vstack(np.meshgrid(x, x, x, indexing='ij')).reshape(3,-1)).T
R = [5,5,5]
scalarfield = np.reshape(np.array([gaussian(r,R) for r in grid]), (len(x),len(x),len(x)))
unitcell = np.diag(np.ones(3) * 10.0)
vertices, normals, indices = pytessel.marching_cubes(scalarfield.flatten(), scalarfield.shape, unitcell.flatten(), 0.1)
pytessel.write_ply('test.ply', vertices, normals, indices)
def gaussian(r, R):
return np.exp(-(r-R).dot((r-R)))
if __name__ == '__main__':
main()
The isosurface is written to test.ply
and can, for example, be opened using ctmviewer
.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for pytessel-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29147b7590a483958404877be81973c265bc2aa6188c6245be5333b688568568 |
|
MD5 | f51e493b1c212777d18bd499fe413301 |
|
BLAKE2b-256 | a5b402a048c54b1deca3b4f08025cc9d12e58d57176886c2cfff8e65af0cd037 |
Close
Hashes for pytessel-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffc5d33b710f9304015148b0d23b5dd2012438299934b088ab48f77c7a205466 |
|
MD5 | 40d9d64a218cbc8a2bbae94aeb927ca6 |
|
BLAKE2b-256 | 9363da0e355bb34a2306125589ff26698488368c8aabc76d33b48e8f3370d940 |
Close
Hashes for pytessel-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97f261cb832e814c38f84b020a8c7ac404945983aabfc791647cbd31676a566e |
|
MD5 | 22dd47dc322404790095588003c4859e |
|
BLAKE2b-256 | 2a25c9f82a0548f71b2b584699e7f7fe3a3abf79ceee65f2e26e24f92d52a5c6 |
Close
Hashes for pytessel-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a8ac79ecc75e45f52fa1f2eba3df6041236d845a2a58cb95359c1debed1b9b9 |
|
MD5 | ef18a452094765a62bf9df0b5d2211b0 |
|
BLAKE2b-256 | c7bf33183d9d9acdaa2b693731b59b1871dab56620a8f5ea2958ffdfdfba5724 |
Close
Hashes for pytessel-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9c6c12606a96454820d50cc317b1bfc3e21c4d1ae677c1b4b740155d39dd15d |
|
MD5 | d211f76e7837b8211792c85249d1e24f |
|
BLAKE2b-256 | 7402e2ed8d3c1adfc3807991d5472ca07d719c69646c3f24cede78520905a375 |