- EBSD.refine_projection_center(xmap: CrystalMap, detector: EBSDDetector, master_pattern: EBSDMasterPattern, energy: Union[int, float], navigation_mask: Optional[np.ndarray] = None, signal_mask: Optional[np.ndarray] = None, method: Optional[str] = 'minimize', method_kwargs: Optional[dict] = None, trust_region: Union[tuple, list, np.ndarray, None] = None, initial_step: Union[float] = None, rtol: float = 0.0001, maxeval: Optional[int] = None, compute: bool = True, rechunk: bool = True, chunk_kwargs: Optional[dict] = None) Union[Tuple[np.ndarray, EBSDDetector, np.ndarray], da.Array] #
Refine projection centers by searching the parameter space using fixed orientations.
Refinement attempts to maximize the similarity between patterns in this signal and simulated patterns projected from a master pattern. The similarity metric used is the normalized cross-correlation (NCC). The sample-detector geometry, represented by the three projection center (PC) parameters (PCx, PCy, PCz) in the Bruker convention, is updated during refinement, while the orientations, defined relative to the EDAX TSL sample reference frame RD-TD-ND, are fixed.
A subset of the optimization methods in SciPy and NLopt are available:
Crystal map with points to use in refinement. Only the points in the data (see
CrystalMap) are used. If a
navigation_maskis given, points equal to points in the data and points equal to
Falsein this mask are used.
Detector describing the detector-sample geometry with either one PC to be used for all map points or one for each point. Which PCs are refined depend on
Master pattern in the square Lambert projection of the same phase as the one in the crystal map.
Accelerating voltage of the electron beam in kV specifying which master pattern energy to use during projection of simulated patterns.
A boolean mask of points in the crystal map to use in refinement (equal to
False, i.e. points to mask out are
True). The mask must be of equal shape to the signal’s navigation shape. If not given, all points in the crystal map data are used.
A boolean mask of detector pixels to use in refinement (equal to
False, i.e. pixels to mask out are
True). The mask must be of equal shape to the signal’s signal shape. If not given, all pixels are used.
Name of the
scipy.optimizeor NLopt optimization method, among
"ln_neldermead"(from NLopt). Default is
"minimize", which by default performs local optimization with the Nelder-Mead method, unless another
"minimize"method is passed to
Keyword arguments passed to the
method. For example, to perform refinement with the modified Powell algorithm from SciPy, pass
method_kwargs=dict(method="Powell"). Not used if
List of three +/- deviations in the range [0, 1] used to determine the bounds constraints on the PC parameters per navigation point, e.g.
[0.05, 0.05, 0.05]. Not passed to SciPy
methodif it does not support bounds. The definition range of the PC parameters are assumed to be [-2, 2].
A single initial step size for all PC parameters in the range [0, 1]. Only used if
Stop optimization of a pattern when the difference in NCC score between two iterations is below this value (relative tolerance). Default is
1e-4. Only used if
Stop optimization of a pattern when the number of function evaluations exceeds this value, e.g.
100. Only used if
Whether to refine now (
True) or later (
False). Default is
compute()for more details.
True(default), rechunk the dask array with patterns used in refinement (not the signal data inplace) if it is returned from
get_dask_array()in a single chunk. This ensures small data sets are rechunked so as to utilize multiple CPUs.
New similarity metrics, a new EBSD detector instance with the refined PCs and the number of function evaluations if
compute=False, a dask array of navigation size + (5,) is returned, to be computed later. See
compute_refine_projection_center_results(). Each navigation point has the optimized score, the three PC parameters in the Bruker convention and the number of function evaluations in element 0, 1, 2, 3 and 4, respectively.
NLopt is for now an optional dependency, see Optional dependencies for details. Be aware that NLopt does not fail gracefully. If continued use of NLopt proves stable enough, its implementation of the Nelder-Mead algorithm might become the default.