elasticipy.crystal_texture
- class elasticipy.crystal_texture.CompositeTexture(texture_list)[source]
Bases:
objectCreate a mix of crystal textures
- Parameters:
texture_list (list of CrystalTexture) – List of crystal textures to mix
- mean_tensor(tensor)[source]
Compute the weighted average of a tensor, considering each texture component separately.
- Parameters:
tensor (FourthOrderTensor) – Reference tensor (unrotated)
- Return type:
Examples
Let consider a mixture of Goss and fibre tensor (with phi1=0 and phi2=0):
>>> from elasticipy.crystal_texture import DiscreteTexture, FibreTexture >>> from elasticipy.tensors.elasticity import StiffnessTensor >>> t = DiscreteTexture.Goss() + FibreTexture.from_Euler(phi1=0.0, phi2=0.0) >>> t Mixture of crystallographic textures Wgt. Type Component ------------------------------------------------------------ 1.00 discrete φ1=0.00°, ϕ=45.00°, φ2=0.00° 1.00 fibre φ1= 0.0°, φ2= 0.0°
Then, assume that the stiffness tensor is defined as follows:
>>> C = StiffnessTensor.cubic(C11=186, C12=134, C44=77) # mp-30
The ODF-weighted Voigt average can be computed as follows:
>>> Cvoigt = t.mean_tensor(C) >>> Cvoigt Stiffness tensor (in Voigt mapping): [[186. 134. 134. 0. 0. 0. ] [134. 224.25 95.75 0. 0. 0. ] [134. 95.75 224.25 -0. 0. 0. ] [ 0. 0. 0. 25.88 0. 0. ] [ 0. 0. 0. 0. 57.75 -0. ] [ 0. 0. 0. 0. 0. 57.75]]
Alternatively, on can directly use the following syntax:
>>> Cvoigt = C * t
- plot_as_pole_figure(uvw=None, hkl=None, UVTW=None, hkil=None, fig=None, symmetrise=False, projection='lambert', labels=None, **kwargs)[source]
Plot the pole figure of the composite texture, given a set of Miller indices
- Parameters:
miller (orix.vector.miller.Miller) – Miller indices of directions/planes to plot
projection (str, optional) – Type of projection to use, it can be either stereographic or Lambert
fig (matplotlib.figure.Figure, optional) – Handle to existing figure, if needed
symmetrise (bool) – Whether the symmetrise the miller indices
labels (list of str or tuple of str, optional) – List of labels to use in the legend for each texture component. If not provided, they are automatically inferred from each texture component.
kwargs – Keyword arguments to pass to matplotlib’s scatter/plot functions
- Returns:
matplotlib.figure.Figure – Handle to figure
matplotlib.projections.polar.PolarAxes – Axes where the pole figure is plotted
Examples
Create a mixture of gamma and alpha fibre texture, and plot the corresponding [1,0,0] pole figure:
from elasticipy.crystal_texture import FibreTexture from orix.vector import Miller from orix.crystal_map import Phase texture = FibreTexture.alpha() + FibreTexture.gamma() texture.plot_as_pole_figure(uvw=[1,1,0], symmetrise=True)
- sample(num=50, seed=None)[source]
Generate a random sample of orientations from the composite texture.
- Parameters:
num (int, optional) – Number of orientations to generate
seed (int, optional) – Seed for random number generator
- Returns:
Random orientations from the given texture
- Return type:
orix.quaternion.Orientation
Examples
Create a balanced mixture of Goss and Brass texture:
>>> from elasticipy.crystal_texture import DiscreteTexture >>> goss = DiscreteTexture.Goss() >>> brass = DiscreteTexture.brass() >>> texture = goss + brass >>> print(texture) Mixture of crystallographic textures Wgt. Type Component ------------------------------------------------------------ 1.00 discrete φ1=0.00°, ϕ=45.00°, φ2=0.00° 1.00 discrete φ1=35.26°, ϕ=45.00°, φ2=0.00°
Now generate a set of 1000 orientations from this texture:
>>> o = texture.sample(num=1000, seed=123) # Use seed to ensure reproducibility
One can check that around 50% of these orientations correspond to that of Goss:
>>> import numpy as np >>> np.count_nonzero((o * ~goss.orientation).angle == 0.) 530
whereas all the other orientations correspond to brass:
>>> np.count_nonzero((o * ~brass.orientation).angle == 0.) 470
- class elasticipy.crystal_texture.CrystalTexture(phase=None)[source]
Bases:
ABC- mean_tensor(tensor)[source]
Perform the texture-weighted mean of a 4th-order tensor.
- Parameters:
tensor (SymmetricFourthOrderTensor) – Reference tensor (unrotated)
- Returns:
mean value of the rotated tensor
- Return type:
- plot_as_pole_figure(uvw=None, hkl=None, UVTW=None, hkil=None, symmetrise=False, projection='lambert', fig=None, ax=None, **kwargs)[source]
Plot the pole figure of the crystallographic texture
- Parameters:
uvw (list) – Miller indices of directions to plot
hkl (list) – Miller indices of plane normal to plot
UVTW (list) – Miller-Bravais indices of directions to plot
hkil (list) – Miller-Bravais indices of plane normal to plot
symmetrise (bool, optional) – Symmetrise the direction/plane to plot the family
projection (str, optional) – Type of projection to use, it can be either stereographic or Lambert
fig (matplotlib.figure.Figure, optional) – Handle to existing figure, if needed
ax (matplotlib.projections.polar.PolarAxes, optional) – Axes to plot on
kwargs – Keyword arguments to pass to matplotlib’s scatter/plot functions
- Returns:
matplotlib.figure.Figure – Handle to figure
matplotlib.projections.polar.PolarAxes – Axes where the pole figure is plotted
Examples
Plot the <100> pole figure of Goss texture:
from elasticipy.crystal_texture import DiscreteTexture goss = DiscreteTexture.Goss() goss.plot_as_pole_figure(uvw=[1,0,0], symmetrise=True)
Plot the <110> pole figure of the gamma fibre texture:
from elasticipy.crystal_texture import FibreTexture gamma = FibreTexture.gamma() gamma.plot_as_pole_figure(uvw=[1,1,0], symmetrise=True)
- sample(num=50, seed=None)[source]
Generate a random sample from the texture component
- Parameters:
num (int, optional) – Number of random orientations to generate. Default is 50.
seed (int, optional) – Seed to use for generating random numbers. Default is None.
- Returns:
Random orientations from the given texture
- Return type:
orix.quaternion.Orientation
Examples
Generate 50 orientations from uniform distribution:
>>> from elasticipy.crystal_texture import UniformTexture >>> o = UniformTexture().sample()
Generate 10 orientations from gamma-fibre
>>> from elasticipy.crystal_texture import FibreTexture >>> o = FibreTexture.gamma().sample(num=10)
- class elasticipy.crystal_texture.DiscreteTexture(orientation, phase=None)[source]
Bases:
CrystalTextureClass to handle classical crystallographic texture.
Notes
This class implements the crystallographic textures listed by [Lohmuller]
References
[Lohmuller]Lohmuller, P.; Peltier, L.; Hazotte, A.; Zollinger, J.; Laheurte, P.; Fleury, E. Variations of the Elastic Properties of the CoCrFeMnNi High Entropy Alloy Deformed by Groove Cold Rolling. Materials 2018, 11, 1337. https://doi.org/10.3390/ma11081337
Create a single-orientation crystallographic texture.
- Parameters:
orientation (orix.quaternion.orientation.Orientation) – Orientation of the crystals
phase (orix.crystal_map.phase_list.Phase) – Phase of the crystal
- classmethod A(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create an “A” crystallographic texture: {110}<111>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
- classmethod CuT(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a CuT crystallographic texture: {552}<115>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
- classmethod Goss(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a Goss crystallographic texture: {110}<100>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
See also
ACreate an A single-orientation crystallographic texture
brassCreate a Brass single-orientation crystallographic texture
copperCreate a Copper single-orientation crystallographic texture
cubeCreate a Cube single-orientation crystallographic texture
CuTCreate a CuT single-orientation crystallographic texture
GossBrassCreate a Goss-Brass single-orientation crystallographic texture
PCreate a P single-orientation crystallographic texture
SCreate an S single-orientation crystallographic texture
- classmethod GossBrass(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a Goss/Brass crystallographic texture: {110}<115>
- Return type:
- classmethod P(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a “P”” crystallographic texture: {011}<211>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
- classmethod S(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create an “S” crystallographic texture: {123}<634>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
- classmethod brass(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a Brass crystallographic texture: {110}<112>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
- classmethod copper(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a copper crystallographic texture: {112}<111>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
- classmethod cube(phase=<name: . space group: None. point group: m-3m. proper point group: 432. color: tab:blue>)[source]
Create a Cube crystallographic texture: {100}<100>
- Parameters:
phase (Phase, optional) – Structure of the crystal. By default, cubic (point group: m-3m) is used.
- Return type:
See also
ACreate a A single-orientation crystallographic texture
brassCreate a Brass single-orientation crystallographic texture
copperCreate a Copper single-orientation crystallographic texture
CuTCreate a CuT single-orientation crystallographic texture
GossCreate a Goss single-orientation crystallographic texture
GossBrassCreate a Goss-Brass single-orientation crystallographic texture
PCreate a P single-orientation crystallographic texture
SCreate an S single-orientation crystallographic texture
- mean_tensor(tensor)[source]
Perform the texture-weighted mean of a 4th-order tensor.
- Parameters:
tensor (SymmetricFourthOrderTensor) – Reference tensor (unrotated)
- Returns:
mean value of the rotated tensor
- Return type:
- plot_as_pole_figure(uvw=None, hkl=None, UVTW=None, hkil=None, symmetrise=False, projection='lambert', fig=None, ax=None, **kwargs)[source]
Plot the pole figure of the crystallographic texture
- Parameters:
uvw (list) – Miller indices of directions to plot
hkl (list) – Miller indices of plane normal to plot
UVTW (list) – Miller-Bravais indices of directions to plot
hkil (list) – Miller-Bravais indices of plane normal to plot
symmetrise (bool, optional) – Symmetrise the direction/plane to plot the family
projection (str, optional) – Type of projection to use, it can be either stereographic or Lambert
fig (matplotlib.figure.Figure, optional) – Handle to existing figure, if needed
ax (matplotlib.projections.polar.PolarAxes, optional) – Axes to plot on
kwargs – Keyword arguments to pass to matplotlib’s scatter/plot functions
- Returns:
matplotlib.figure.Figure – Handle to figure
matplotlib.projections.polar.PolarAxes – Axes where the pole figure is plotted
Examples
Plot the <100> pole figure of Goss texture:
from elasticipy.crystal_texture import DiscreteTexture goss = DiscreteTexture.Goss() goss.plot_as_pole_figure(uvw=[1,0,0], symmetrise=True)
Plot the <110> pole figure of the gamma fibre texture:
from elasticipy.crystal_texture import FibreTexture gamma = FibreTexture.gamma() gamma.plot_as_pole_figure(uvw=[1,1,0], symmetrise=True)
- sample(num=50, seed=None)[source]
Generate a random sample from the texture component
- Parameters:
num (int, optional) – Number of random orientations to generate. Default is 50.
seed (int, optional) – Seed to use for generating random numbers. Default is None.
- Returns:
Random orientations from the given texture
- Return type:
orix.quaternion.Orientation
Examples
Generate 50 orientations from uniform distribution:
>>> from elasticipy.crystal_texture import UniformTexture >>> o = UniformTexture().sample()
Generate 10 orientations from gamma-fibre
>>> from elasticipy.crystal_texture import FibreTexture >>> o = FibreTexture.gamma().sample(num=10)
- class elasticipy.crystal_texture.FibreTexture(orientation, axis, phase=None)[source]
Bases:
CrystalTextureCreate a fibre-type crystallographic texture
- Parameters:
orientation (orix.quaternion.orientation.Orientation) – Reference orientation
axis (list or tuple or numpy.ndarray or orix.vector.Vector3D) – Axis of rotation (in sample CS)
point_group (orix.phase.point_group.PointGroup, optional) – Point group to use
- classmethod from_Euler(phi1=None, Phi=None, phi2=None, degrees=True, phase=None)[source]
Create a fibre texture by providing two fixed Bunge-Euler values
- Parameters:
phi1 (float) – First Euler angle
Phi (float) – Second Euler angle
phi2 (float) – Third Euler angle
degrees (boolean, optional) – If true (default), the angles must be passed in degrees (in radians otherwise)
- Return type:
See also
from_Miller_axisDefine a fibre texture by aligning a miller direction with a given axis
Examples
A fibre texture corresponding to constant (e.g. zero) values for phi1 and phi2, and uniform distribution of Phi on [0,2π[, can be defined as follows:
>>> from elasticipy.crystal_texture import FibreTexture >>> t1 = FibreTexture.from_Euler(phi1=0., phi2=0.) >>> t1 Fibre texture φ1= 0.0°, φ2= 0.0°
Similarly, the following returns a fibre texture for phi1=0 and Phi=0, and uniform distribution of phi2 on [0,2π[:
>>> t2 = FibreTexture.from_Euler(phi1=0., Phi=0.) >>> t2 Fibre texture φ1= 0.0°, ϕ= 0.0°
- classmethod from_Miller_axis(miller, axis)[source]
Create a perfect fibre crystallographic texture
- Parameters:
miller (orix.vector.miller.Miller) – Crystal plane or direction to align with the axis
axis (tuple or list) – Axis (in sample CS) to align with
- Return type:
See also
from_Eulerdefine a fibre texture from two Euler angles
Examples
Let’s consider a cubic poly-crystal (point group: m-3m), whose orientations are defined by a perfect alignment of direction <100> with the Z axis of a sample (therefore a uniform distribution around the Z axis). This texture can be defined as:
>>> from orix.crystal_map import Phase >>> from orix.vector.miller import Miller >>> from elasticipy.crystal_texture import FibreTexture >>> phase = Phase(point_group='m-3m') >>> m = Miller(uvw=[1,0,0], phase=phase) >>> t = FibreTexture.from_Miller_axis(m, [0,0,1]) >>> t Fibre texture <1. 0. 0.> || [0, 0, 1]
- mean_tensor(tensor)[source]
Perform the texture-weighted mean of a 4th-order tensor.
- Parameters:
tensor (SymmetricFourthOrderTensor) – Reference tensor (unrotated)
- Returns:
mean value of the rotated tensor
- Return type:
- plot_as_pole_figure(uvw=None, hkl=None, UVTW=None, hkil=None, projection='lambert', fig=None, ax=None, n_orientations=100, symmetrise=False, **kwargs)[source]
Plot the pole figure of the crystallographic texture
- Parameters:
uvw (list) – Miller indices of directions to plot
hkl (list) – Miller indices of plane normal to plot
UVTW (list) – Miller-Bravais indices of directions to plot
hkil (list) – Miller-Bravais indices of plane normal to plot
symmetrise (bool, optional) – Symmetrise the direction/plane to plot the family
projection (str, optional) – Type of projection to use, it can be either stereographic or Lambert
fig (matplotlib.figure.Figure, optional) – Handle to existing figure, if needed
ax (matplotlib.projections.polar.PolarAxes, optional) – Axes to plot on
kwargs – Keyword arguments to pass to matplotlib’s scatter/plot functions
- Returns:
matplotlib.figure.Figure – Handle to figure
matplotlib.projections.polar.PolarAxes – Axes where the pole figure is plotted
Examples
Plot the <100> pole figure of Goss texture:
from elasticipy.crystal_texture import DiscreteTexture goss = DiscreteTexture.Goss() goss.plot_as_pole_figure(uvw=[1,0,0], symmetrise=True)
Plot the <110> pole figure of the gamma fibre texture:
from elasticipy.crystal_texture import FibreTexture gamma = FibreTexture.gamma() gamma.plot_as_pole_figure(uvw=[1,1,0], symmetrise=True)
- sample(num=50, seed=None)[source]
Generate a random sample from the texture component
- Parameters:
num (int, optional) – Number of random orientations to generate. Default is 50.
seed (int, optional) – Seed to use for generating random numbers. Default is None.
- Returns:
Random orientations from the given texture
- Return type:
orix.quaternion.Orientation
Examples
Generate 50 orientations from uniform distribution:
>>> from elasticipy.crystal_texture import UniformTexture >>> o = UniformTexture().sample()
Generate 10 orientations from gamma-fibre
>>> from elasticipy.crystal_texture import FibreTexture >>> o = FibreTexture.gamma().sample(num=10)
- class elasticipy.crystal_texture.UniformTexture[source]
Bases:
CrystalTextureSimple class to define the uniform texture over SO(3)
Create a uniform texture over SO(3)
- mean_tensor(tensor)[source]
Perform the texture-weighted mean of a 4th-order tensor.
- Parameters:
tensor (SymmetricFourthOrderTensor) – Reference tensor (unrotated)
- Returns:
mean value of the rotated tensor
- Return type:
- plot_as_pole_figure(miller, projection='lambert', fig=None, ax=None, **kwargs)[source]
Plot the pole figure of the crystallographic texture
- Parameters:
uvw (list) – Miller indices of directions to plot
hkl (list) – Miller indices of plane normal to plot
UVTW (list) – Miller-Bravais indices of directions to plot
hkil (list) – Miller-Bravais indices of plane normal to plot
symmetrise (bool, optional) – Symmetrise the direction/plane to plot the family
projection (str, optional) – Type of projection to use, it can be either stereographic or Lambert
fig (matplotlib.figure.Figure, optional) – Handle to existing figure, if needed
ax (matplotlib.projections.polar.PolarAxes, optional) – Axes to plot on
kwargs – Keyword arguments to pass to matplotlib’s scatter/plot functions
- Returns:
matplotlib.figure.Figure – Handle to figure
matplotlib.projections.polar.PolarAxes – Axes where the pole figure is plotted
Examples
Plot the <100> pole figure of Goss texture:
from elasticipy.crystal_texture import DiscreteTexture goss = DiscreteTexture.Goss() goss.plot_as_pole_figure(uvw=[1,0,0], symmetrise=True)
Plot the <110> pole figure of the gamma fibre texture:
from elasticipy.crystal_texture import FibreTexture gamma = FibreTexture.gamma() gamma.plot_as_pole_figure(uvw=[1,1,0], symmetrise=True)
- sample(num=50, seed=None)[source]
Generate a random sample from the texture component
- Parameters:
num (int, optional) – Number of random orientations to generate. Default is 50.
seed (int, optional) – Seed to use for generating random numbers. Default is None.
- Returns:
Random orientations from the given texture
- Return type:
orix.quaternion.Orientation
Examples
Generate 50 orientations from uniform distribution:
>>> from elasticipy.crystal_texture import UniformTexture >>> o = UniformTexture().sample()
Generate 10 orientations from gamma-fibre
>>> from elasticipy.crystal_texture import FibreTexture >>> o = FibreTexture.gamma().sample(num=10)