Shapes.Sphere#
Shapes.Sphere.py
- class Sphere(radius, center=None)#
Bases:
object
Sphere class to represent a spherical density space.
- radius#
The radius of the sphere.
- Type:
float
- center#
The center of the sphere. If None, the center is assumed to be at the center of the grid when used in get_condition.
- Type:
tuple of float, optional
Initialize the Sphere object.
- Parameters:
radius (float) – The radius of the sphere.
center (tuple of float, optional) – The center of the sphere. If None, the center is assumed to be at the center of the grid when used in get_condition.
- get_condition(xx, yy, zz, center=None)#
Get the condition for the sphere.
- Parameters:
xx (np.ndarray) – The x-coordinates grid.
yy (np.ndarray) – The y-coordinates grid.
zz (np.ndarray) – The z-coordinates grid.
center (tuple of float, optional) – The center of the sphere. If None, the center attribute of the object is used. If the center attribute is also None, the center is assumed to be at the center of the grid.
- Returns:
A boolean array where points inside the sphere are True.
- Return type:
np.ndarray
- get_rg()#
Calculate the radius of gyration of the sphere.
- Returns:
The radius of gyration of the sphere.
- Return type:
float
- get_volume()#
Calculate the volume of the sphere.
- Returns:
The volume of the sphere.
- Return type:
float