nanomesh.metrics๏
Module to compute cell quality metrics.
Classes:
|
Factory function for metrics using |
Functions:
|
Calculate all available metrics. |
|
Create a mesh plot with the cells are colored by the cell quality. |
|
Calculate the ratio between the longest and shortest edge lengths of a triangle. |
|
Create a mesh plot with the cells are colored by the cell quality. |
- class nanomesh.metrics.Metric(metric: str)[source]
Bases:
object
Factory function for metrics using
pyvista
.- Parameters
metric (str) โ Metric to calculate. For a full list, see
pyvista.DataSet.compute_cell_quality()
.
- nanomesh.metrics.calculate_all_metrics(mesh: Mesh, inplace: bool = False) dict [source]
Calculate all available metrics.
- nanomesh.metrics.histogram(mesh: Mesh, *, metric: str, ax: Optional[Axes] = None, **kwargs) Axes [source]
Create a mesh plot with the cells are colored by the cell quality.
- Parameters
mesh (Mesh) โ Input mesh
metric (str) โ Metric to calculate.
ax (matplotlib.axes.Axes) โ If specified, ax will be used to create the subplot.
vmin (int, float) โ Set the lower/upper boundary for the color value.
vmax (int, float) โ Set the lower/upper boundary for the color value.
cmap (str) โ Set the color map.
**kwargs โ Keyword arguments passed on to
matplotlib.pyplot.hist()
.
- Returns
ax
- Return type
- nanomesh.metrics.max_min_edge_ratio(mesh: Mesh) ndarray [source]
Calculate the ratio between the longest and shortest edge lengths of a triangle.
- Parameters
mesh (Mesh) โ Input mesh
- Returns
quality โ Array with cell qualities.
- Return type
- nanomesh.metrics.plot2d(mesh: Mesh, *, metric: str, ax: Optional[Axes] = None, **kwargs) Axes [source]
Create a mesh plot with the cells are colored by the cell quality.
- Parameters
mesh (Mesh) โ Input mesh
metric (str) โ Metric to calculate.
ax (matplotlib.axes.Axes) โ If specified, ax will be used to create the subplot.
vmin (int, float) โ Set the lower/upper boundary for the color value. Defaults to the 1st and 99th percentile, respectively.
vmax (int, float) โ Set the lower/upper boundary for the color value. Defaults to the 1st and 99th percentile, respectively.
cmap (str) โ Set the color map.
**kwargs โ Keyword arguments passed on to
matplotlib.pyplot.tripcolor()
.
- Returns
ax
- Return type