microstructpy.geometry.sphere module¶
Sphere
This module contains the Sphere class.
-
class
microstructpy.geometry.sphere.
Sphere
(**kwargs)[source]¶ Bases:
microstructpy.geometry.n_sphere.NSphere
A 3D sphere.
This class represents a three-dimensional circle. It is defined by a center point and size parameter, which can be either radius or diameter.
Parameters: - r (float, optional) – The radius of the n-sphere.
- radius (float, optional) – The radius of the n-sphere.
- d (float, optional) – The diameter of the n-sphere.
- diameter (float, optional) – The diameter of the n-sphere.
- size (float, optional) – The size of the n-sphere.
- center (list, float, numpy.ndarray) – The coordinates of the center.
- position (list, float, numpy.ndarray) – The coordinates of the center.
-
plot
(**kwargs)[source]¶ Plot the sphere.
This function uses the Axes3D.plot_surface method to add the sphere to the current axes. The keyword arguments are passed through to plot_surface.
Parameters: **kwargs (dict) – Keyword arguments for plot_surface.
-
classmethod
volume_expectation
(**kwargs)[source]¶ Expected value of volume.
This function computes the expected value for the volume of a sphere. The keyword arguments are identical to the __init__ function. The values for these keywords can be either constants or scip.stats distributions.
The expected value is computed by the following formula:
\[\begin{split}\begin{align} \mathbb{E}[V] &= \mathbb{E}[\frac{4}{3}\pi R^3] \\ &= \frac{4}{3}\pi \mathbb{E}[R^3] \\ &= \frac{4}{3}\pi (\mu_R^3 + 3 \mu_R \sigma_R^2 + \gamma_{1, R} \sigma_R^3) \end{align}\end{split}\]Parameters: **kwargs – Keyword arguments, see microstructpy.geometry.Sphere
.Returns: Expected value of the volume of the sphere. Return type: float
-
n_dim
¶ number of dimensions, 3
Type: int
-
volume
¶ volume of sphere
Type: float