MasterPattern#
- class de_ebsd.sim.MasterPattern(data, energies_kev, metadata=<factory>)[source]#
Bases:
objectBackscatter intensity on the sphere in square-Lambert storage.
- Attributes:
- data
Intensities, shape
(n_energies, 2, n, n); hemisphere 0 is north.- energies_kev
Energy bin centers in keV, shape
(n_energies,).- metadata
Free-form provenance (crystal, dmin, backend name, …).
Methods
energy_indexLoad a master pattern saved with
save().Project onto a detector for one or more crystal orientations.
Interpolate the master pattern at unit vectors (..., 3).
Save to HDF5 (data, energies, and string metadata).
Display the master pattern.
Copy to another device.
Resample the full sphere into an equirectangular (lat-long) image.
Resample one hemisphere into a stereographic (equal-angle) image.
Attributes
deviceHalf-width of the Lambert grid (n = 2 npx + 1).
dataenergies_kevmetadata- property npx#
Half-width of the Lambert grid (n = 2 npx + 1).
- project(detector, orientation, energy_kev=None, rescale=True)[source]#
Project onto a detector for one or more crystal orientations.
- Parameters:
- detector
The detector geometry (fixed pattern center).
- orientation
Crystal orientation(s): an
orix.quaternion.Rotationor a tensor/array of unit quaternions (N, 4) in (a, b, c, d) order.- energy_kev
Energy bin to project (default: highest).
- rescale
Linearly rescale each pattern to [-1, 1].
- Returns:
torch.TensorPatterns of shape (N, n_rows, n_cols).
- sample(directions, energy_kev=None)[source]#
Interpolate the master pattern at unit vectors (…, 3).
Bilinear interpolation on the square-Lambert grid via
grid_sample(align_corners=True), identical to kikuchipy’s interpolation. The hemisphere is selected bysign(z).
- show(projection='lambert', energy_kev=None, texture_height=256, **kwargs)[source]#
Display the master pattern.
- Parameters:
- projection
"lambert"(both hemispheres side by side),"stereographic"(both hemispheres, equal-angle), or"sphere"(interactive 3D sphere with the pattern as texture).- energy_kev
Energy bin to display (default: highest).
- texture_height
Height of the equirectangular texture used by the interactive sphere. Lower values reduce notebook/SpyDE payload size while leaving the master-pattern data unchanged.