hexrd.phase_transition.texture package

Submodules

Module contents

class hexrd.phase_transition.texture.DeLaValleePoussinKernel(halfwidth: float, crystal_symmetry: str | ndarray | None = None, sample_symmetry: str | ndarray | None = None)[source]

Bases: SO3Kernel

De la Vallée Poussin kernel on SO(3).

A radially symmetric kernel on SO(3) defined by:

K(ω) = C · cos(ω/2)^(2κ)

where ω is the misorientation angle, κ is the shape parameter, and C = B(3/2, 1/2) / B(3/2, κ + 1/2) is the normalization constant (B denotes the Beta function).

The halfwidth h is the angle at which the kernel drops to half its peak value. It is related to κ analytically by:

κ = ln(0.5) / (2 · ln(cos(h/2)))

Parameters

halfwidthfloat

Half-width parameter in radians — the angle at which K drops to half its maximum. Must be > 0, typically in [π/180, π/2].

crystal_symmetrystr or numpy.ndarray, optional

Crystal symmetry used to compute symmetry-reduced misorientation angles. Strings are interpreted as Laue group labels.

sample_symmetrystr or numpy.ndarray, optional

Sample symmetry used to compute symmetry-reduced misorientation angles. Strings are interpreted as Laue group labels, with triclinic, monoclinic, and orthorhombic sample labels mapped to their corresponding finite Laue groups.

Attributes

halfwidthfloat

Half-width parameter in radians

kappafloat

Shape parameter κ derived from half-width

norm_constantfloat

Normalization constant from the Beta function

Notes

Symmetry is opt-in and must be supplied explicitly. By default the kernel applies NO crystal or sample symmetry: symmetry-equivalent orientations are treated as distinct and the misorientation angle is the raw geometric one. To have the kernel respect symmetry - i.e. treat orientations related by a symmetry operation as identical and use the smallest equivalent misorientation - you must pass crystal_symmetry (and/or sample_symmetry). For example, a cubic material must be built with crystal_symmetry='oh'; omitting it silently ignores cubic symmetry and will overestimate misorientation angles.

Examples

>>> kernel = DeLaValleePoussinKernel(halfwidth=np.radians(15))
>>> R1 = np.eye(3)
>>> R2 = np.eye(3)  # Same orientation
>>> value = kernel.eval(R1, R2)  # Maximum value = C
>>>
>>> # Respect cubic crystal symmetry (otherwise it is ignored):
>>> kernel = DeLaValleePoussinKernel(
...     halfwidth=np.radians(15), crystal_symmetry='oh'
... )
eval(R1: ndarray, R2: ndarray) float | ndarray[source]

Evaluate de la Vallée Poussin kernel between rotations.

K(ω) = C · cos(ω/2)^(2κ)

Parameters

R1, R2array_like

Rotation matrices of shape (…, 3, 3)

Returns

float or numpy.ndarray

Kernel values, shape matches broadcasting of R1 and R2

Examples

>>> kernel = DeLaValleePoussinKernel(
...     halfwidth=np.radians(10)
... )
>>> value = kernel.eval(np.eye(3), np.eye(3))
property halfwidth: float

float: Half-width in radians (angle where K = K_max / 2).

property has_symmetry: bool

bool: Whether symmetry reduction is enabled.

property kappa: float

float: Shape parameter κ.

misorientation_angle(R1: ndarray, R2: ndarray) float | ndarray[source]

Calculate misorientation angle between rotation matrices.

Without symmetry, uses the formula: cos(ω) = (trace(R1^T @ R2) - 1) / 2, and supports arbitrary broadcasting of R1 and R2. With crystal or sample symmetry, delegates to hexrd.core.rotations.misorientation for symmetry-reduced angles; in that case one of R1/R2 must be a single orientation (shape (3, 3)), which is reduced against the other as a batch.

Parameters

R1, R2array_like

Rotation matrices of shape (…, 3, 3)

Returns

float or numpy.ndarray

Misorientation angles in radians, shape matches input broadcasting

property norm_constant: float

float: Normalization constant from Beta function.

class hexrd.phase_transition.texture.SO3Kernel[source]

Bases: ABC

Abstract base class for kernels on the SO(3) rotation group.

All SO(3) kernels should inherit from this class and implement the eval() method for kernel evaluation.

abstract eval(R1: ndarray, R2: ndarray) float | ndarray[source]

Evaluate kernel between two rotations.

Parameters

R1, R2array_like

Rotation matrices of shape (…, 3, 3)

Returns

float or numpy.ndarray

Kernel values