pattern_to_sphere#
- de_ebsd.index.backproject.pattern_to_sphere(patterns, detector, directions, pattern_center=None, padding_mode='border')[source]#
Back-project detector
patternsontodirectionson the unit sphere.Each sphere direction reads the detector pixel that scatters along it (no crystal orientation is applied), bilinearly interpolating the pattern. The result is
E(n)sampled ondirections, ready to feedde_ebsd.index.spherical.harmonics.SphericalHarmonicTransform.forward()(reshape the(N_theta, N_phi)grid directions to(M, 3)and the samples back).- Parameters:
- patterns
Detector images
(..., H, W)(H = detector.nrows,W = detector.ncols), batched over arbitrary leading dimensions. Real floating dtype.- detector
The
de_ebsd.simEBSDDetectorgeometry (fixed pattern center). Its pixel -> direction map is inverted here.- directions
Target sphere directions
(M, 3)in the sample/detector frame, e.g.SphericalHarmonicTransform.grid_directions().reshape(-1, 3).- pattern_center
Optional pattern-center override
(3,)(pcx, pcy, pcz); pass a tensor withrequires_gradto differentiate the samples in the pattern center (I6 refinement). Defaults todetector.pattern_center.- padding_mode
grid_samplepadding for directions that fall (just) outside the pixel grid;"border"(default) clamps to the edge. Off-FOV samples are flagged by the returned mask regardless.
- Returns:
samplesSphere samples
(..., M)(same leading dims and dtype aspatterns). Entries outside the field of view are thepadding_moderead-off and should be excluded viamask. Differentiable inpatterns(and, viapattern_center, in the pattern center).maskField-of-view weight
(M,)inpatterns’ dtype:1where the direction lands on the detector,0otherwise (the detector’s gnomonic bounds). Shared across the batch since the geometry is.