EBSDDetector#
- class kikuchipy.detectors.EBSDDetector(shape: tuple[int, int] = (1, 1), px_size: float = 1.0, binning: int = 1, tilt: float = 0.0, azimuthal: float = 0.0, twist: float = 0.0, sample_tilt: float = 70.0, pc: ndarray | list | tuple = (0.5, 0.5, 0.5), convention: Literal['bruker', 'tsl', 'edax', 'amatek', 'oxford', 'aztec', 'emsoft', 'emsoft4', 'emsoft5'] | None = 'bruker')[source]#
Bases:
objectAn EBSD detector defining the detector’s view of the sample.
The detector stores information of the detector shape, pixel size, binning factor, tilt, azimuthal, and twist, the sample tilt, and the projection/pattern center (PC) per beam position. Given one or multiple PCs, the detector’s gnomonic coordinates are calculated.
A detector defines the transformations needed to project patterns generated in the sample to the detector.
- Parameters:
- shape
Number of detector rows \(N_y\) and columns \(N_x\), in pixels. Default is (1, 1).
- px_size
Size of the square unbinned detector pixel \(\delta\), in microns. Default is 1.0.
- binning
Detector binning factor \(b\), i.e. how many pixels are binned into one. Default is 1, meaning no binning.
- tilt
Detector tilt \(\theta\) about the detector horizontal \(X_d\), in degrees. Default is \(0^{\circ}\).
A positive angle means features on the detector appear to move upward (assuming all other defaults).
- azimuthal
Detector tilt \(\omega\) about the detector vertical \(Y_d\), in degrees. Default is \(0^{\circ}\).
A positive angle means features on the detector appear to move toward the right (assuming all other defaults).
- twist
Detector tilt \(\gamma\) about the detector normal \(Z_d\), in degrees. Default is \(0^{\circ}\).
A positive angle means features on the detector appear to move counter-clockwise about the projection center (assuming all other defaults).
- sample_tilt
Sample tilt \(\sigma\) about the microscope X, \(X_m\), in degrees. Default is \(70^{\circ}\), a typical angle for EBSD acquisition.
- pc
X, Y, and Z coordinates of the projection centers (PCs) in the given convention. Default is [0.5, 0.5, 0.5]. The PC describes the location of the beam on the sample surface measured relative to the detector screen. See Notes for the definitions of and conversions between conventions. If multiple PCs are given, they are assumed to be on the form [[x0, y0, z0], [x1, y1, z1], …].
- convention
Convention of the given pc. Default is Bruker’s convention. This determines how to convert pc to the internal (Bruker’s) definition. Options are “edax”/”tsl”/”amatek”, “oxford”/”aztec”, “bruker”, “emsoft”, “emsoft4”, and “emsoft5”. “emsoft” and “emsoft5” is the same convention. See Notes for conversions between conventions.
Notes
The pattern on the detector is always viewed from the detector towards the sample. Pattern width and height in pixels are here given as \(N_x\) and \(N_y\), respectively (possibly binned). PCs are stored and used internally in Bruker’s convention.
The Bruker PC coordinates \((x_B^*, y_B^*, z_B^*)\) are defined in fractions of \(N_x\), \(N_y\), and \(N_y\), respectively. \(x_B^*\) and \(y_B^*\) are defined with respect to the upper left corner of the detector. The Bruker PC coordinates are used internally, called \((PC_x, PC_y, PC_z)\) in the rest of the documentation when there is no reference to Bruker specifically.
The EDAX TSL PC coordinates \((x_T^*, y_T^*, z_T^*)\) are defined in fractions of \(N_x\), \(N_y\), and \(\min(N_x, N_y)\) with respect to the lower left corner of the detector, respectively.
Given these definitions, the following is the conversion from a PC in EDAX TSL’s convention to a PC in Bruker’s convention
\[\begin{split}x_B^* &= x_T^*,\\ y_B^* &= 1 - y_T^*,\\ z_B^* &= \frac{\min(N_x, N_y)}{N_y} z_T^*.\end{split}\]The Oxford Instruments PC coordinates \((x_O^*, y_O^*, z_O^*)\) are defined in fractions of \(N_x\) with respect to the lower left corner of the detector. The conversion from Oxford Instruments to Bruker is therefore given as
\[\begin{split}x_B^* &= x_O^*,\\ y_B^* &= 1 - y_O^* \frac{N_x}{N_y},\\ z_B^* &= \frac{N_x}{N_y} z_O^*.\end{split}\]The EMsoft PC coordinates \((x_{pc}, y_{pc})\) are defined as the number of pixels (with subpixel accuracy) with respect to the center of the detector. \(x_{pc}\) points towards the right and \(y_{pc}\) points upwards. The final PC coordinate, \(L\), is the detector distance, in microns. Note that prior to EMsoft v5.0, \(x_{pc}\) was defined towards the left. The conversion from EMsoft to Bruker is then, finally, given as
\[\begin{split}x_B^* &= \frac{1}{2} - \frac{x_{pc}}{N_x b},\\ y_B^* &= \frac{1}{2} - \frac{y_{pc}}{N_y b},\\ z_B^* &= \frac{L}{N_y b \delta},\end{split}\]where \(\delta\) is the unbinned detector pixel size in microns and \(b\) is the binning factor.
The calculation of gnomonic coordinates is based on the supplementary material to [Britton et al., 2016].
Attributes
Return the number of detector columns \(N_x\) divided by the number of detector rows \(N_y\).
Return or set the detector tilt \(\omega\) about the detector vertical \(Y_d\), in degrees.
Return or set the integer detector binning factor, \(b\).
Return the detector bounds \((0, N_x - 1, 0, N_y - 1)\) in pixel coordinates.
Return the detector Euler angles in the Bunge convention (ZXZ) in degrees.
Return the detector bounds [x0, x1, y0, y1] in gnomonic coordinates.
Return the detector height in microns.
Return the number of navigation dimensions of the projection center array.
Return or set the navigation shape of the projection center array.
Return the number of projection centers.
Return the number of detector pixel columns \(N_x\).
Return the number of detector pixel rows \(N_y\).
Return or set all projection center (PC) coordinates.
Return the average projection center.
Return a flattened array of projection center coordinates of shape (
navigation_size, 3).Return or set the projection center (PC) x coordinates.
Return or set the projection center (PC) y coordinates.
Return or set the projection center (PC) z coordinates.
Return the pixel size.
Return the binned pixel size in microns.
Return the maximum distance from
pcto the detector edge in gnomonic coordinates.Return or set the sample tilt \(\sigma\) about the microscope X, \(X_m\), in degrees.
Return a rotation that transform vectors given in the sample reference frame in the detector reference frame.
Return or set the number of detector rows \(N_y\) and columns \(N_x\) in pixels.
Return the number of detector pixels \(N_x N_y\).
Return the specimen-to-scintillator distance, known in EMsoft as \(L\), given in microns.
Return or set the detector tilt \(\theta\) about the detector horizontal \(X_d\), in degrees.
Return or set the detector twist \(\gamma\) about the detector normal \(Z_d\), in degrees.
Return the unbinned detector shape in pixels.
Return the detector width in microns.
Return the right bound in gnomonic coordinates.
Return the left bound in gnomonic coordinates.
Return the horizontal detector range in gnomonic coordinates.
Return the width of a pixel in gnomonic coordinates.
Return the lower bound in gnomonic coordinates.
Return the upper bound in gnomonic coordinates.
Return the vertical detector range in gnomonic coordinates.
Return the height of a pixel in gnomonic coordinates.
Methods
EBSDDetector.crop(extent)Return a new detector with its
shapecropped andpcvalues updated accordingly.Return a deep copy using
copy.deepcopy().Return an estimate of the tilt about the detector \(X_d\) axis.
EBSDDetector.estimate_xtilt_ztilt([degrees, ...])Return estimated tilts about the detector \(X_d\) and \(Z_d\) axes.
EBSDDetector.extrapolate_pc(pc_indices, ...)Return a new detector with projection centers (PCs) in a 2D map extrapolated from an average PC.
EBSDDetector.fit_pc(-> ~typing.Self)Return a new detector with interpolated projection centers (PCs) for all points in a map by fitting a plane to
pc.EBSDDetector.get_indexer(phase_list[, ...])Return a PyEBSDIndex EBSD indexer.
EBSDDetector.load(fname)Return an EBSD detector loaded from a text file saved with
save().Return PC in the Bruker convention, given in the class description.
EBSDDetector.pc_emsoft([version])Return the projection center(s)
pcin the EMsoft convention.Return PC in the Oxford convention.
Return PC in the EDAX TSL convention.
EBSDDetector.plot(-> None)Plot the detector screen viewed from the detector towards the sample.
EBSDDetector.plot_pc(-> None)Plot all projection centers (PCs).
EBSDDetector.plot_side_view(-> None)Plot the EBSD detector-sample geometry in a 2D side-view.
EBSDDetector.plot_top_view(-> None)Plot the EBSD detector-sample geometry in a 2D top-view.
EBSDDetector.save(filename[, convention])Save the detector in a text file with projection centers (PCs) in the given convention.
EBSDDetector.to_gnomonic_coords(coords[, pos])Return the corresponding gnomonic coordinates for the given detector pixel coordinates.
EBSDDetector.to_pixel_coords(coords[, pos])Return the corresponding detector pixel coordinates for the given gnomonic coordinates.
Examples using EBSDDetector#
Rotate vectors from sample to detector reference frame