API Documentation#
|
Generate random points on surface. |
|
Generate random points on surface with sampled data. |
|
Generate random points in a volume. |
|
Generate random points in a volume with sampled data. |
|
Generate random points on lines. |
|
Generate random points on lines with sampled data. |
|
Generate random points from vertices. |
|
Generate random points on vertices with sampled data. |
PyVista dataset accessor#
Registered automatically on PyVista >= 0.48 via the
pyvista.accessors entry point.
- class pyransame.accessor.RansameAccessor(mesh: DataSet)#
Accessor exposing
pyransamesampling routines on a dataset.Available as
dataset.ransameoncepyransameis imported on PyVista >= 0.48. Each method forwards to the corresponding top-levelrandom_*function inpyransame.Methods
dataset([n, weights, kind])Random sampled
pyvista.PolyData, dispatched by cell dimension.line_dataset([n, weights])Random sampled
pyvista.PolyDataon line cells.line_points([n, weights])Random points on 1D line cells.
points([n, weights, kind])Random points, dispatched by cell dimension.
surface_dataset([n, weights])Random sampled
pyvista.PolyDataon surface cells.surface_points([n, weights])Random points on 2D surface cells.
vertex_dataset([n, weights])Random sampled
pyvista.PolyDatafrom vertex cells.vertex_points([n, weights])Random points sampled from 0D vertex cells.
volume_dataset([n, weights])Random sampled
pyvista.PolyDatain volume cells.volume_points([n, weights])Random points in 3D volume cells.
- dataset(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None, *, kind: Literal['vertex', 'line', 'surface', 'volume'] | None = None) PolyData#
Random sampled
pyvista.PolyData, dispatched by cell dimension.Inspects the mesh’s distinct cell types and forwards to the matching
random_*_datasetfunction. Passkindexplicitly to override the inferred dimension on mixed-dimension meshes.- Parameters:
- nint, default: 1
Number of random points to generate.
- weightsstr or array_like, optional
Per-cell sampling weights, forwarded to the underlying
random_*_datasetroutine.- kind{“vertex”, “line”, “surface”, “volume”}, optional
Force a specific sampler. When
None(the default), the kind is inferred from the cell dimensions present on the mesh and aValueErroris raised if more than one dimension is found.
- Returns:
- pyvista.PolyData
Sampled mesh with point data interpolated from the input.
Examples
>>> import pyransame # noqa: F401 (registers ``ransame``) >>> import pyvista as pv >>> sampled = pv.Plane().ransame.dataset(5) >>> sampled.n_points 5
- line_dataset(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) PolyData#
Random sampled
pyvista.PolyDataon line cells.Forwards to
pyransame.random_line_dataset(), which returns apyvista.PolyDatawith point data interpolated from the input mesh.
- line_points(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) ndarray#
Random points on 1D line cells.
Forwards to
pyransame.random_line_points(). See that function for the full parameter description and supported cell types.
- points(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None, *, kind: Literal['vertex', 'line', 'surface', 'volume'] | None = None) ndarray#
Random points, dispatched by cell dimension.
Inspects the mesh’s distinct cell types and forwards to the matching
random_*_pointsfunction. Passkindexplicitly to override the inferred dimension on mixed-dimension meshes.- Parameters:
- nint, default: 1
Number of random points to generate.
- weightsstr or array_like, optional
Per-cell sampling weights, forwarded to the underlying
random_*_pointsroutine.- kind{“vertex”, “line”, “surface”, “volume”}, optional
Force a specific sampler. When
None(the default), the kind is inferred from the cell dimensions present on the mesh and aValueErroris raised if more than one dimension is found.
- Returns:
- numpy.ndarray
(n, 3)array of sampled points.
Examples
>>> import pyransame # noqa: F401 (registers ``ransame``) >>> import pyvista as pv >>> pts = pv.Plane().ransame.points(5) >>> pts.shape (5, 3)
- surface_dataset(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) PolyData#
Random sampled
pyvista.PolyDataon surface cells.Forwards to
pyransame.random_surface_dataset(), which returns apyvista.PolyDatawith point data interpolated from the input mesh.
- surface_points(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) ndarray#
Random points on 2D surface cells.
Forwards to
pyransame.random_surface_points(). See that function for the full parameter description and supported cell types.
- vertex_dataset(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) PolyData#
Random sampled
pyvista.PolyDatafrom vertex cells.Forwards to
pyransame.random_vertex_dataset(), which returns apyvista.PolyDatawith point data interpolated from the input mesh.
- vertex_points(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) ndarray#
Random points sampled from 0D vertex cells.
Forwards to
pyransame.random_vertex_points(). See that function for the full parameter description and supported cell types.
- volume_dataset(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) PolyData#
Random sampled
pyvista.PolyDatain volume cells.Forwards to
pyransame.random_volume_dataset(), which returns apyvista.PolyDatawith point data interpolated from the input mesh.
- volume_points(n: int = 1, weights: str | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | _NestedSequence[complex | bytes | str] | None = None) ndarray#
Random points in 3D volume cells.
Forwards to
pyransame.random_volume_points(). See that function for the full parameter description and supported cell types.