pyvista.pyvista_ndarray

Contents

pyvista.pyvista_ndarray#

class pyvista_ndarray(
array: ArrayLike[float] | _vtk.vtkAbstractArray,
dataset: DataSet | _vtk.vtkDataSet | _vtk.VTKObjectWrapper | None = None,
association: FieldAssociation = FieldAssociation.NONE,
)#

A ndarray which references the owning dataset and the underlying vtkArray.

This array can be acted upon just like a numpy.ndarray.

Parameters:
arrayArrayLike or vtk.vtkAbstractArray

Array like.

datasetpyvista.DataSet

Input dataset.

associationpyvista.core.utilities.arrays.FieldAssociation

Field association.

Examples

Return the points of a Sphere as a pyvista.pyvista_ndarray.

>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> mesh.points  
pyvista_ndarray([[-5.5511151e-17,  0.0000000e+00, -5.0000000e-01],
                 [ 5.5511151e-17,  0.0000000e+00,  5.0000000e-01],
                 [-5.4059509e-02,  0.0000000e+00, -4.9706897e-01],
                 ...,
                 [-1.5616201e-01, -3.3193260e-02,  4.7382659e-01],
                 [-1.0513641e-01, -2.2347433e-02,  4.8831028e-01],
                 [-5.2878179e-02, -1.1239604e-02,  4.9706897e-01]],
                dtype=float32)

Methods

Attributes