upxo.texOps.fcc module

fcc.py

Crystallographic texture generator for Face-Centered Cubic (FCC) materials. Generates model textures (combinations of Copper, Brass, Goss, S, Cube, etc.) with customizable volume fractions, spreads, and background random components.

upxo.texOps.fcc.cubic_symmetry_operators() → numpy.ndarray[source]

Generate the 24 proper rotation matrices for cubic m-3m symmetry.

upxo.texOps.fcc.euler_bunge_to_matrix(phi1: float, Phi: float, phi2: float, degrees: bool = True) → numpy.ndarray[source]

Convert Bunge ZXZ Euler angles to a 3x3 rotation matrix.

upxo.texOps.fcc.matrix_to_euler_bunge(R: numpy.ndarray, degrees: bool = True) → Tuple[float, float, float][source]

Convert a 3x3 rotation matrix to Bunge ZXZ Euler angles.

upxo.texOps.fcc.normalize_euler_bunge(ea: numpy.ndarray, degrees: bool = True, eps: float = 1e-06) → numpy.ndarray[source]

Normalize Bunge ZXZ Euler angles to canonical ranges.

upxo.texOps.fcc.proj_to_so3(R: numpy.ndarray) → numpy.ndarray[source]

Project 3x3 matrix R to the nearest proper rotation matrix via SVD.

upxo.texOps.fcc.unique_rotations(rotations: List[numpy.ndarray], tol: float = 1e-08) → List[numpy.ndarray][source]

Deduplicate list of rotation matrices.

upxo.texOps.fcc.fcc_symmetrise_ori(bea: Tuple[float, float, float]) → numpy.ndarray[source]

Generate all symmetrically equivalent Bunge Euler angle triplets for one FCC orientation.

upxo.texOps.fcc.rand_uniform_so3(size: int = 1) → numpy.ndarray[source]

Draw uniform random rotations from SO(3) using Shoemake (1992) method.

upxo.texOps.fcc.quat_to_matrix(q: numpy.ndarray) → numpy.ndarray[source]

Convert a stack of quaternions [w, x, y, z] to (N, 3, 3) rotation matrices.

upxo.texOps.fcc.matrix_to_quat(R: numpy.ndarray) → numpy.ndarray[source]

Convert a stack of 3x3 rotation matrices to unit quaternions [w, x, y, z].

class upxo.texOps.fcc.FCCTexture(tc_fractions: Dict[str, float], spread: float | Dict[str, float] = 5.0, apply_sample_symmetries: bool = True, use_rd: bool = True, use_td: bool = True, use_nd: bool = True, custom_components: Dict[str, Tuple[float, float, float]] | None = None)[source]

Bases: object

Synthetic FCC crystallographic texture from named ideal components.

Samples orientations around ideal Bunge Euler positions (copper, brass, Goss, cube, …) with per-component volume fractions and angular spreads. Remainder of the volume fraction is random background. Optional sample symmetries (RD/TD/ND 180° rotations) for rolling-style ODFs. Complements tops and registry TextureComponentProfile.

generate_euler(N: int) → numpy.ndarray[source]

Generate N orientations as Bunge Euler angles in degrees (phi1, Phi, phi2).

generate_detailed(N: int, convention: str = 'euler') → Dict[str, Any][source]

Generate detailed texture orientations, organized by component and variant clusters.

Parameters:
  • N (int) – Total number of orientations to generate.

  • convention (str) – Output orientation convention: ‘euler’ (Bunge ZXZ degrees), ‘quaternion’ (w, x, y, z), or ‘matrix’ (3x3).

Returns:

Structured dictionary of generated orientations.

Return type:

dict

generate_quaternions(N: int) → numpy.ndarray[source]

Generate N orientations as unit quaternions [w, x, y, z].

generate_matrices(N: int) → numpy.ndarray[source]

Generate N orientations as 3x3 rotation matrices.