microstructpy.seeding.Seed¶

class microstructpy.seeding.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 (from microstructpy.geometry), a phase number, a breakdown, and a position.

Parameters: seed_geometry (from microstructpy.geometry) – The geometry of the seed. phase (int) – (optional) The phase number of the seed. Defaults to 0. breakdown (list or numpy.ndarray) – (optional) The circle/sphere approximation of this grain. 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) – (optional) The coordinates of the seed. See position for more details. Defaults to the origin.
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 (int) – (optional) Material phase number of seed. Defaults to 0. breakdown (list or numpy.ndarray) – (optional) 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 (list or numpy.ndarray) – (optional) The coordinates of the seed. Default is the origin. **kwargs – Keyword arguments that define the size, shape, etc of the seed geometry. An instance of the class. Seed
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. An instance of a Seed derived class. Seed
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 matplotlib.collections.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