EBSD Pattern Simulations - EMsoft-org/EMsoft GitHub Wiki
EBSD Pattern Simulations
Once you have a complete EBSD master pattern simulation, the next step is to set up your detector parameters and grain orientations to compute actual patterns. For this help page, we will assume that you already know the relevant parameters, and you simply want to compute EBSD patterns.
The relevant program is called EMEBSD, and you generate the name list file template by typing:
EMEBSD -t
This progam takes many parameters; before explaining them all, a few words are in order about the internal EMsoft convention for the detector parameters. The distance L between the scintillator and the illuminated point is measured in microns. The location of the pattern center is expressed with respect to the center of the scintillator, with x-axis going to the right (when looking at the detector from the sample) and the y-axis going up; the pattern center coordinates are expressed in units of the pixel size delta. As an example, assume that the pattern center coordinates (in EMsoft units) are (pcx, pcy) = (4.5, 46.5), the sample-scintillator distance L is equal to 20,000 micron, the detector pixel size if 50 microns, and there are (Nx, Ny) = (640,480) pixels. The conversion equations to the conventional (x*,y*,z*) parameters are then as follows (defining W = Nx * delta):
- x* = (Nx/2 + pcx)/Nx (= 0.50703);
- y* = (Ny/2 + pcy)/Nx (= 0.44766);
- z* = L/W (= 0.62500).
And the inverse relations are:
- pcx = Nx x* - Nx/2
- pcy = Nx y* - Ny/2
- L = W z*.
Here is the list of input parameters (not necessarily in the order they appear in in the template file):
&EBSDdata
! template file for the EMEBSD program
!
! DETECTOR PARAMETERS
! distance between scintillator and illumination point [microns]
L = 15000.0,
! tilt angle of the camera (positive below horizontal, [degrees])
thetac = 10.0,
! CCD pixel size on the scintillator surface [microns]
delta = 50.0,
! number of CCD pixels along x and y
numsx = 640,
numsy = 480,
! binning mode (1, 2, 4, or 8)
binning = 1,
! pattern center coordinates in units of pixels
xpc = 0.0,
ypc = 0.0,
! angle between normal of sample and detector
omega = 0.0,
! should a circular mask be applied to the data? 'y', 'n'
maskpattern = 'n',
!
! LENS DISTORTION
! transfer lens barrel distortion parameter
alphaBD = 0.0,
!
! MASTER PATTERN FILE
! name of EBSD master output file; path relative to EMdatapathname
masterfile = 'master.h5',
! name of Monte Carlo output file; path relative to EMdatapathname
energyfile = 'master.h5',
! energy range in the intensity summation [keV]
energymin = 5.0,
energymax = 20.0,
!
! include a realistic intensity background or not ...
includebackground = 'y',
!
! input Euler angles
! if anglefiletype = 'orpcdef' then each line in the euler input file should look like this: (i.e., 15 floats)
! 55.551210 58.856774 325.551210 0.0 0.0 15000.0 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 1.00
! <- Euler angles (degrees) -> <- pat. ctr. -> <- deformation tensor in column-major form->
!
anglefiletype = 'orientations',
! name of angle file (euler angles or quaternions); path relative to EMdatapathname
anglefile = 'testeuler.txt',
! 'tsl' or 'hkl' Euler angle convention parameter
eulerconvention = 'tsl',
!
! OUTPUT FILE NAME
! name of output file; path relative to EMdatapathname
datafile = 'EBSDout.h5',
! bitdepth '8bit' for [0..255] bytes; 'float' for 32-bit reals; '##int' for 32-bit integers with ##-bit dynamic range
! e.g., '9int' will get you 32-bit integers with intensities scaled to the range [ 0 .. 2^(9)-1 ];
! '17int' results in the intensity range [ 0 .. 2^(17)-1 ]
bitdepth = '8bit',
!
! Following parameters must not be zero...
! incident beam current [nA]
beamcurrent = 150.0,
! beam dwell time [micro s]
dwelltime = 100.0,
!
! SAMPLE DEFORMATION (since version 3.2)
! should we perform an approximate computation that includes a lattice distortion? ('y' or 'n')
! This uses a polar decomposition of the deformation tensor Fmatrix which results in
! an approximation of the pattern for the distorted lattice; the bands will be very close
! to the correct position in each pattern, but the band widths will likely be incorrect.
applyDeformation = 'n'
! if applyDeformation='y' then enter the 3x3 deformation tensor in column-major form
! the default is the identity tensor, i.e., no deformation
Ftensor = 1.D0, 0.D0, 0.D0, 0.D0, 1.D0, 0.D0, 0.D0, 0.D0, 1.D0,
!
! OUTPUT SCALING PARAMETERS
! intensity scaling mode 'not' = no scaling, 'lin' = linear, 'gam' = gamma correction
scalingmode = 'not',
! gamma correction factor
gammavalue = 1.0,
!
!=======================
! if the 'makedictionary' parameter is 'n', then we have the normal execution of the program
! if set to 'y', then all patterns are pre-processed using the other parameters below, so that
! the resulting dictionary can be used for static indexing in the EMEBSDDI program...
! these parameters must be taken identical to the ones in the EMEBSDDI.nml input file to have
! optimal indexing...
makedictionary = 'n',
! should a circular mask be applied to the data? 'y', 'n'
maskpattern = 'n',
! mask radius (in pixels, AFTER application of the binning operation)
maskradius = 240,
! hi pass filter w parameter; 0.05 is a reasonable value
hipassw = 0.05,
! number of regions for adaptive histogram equalization
nregions = 10,
! OpenMP threading parameter
! number of threads (default = 1)
nthreads = 1,
/
For most of the parameters above, the single comment line preceeding the parameter is sufficiently clear. The first group of parameters covers the detector geometry and characteristics, including the tilt, pixel size, number of pixels, distance to sample, pattern center coordinates, binning mode, the rotation of the sample around the RD direction, and whether or not to include a circular mask. The lens distortion parameter is typically kept at zero, but a small value could be entered if you have actually measured the distortion. Then the master pattern file must be entered; note that in earlier versions of EMsoft, the Monte Carlo and master pattern files were separate files, so there are two entries. You should make sure that both have the same name; in a later version we will remove one of these parameters. At this point you can also set the range of energies you want to have contribute to the patterns (based on the energy range of the master pattern file); this will also be removed in later program versions. Then you enter the file name for the Euler angle input file (format described below) along with the rotation convention (TSL vs. HKL).
Next you enter the output file name (which will be an HDF5 file), along with the data type of the patterns. There are three different formats available: 8bit, which produces images with intensities in the range [0..255]; float, which produces images with 4-byte floating point intensity values; and a flexible 4-byte integer where you can define how many bits are relevant. For instance, if you specify 6int, your intensities will be scaled to integers in the range [0..2^(6)-1], for 12int, the range is [0..2^(12)-1] and so on.
beamcurrent and dwelltime are not really important but they should both be different from zero; the actual values are not relevant. For now we skip the Sample Deformation fields, since they are really still in the experimental testing phase. Finally, we have the output scaling, which means that the output intensities are according to a linear scale or a gamma scale; for gamma scaling, use scalingmode=gam and set gammavalue to 0.33. Then decide how many threads you want to use for the simulation, save the file, and execute the program using
EMEBSD filename.nml
The Euler angle input file must have a basic structure as follows:
eu
3
0.0, 0.0, 0.0
120.0, 45.0, 60.0
90.0, 20.0, 15.0
The first line tells the program that the data is in Euler angle format (Bunge convention), the second line defines how many orientation triplets are contained in the file, and this is followed by the actual triplets in degrees and separated by commas.
Recently we have added a second euler angle input file type, namely a file with 15 entries per line instead of just 3. By changing anglefiletype from orientations to orpcdef (stands for orientation, pattern center, and deformation), you can give each computed pattern its own pattern center and deformation state. This might be useful if you want to compare patterns for a distorted sample with simulations. Note that the present approach implements the distortion during the pattern interpolation from the master pattern, so things are not completely realistic; all the zone axes will be at the correct locations, but higher order Laue zone lines and such will not be correct (that would require computing the pattern for a general triclinic unit cell, which would be quite time consuming).