crop#
- EBSDDetector.crop(extent: tuple[int, int, int, int] | list[int]) EBSDDetector [source]#
Return a new detector with its
shape
cropped andpc
values updated accordingly.- Parameters:
- extent
Tuple with four integers: (top, bottom, left, right).
- Returns:
new_detector
A new detector with a new shape and PC values.
Examples
>>> import kikuchipy as kp >>> det = kp.detectors.EBSDDetector((6, 6), pc=[3 / 6, 2 / 6, 0.5]) >>> det EBSDDetector(shape=(6, 6), pc=(0.5, 0.333, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=1.0 um) >>> det.crop((1, 5, 2, 6)) EBSDDetector(shape=(4, 4), pc=(0.25, 0.25, 0.75), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=1.0 um)
Plot a cropped detector with the PC on a cropped pattern
>>> s = kp.data.nickel_ebsd_small() >>> s.remove_static_background(show_progressbar=False) >>> det2 = s.detector >>> det2.plot(pattern=s.inav[0, 0].data) >>> det3 = det2.crop((10, 50, 20, 60)) >>> det3.plot(pattern=s.inav[0, 0].data[10:50, 20:60])