directions_to_pixels#

de_ebsd.index.backproject.directions_to_pixels(directions, detector, pattern_center=None)[source]#

Map sphere directions to fractional detector pixels (inverse of the DC map).

Parameters:
directions

Unit vectors (M, 3) in the sample frame (need not be exactly normalized; the gnomonic ratios are scale-invariant).

detector

The de_ebsd.sim EBSDDetector geometry.

pattern_center

Optional pattern-center override (3,) (pcx, pcy, pcz). When supplied with requires_grad, the returned pixel coordinates are differentiable in the pattern center. Defaults to detector.pattern_center.

Returns:
col, row

Fractional pixel coordinates (M,), where integer values land on pixel centers (col = 0 is the leftmost column, row = 0 the top row) – ready for torch.nn.functional.grid_sample() with align_corners=True.

in_fov

Boolean field-of-view mask (M,): True where the direction points at the detector (d_z > 0) and lands within the gnomonic bounds.