fit_pc#
- EBSDDetector.fit_pc(pc_indices: list | tuple | ndarray, map_indices: list | tuple | ndarray, transformation: str = 'projective', is_outlier: ndarray | None = None, plot: bool = True, return_figure: bool = False, figure_kwargs: dict | None = None) EBSDDetector | tuple[EBSDDetector, Figure][source]#
Return a new detector with interpolated projection centers (PCs) for all points in a map by fitting a plane to
pc[Winkelmann et al., 2020].- Parameters:
- pc_indices
2D coordinates (row, column) of each
pcinmap_coordinates. Must be a flattened array of shape (2,) +navigation_shape.- map_indices
2D coordinates (row, column) of all map points in a regular grid to interpolate PCs for. Must be a flattened array of shape
(2,) + map_shape.- transformation
Which transformation function to use when fitting PCs, either
"projective"(default) or"affine". Both transformations perserve co-planarity of map points, while the projective transformation allows parallel lines in the map point grid to become non-parallel within the sample plane.- is_outlier
Boolean array with
Truefor PCs to not include in the fit. If not given, all PCs are used. Must be ofnavigation_shape.- plot
Whether to plot the experimental and estimated PCs (default is
True).- return_figure
Whether to return the figure if
plot=True(default isFalse).- figure_kwargs
Keyword arguments passed to
matplotlib.pyplot.Figure()ifplot=True.
- Returns:
new_detectorNew detector with as many interpolated PCs as indices given in
map_indicesand an estimated sample tilt. The detector tilt is assumed to be constant.figFigure of experimental and estimated PCs, returned if
plot=Trueandreturn_figure=True.
- Raises:
ValueErrorIf
navigation_sizeis 1 or if thepc_indicesormap_indicesarrays have the incorrect shape.
See also
Notes
This method is adapted from Aimo Winkelmann’s functions
fit_affine()andfit_projective()in the xcdskd Python package. Their uses are described in [Winkelmann et al., 2020]. Winkelmann refers to a code example from StackOverflow (https://stackoverflow.com/a/20555267/3228100) for the affine transformation.