extract_grid#

EBSD.extract_grid(grid_shape: Tuple[int, int] | int, return_indices: bool = False) EBSD | LazyEBSD | Tuple[EBSD | LazyEBSD, ndarray][source]#

Return a new signal with patterns from positions in a grid of shape grid_shape evenly spaced in navigation space.

Parameters:
grid_shape

Tuple of integers or just an integer signifying the number of grid indices in each dimension. If 2D, the shape is (n columns, n rows).

return_indices

Whether to return the indices of the extracted patterns into data as an array of shape (2,) + grid_shape. Default is False.

Returns:
new

New signal with patterns from indices in a grid corresponding to grid_shape. Attributes xmap, static_background and detector are deep copied.

indices

Indices of the extracted patterns into data, returned if return_indices=True.

Examples

>>> import kikuchipy as kp
>>> s = kp.data.nickel_ebsd_large(lazy=True)
>>> s
<LazyEBSD, title: patterns Scan 1, dimensions: (75, 55|60, 60)>
>>> s2 = s.extract_grid((5, 4))
>>> s2
<LazyEBSD, title: patterns Scan 1, dimensions: (5, 4|60, 60)>

Examples using EBSD.extract_grid#

Extract patterns from a grid

Extract patterns from a grid