hrebsd#
- de_ebsd.index.crosscorr.hrebsd(patterns, reference, detector, pattern_center=None, reference_pattern_center=None, *, roi_size=128, grid=8, margin=0.05, upsample=50, n_passes=2, bandpass=None, whiten=0.0, min_peak=0.0, batch=256, device=None)[source]#
Deviatoric strain and lattice rotation relative to a reference pattern.
Cross-correlates a grid of regions between each test pattern and the reference, fits the gnomonic shift equation for the trace-free displacement gradient, then remaps the reference into the measured configuration and repeats. That second pass is what makes the result trustworthy once lattice rotations exceed a degree: it drops the residual rotation to first-pass accuracy, and pattern-center error reaches the strain only through that residual.
- Parameters:
- patterns
Test patterns
(H, W)or(N, H, W), background-corrected; seede_ebsd.index.preprocess.- reference
(H, W), or(N, H, W)for one reference per test point. Strain is measured relative to whatever state this pattern is in.- detector
EBSDDetector, for the gnomonic geometry.- pattern_center, reference_pattern_center
Pattern center at the test and reference points,
(3,)or(N, 3); both default todetector.pattern_center. Passing them separately is worth doing over any appreciable scan – a millimetre of travel moves the pattern center by several percent of the screen – and the remap absorbs the difference.- roi_size
Region side in pixels. Larger regions correlate more precisely but average the deformation over a wider gnomonic span.
- grid
Regions per side, so
grid ** 2in total, against 8 free parameters.- margin
Edge inset as a fraction of each side.
- upsample
Sub-pixel resolution of the correlation peak,
1 / upsamplepixels.- n_passes
Correlation passes;
1disables remapping and is the classic single-pass formulation. A pattern-center difference is still applied on pass 1.- bandpass
(low, high)Gaussian band-pass in cycles per pixel (Nyquist is 0.5), orNonefor flat. Rarely needed on real patterns; raiselowabove zero to suppress slow background gradients that survived preprocessing.- whiten
Spectral whitening exponent, 1.0 being full phase correlation. Defaults to 0 (plain correlation), which measured better than whitening on real patterns. See
_measure_shifts()for the failure mode it exists to defend against.- min_peak
Regions whose normalized cross-correlation falls below this are dropped from the fit. Regions are weighted by that correlation regardless.
- batch
Patterns correlated at once, which bounds memory: it scales as
batch * grid**2 * roi_size**2.- device
Defaults to the test patterns’.
- Returns:
HREBSDResultDetector-frame tensors, the raw region shifts, and a per-point residual.