microstructpy.seeding.seed module¶
Seed
This module contains the class definition for the Seed class.
-
class
microstructpy.seeding.seed.
Seed
(seed_geometry, phase=0, breakdown=None, position=None)[source]¶ Bases:
object
Seed particle
The Seed class contains the information about a single seed in the mesh. These seeds have a geometry (
microstructpy.geometry
), phase number, breakdown, and position.Parameters: - seed_geometry (from
microstructpy.geometry
) – The geometry of the seed. - phase (int) – The phase number of the seed.
- breakdown (list or numpy.ndarray) –
The circle/sphere approximation of this geometry. The format for this input is:
# x y r breakdown_2D = [( 2, 3, 1), ( 0, 0, 4), (-2, 4, 8)] # x y z r breakdown_3D = [( 3, -1, 2, 1), ( 0, 2, -1, 1)]
The default behavior is to call the
approximate()
function of the geometry. - position (list or numpy.ndarray) – The coordinates of the seed.
See
position
for more details.
-
classmethod
factory
(seed_type, phase=0, breakdown=None, position=None, **kwargs)[source]¶ Factory method for seeds
This function returns a seed based on the seed type and keyword arguments associated with that type. The currently supported types are:
- circle
- ellipse
- ellipsoid
- rectangle
- sphere
- square
If the seed_type is not on this list, an error is thrown.
Parameters: - seed_type (str) – type of seed, from list above.
- phase (optional, int) – Material phase number of seed.
- breakdown (optional, list) –
List of circles or spheres that approximate the geometry. The list should be formatted as follows:
breakdown = [(x1, y1, z1, r1), (x2, y2, z2, r2), ...]
The breakdown will be automatically generated if not provided.
- position (optional, list) – The coordinates of the seed. Default is the origin.
- **kwargs – Keyword arguments that define the size, shape, etc of the seed geometry.
Returns: An instance of the class.
Return type:
-
classmethod
from_str
(seed_str)[source]¶ Create seed from a string.
This method creates a seed particle from a string representation. This is used when reading in seeds from a file.
Parameters: seed_str (str) – String representation of the seed. Returns: An instance of a Seed derived class.
-
plot
(**kwargs)[source]¶ Plot the seed
This function plots the geometry of the seed. The keyword arguments are passed through to matplotlib. See the plot methods in
microstructpy.geometry
for more details.Parameters: **kwargs – Plotting keyword arguments.
-
plot_breakdown
(**kwargs)[source]¶ Plot breakdown of seed
This function plots the circle/sphere breakdown of the seed. In 2D, this adds a PatchCollection to the current axes.
Parameters: **kwargs – Matplotlib keyword arguments.
-
limits
¶ The (lower, upper) bounds of the seed
Type: list
-
position
¶ Position of the seed
This is the location of the seed center.
Note
If the breakdown of the seed has been populated, the setter function will update the position of the center and translate the breakdown circles/spheres.
-
volume
¶ The area (2D) or volume (3D) of the seed
Type: float
- seed_geometry (from