PYthon RAndom SAmpling for MEshes
Project description
pyransame
PYthon RAndom SAmpling for MEshes
Utilities for choosing random samples of points within cells of PyVista meshes. This package does not choose random points that define the mesh itself, rather random points on 0D vertices, 1D lines, 2D surfaces or in 3D volumes are sampled.
All linear1 cells from vtk are supported, except for vtkConvexPointSet.
PyVista dataset accessor
On PyVista 0.48+, pip install pyransame registers a ransame
accessor on every PyVista dataset. No extra import or registration step
is required. PyVista discovers the accessor through the
pyvista.accessors entry point and loads it lazily the first time
mesh.ransame is used.
import pyvista as pv
from pyvista import examples
bunny = examples.download_bunny()
points = bunny.ransame.surface_points(500) # numpy array, shape (500, 3)
sampled = bunny.ransame.surface_dataset(500) # pyvista.PolyData with interpolated arrays
The accessor mirrors the top-level functions:
| Method | Equivalent function |
|---|---|
mesh.ransame.surface_points(n) |
pyransame.random_surface_points |
mesh.ransame.surface_dataset(n) |
pyransame.random_surface_dataset |
mesh.ransame.volume_points(n) |
pyransame.random_volume_points |
mesh.ransame.volume_dataset(n) |
pyransame.random_volume_dataset |
mesh.ransame.line_points(n) |
pyransame.random_line_points |
mesh.ransame.line_dataset(n) |
pyransame.random_line_dataset |
mesh.ransame.vertex_points(n) |
pyransame.random_vertex_points |
mesh.ransame.vertex_dataset(n) |
pyransame.random_vertex_dataset |
mesh.ransame.points(n) |
dispatch by cell dimension |
mesh.ransame.dataset(n) |
dispatch by cell dimension |
points and dataset infer the sampler from the cell dimensions on
the mesh: vertex (0D), line (1D), surface (2D), or volume (3D). Mixed
dimensions raise ValueError. Pass kind="vertex" | "line" | "surface" | "volume" to override:
sampled = mixed_mesh.ransame.dataset(500, kind="surface")
On older PyVista releases the package still installs and imports
cleanly; only the mesh.ransame namespace is unavailable. Use the
top-level pyransame.random_* functions in that case.
Random sampling on a 2D surface
Random sampling in a 3D volume
-
Linear here means not inheriting from
vtkNonLinearCell. ↩
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 pyransame-0.5.0.tar.gz.
File metadata
- Download URL: pyransame-0.5.0.tar.gz
- Upload date:
- Size: 314.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4aa73ebdc21ffadcca8ae96d17ca91e10f59b482fe68ec8d2d7977d132ab3bf
|
|
| MD5 |
c21e696bb6602db303681a9f2001a73b
|
|
| BLAKE2b-256 |
97f2bfb07b4bd7f4962e92d6da3c37f07a7fb29a7e270fe41ed7431f4b4a2564
|
Provenance
The following attestation bundles were made for pyransame-0.5.0.tar.gz:
Publisher:
python-publish.yml on MatthewFlamm/pyransame
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyransame-0.5.0.tar.gz -
Subject digest:
e4aa73ebdc21ffadcca8ae96d17ca91e10f59b482fe68ec8d2d7977d132ab3bf - Sigstore transparency entry: 1521077186
- Sigstore integration time:
-
Permalink:
MatthewFlamm/pyransame@fa708fe9529e8846663c77e1ea38449ffa7b561c -
Branch / Tag:
refs/tags/0.5.0 - Owner: https://github.com/MatthewFlamm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@fa708fe9529e8846663c77e1ea38449ffa7b561c -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyransame-0.5.0-py3-none-any.whl.
File metadata
- Download URL: pyransame-0.5.0-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a14ffb2dabc16aef03da6e9cc96b11011798da80f73a5653ccbe50cb54734583
|
|
| MD5 |
71e8df929757aade7c9d116c2daddc40
|
|
| BLAKE2b-256 |
5f8affe3da8f7632ca1e17ef98f9af1b4fb9b178c2e75f5e9d05046a62f86558
|
Provenance
The following attestation bundles were made for pyransame-0.5.0-py3-none-any.whl:
Publisher:
python-publish.yml on MatthewFlamm/pyransame
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyransame-0.5.0-py3-none-any.whl -
Subject digest:
a14ffb2dabc16aef03da6e9cc96b11011798da80f73a5653ccbe50cb54734583 - Sigstore transparency entry: 1521077208
- Sigstore integration time:
-
Permalink:
MatthewFlamm/pyransame@fa708fe9529e8846663c77e1ea38449ffa7b561c -
Branch / Tag:
refs/tags/0.5.0 - Owner: https://github.com/MatthewFlamm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@fa708fe9529e8846663c77e1ea38449ffa7b561c -
Trigger Event:
release
-
Statement type: