open_viewmin.filter_tree_plot.filters.glyphs#

Utilities for creating and analyzing glyphs

Functions#

add_glyphs_to_mesh(plotter, actor_name[, mesh_name, ...])

Create a filter formula to sample an existing mesh, then create a

add_tensor_ellipsoids(plotter, ellipsoid_mesh_name, ...)

Add ellipsoid glyphs visualizing a symmetric tensor array's

calculate_tangent(dims, mesh[, weights, threshold, ...])

Calculate tangent at each point in a mesh, assuming the mesh

make_geometric_objects_dict(settings_dict)

Create a dictionary of glyph shapes.

Module Contents#

add_glyphs_to_mesh(plotter, actor_name, mesh_name=None, glyph_shape=None, glyph_stride=None, glyph_kwargs=None, orient=None, scale=None, factor=None, random=True, **mesh_kwargs)#

Create a filter formula to sample an existing mesh, then create a filter formula to add glyphs to the sampled mesh.

Parameters:
  • plotter (FilterTreePlot)

  • actor_name (str) – name of child (glyphs) actor

  • mesh_name (str, optional) – name of existing parent mesh

  • glyph_shape (str, None, or PyVista named geometric object) – Shape of each glyph. If a string is passed, it must be the name of a PyVista named geometric object; see https://docs.pyvista.org/api/utilities/geometric.html. Pass None to default to plotter setting.

  • glyph_stride (int or None, optional) – Spacing between sampled points where glyphs will be placed. For random sampling, the number of sampled points is the total number of points divided by glyph_stride. Pass None to default to plotter setting.

  • glyph_kwargs (dict or None, optional) – Keyword arguments accepted by PyVista glyph filter. Pass None to default to plotter setting.

  • orient (str or None) – Name of vector dataset belonging to parent mesh to use as glyph orientations. Pass None to omit orientation information.

  • scale (str or None) – Name of scalar dataset belonging to parent mesh to use for glyph size scale. Pass None to omit scale information.

  • factor (float or None) – Global size rescaling factor for glyphs. Pass None to default to the value of glyph_stride.

  • random (bool) – Whether sampling for glyph locations should be random or evenly spaced.

  • **mesh_kwargs (dict, optional) – Keyword arguments accepted by plotter.add_mesh

Returns:

  • pyvista.dataset – Created mesh

add_tensor_ellipsoids(plotter, ellipsoid_mesh_name, tensor_field_name, parent_mesh_name, stride=None, ellipsoid_kwargs=None, scale=None, factor=None, random=True, eigenvalue_shift=1.0, **mesh_kwargs)#

Add ellipsoid glyphs visualizing a symmetric tensor array’s eigenvectors and eigenvalues.

Parameters:
  • plotter (FilterTreePlot)

  • ellipsoid_mesh_name (str) – Name of new mesh

  • tensor_field_name (str) – Name of tensor array

  • parent_mesh_name (str) – Name of parent mesh

  • stride (int or None, optional) – Spacing between ellipsoids

  • ellipsoid_kwargs (dict or None, optional) – Filter kwargs: keyword arguments to pyvista.parametric_objects.ParametricEllipsoid()

  • scale (numpy.ndarray of floats or None, optional) – Scalar array for ellipsoid size

  • factor (float or None, optional) – Global size scale factor

  • random (bool) – Whether glyphs will be placed at a random (as opposed to regularly spaced) subset of points

  • eigenvalue_shift (float, optional) – Value added to all eigenvalues before conversion to ellipsoid axes lengths

  • **mesh_kwargs (dict, optional) – Keyword arguments accepted by plotter.add_mesh

Returns:

Created mesh

Return type:

pyvista.DataSet

calculate_tangent(dims, mesh, weights=None, threshold=None, sigma=4, field_name='tangent')#

Calculate tangent at each point in a mesh, assuming the mesh approximates a curve or is parent to an isosurface tube contouring a value related to “weights”. Beware: Will show nonsense for regions excluded by threshold, since calculation is omitted there.

Parameters:
  • dims ((int, int, int)) – system dimensions

  • mesh (pyvista.dataset) – PyVista mesh

  • weights (numpy.ndarray or None, optional) – Tangent is calculated where weights is not less than threshold

  • threshold (float or None, optional) – Threshold value for weights. Pass None to include all points.

  • sigma (float, optional) – Falloff distance for a Gaussian weighting function of distance by which each point weighs the direction to each other point.

  • field_name (str or None, optional) – Name of tangents dataset added to mesh, unless None is passed.

Returns:

Array of tangent vectors

Return type:

numpy.ndarray

make_geometric_objects_dict(settings_dict)#

Create a dictionary of glyph shapes.

Parameters:

settings_dict (dict) – plotter settings

Returns:

Dictionary of glyph shapes

Return type:

dict