determine_pattern_center#

de_ebsd.index.refine.determine_pattern_center(patterns, master, detector, rotations, pattern_center=None, n_rounds=5, n_tiles=16, samples_per_tile=8, refine_orientations=True, n_pattern_center_steps=10, damping=0.001, keep_best=True, device=None, return_orientations=False, n_orientation_steps=15, blur=(0.05, 0.025, 0.012, 0.0))[source]#

Calibrate one shared pattern center from many EBSD patterns.

Fits a single pattern center shared by the whole calibration set by alternating an orientation-only refinement of every pattern at the current PC with a Levenberg-Marquardt step on the 3-parameter PC whose normal equations are accumulated over all patterns. That ensemble accumulation is what breaks the single-pattern R–PC degeneracy. Calibrate once, then refine the full scan at the fixed PC with refine_hr(refine_pattern_center=False, pattern_center=<calibrated pattern_center>).

Parameters:
patterns

Calibration patterns (N, H, W), or a single (H, W) image. A well-distributed few dozen to few hundred are plenty to fit three parameters. The raw sampled values are used.

master, detector

The continuous de_ebsd.sim.MasterPattern and the EBSDDetector geometry. detector.pattern_center is used only when pattern_center is None.

rotations

Per-pattern seed orientations, e.g. from coarse indexing.

pattern_center

Starting shared pattern center (3,); None uses detector.pattern_center.

n_rounds

Alternating (orientation, shared-PC) rounds.

n_tiles, samples_per_tile

Tiles per detector side and band-edge samples kept per tile; the defaults give 2048 samples per pattern.

refine_orientations

Re-refine each orientation at the current PC every round (default), or hold the input rotations fixed and fit only the PC.

n_pattern_center_steps

Levenberg-Marquardt steps on the shared PC per round.

damping

Initial LM damping, adapted each step (x0.5 accepted, x3 rejected) and carried across rounds. Also seeds the inner orientation refinement.

keep_best

Never return a PC / orientation set scoring below the best seen, making the calibration monotone in the total per-tile NCC.

device

Defaults to master.data.device; otherwise everything is moved there.

return_orientations

Also return the refined orientations, before info.

n_orientation_steps

LM steps for the inner orientation refinement each round.

blur

Gaussian blur of the master (radians on the sphere) per stage, coarse to fine, spread evenly over the rounds. A sharp dynamical master only has a slope within ~0.01 of the true PC; the blurred stages pull a further-off seed into that basin. None or (0,) fits the sharp master only.

Returns:
pattern_centertorch.Tensor

The calibrated shared pattern center (3,).

rotationsorix.quaternion.Rotation

Only when return_orientations: the orientations at the calibrated PC.

infodict

"ncc" and "ncc_seed" (mean per-tile NCC at the calibrated and seed geometry), "pc_step" (L2 magnitude of the final round’s PC move – small means converged), "pc_step_history", and "n_rounds".