Content
Implementation of algorithms
pyimgalgos/src/FiberIndexing.py self-documentation
Script
cxif5315/make-index-table.py
Triclinic crystal cell parameters
Triclinic crystal cell in 3-d is described by cell edge lengthes, a, b, c, and associated angles between edges, alpha, beta, and gamma, as shown in the plot.
*----------* / \ / \ / \ / \ / \ gamma \ / *----------* / / / / /alpha / / / *-------/--* c \ / \beta / a / \ / \ / \ / *-----b----*
As a starting point in this analysis we use parameters from previous study
a = 18.36 A b = 26.65 A c = 4.81 A alpha = 90.00 deg beta = 90.00 deg gamma = 102.83 deg
See: Crystal structure, Bravais lattice, Crystal system, Primitive cell, Lattice constant
3-d space primitive vectors
Crystal cell parameters can be transformed to 3-d primitive vectors
a1 = (18.36, 0.0, 0.0) a2 = (5.917873795354449, 25.984635262829016, 0.0) a3 = (0.0, 0.0, 4.81)
Reciprocal space primitive vectors
3-d primitive vectors can be converted in reciprocal space primitive vectors
b1 = [ 0.05446623 0.01240442 0. ] b2 = [ 0. 0.03848428 0. ] b3 = [ 0. 0. 0.20790021]
See: Reciprocal lattice, Surface diffraction, Miller index
Table of lattice nodes sorted by radius
Lattice nodes in reciprocal space can be evaluated from primitive vectors and associated Muller indexes h,k,l. Lattice nodes ordered by ascending R(h,k,l) - distance between (h,k,l) and (0,0,0) points, is presented in table
2-d case 3-d case ( h, k) R(h,k)[1/A] ( h, k, l) R(h,k,l)[1/A] ___________________ ________________________ ( 0, 0) 0.0000 ( 0, 0, 0) 0.0000 ( 0, 1) 0.0385 ( 0, 1, 0) 0.0385 ( 1, 0) 0.0559 ( 1, 0, 0) 0.0559 (-1, 1) 0.0604 (-1, 1, 0) 0.0604 ( 1, 1) 0.0745 ( 1, 1, 0) 0.0745 ( 0, 2) 0.0770 ( 0, 2, 0) 0.0770 (-1, 2) 0.0845 (-1, 2, 0) 0.0845 ( 1, 2) 0.1047 ( 1, 2, 0) 0.1047 (-2, 1) 0.1098 (-2, 1, 0) 0.1098 ( 2, 0) 0.1117 ( 2, 0, 0) 0.1117 ( 0, 3) 0.1155 ( 0, 3, 0) 0.1155 (-1, 3) 0.1166 (-1, 3, 0) 0.1166 (-2, 2) 0.1208 (-2, 2, 0) 0.1208 ( 2, 1) 0.1260 ( 2, 1, 0) 0.1260 ( 1, 3) 0.1390 ( 1, 3, 0) 0.1390 (-2, 3) 0.1417 (-2, 3, 0) 0.1417 ( 2, 2) 0.1491 ( 2, 2, 0) 0.1491 (-1, 4) 0.1517 (-1, 4, 0) 0.1517 ( 0, 4) 0.1539 ( 0, 4, 0) 0.1539 (-3, 1) 0.1634 (-3, 1, 0) 0.1634 ( 3, 0) 0.1676 ( 3, 0, 0) 0.1676 (-3, 2) 0.1682 (-3, 2, 0) 0.1682 (-2, 4) 0.1689 (-2, 4, 0) 0.1689 ( 1, 4) 0.1750 ( 1, 4, 0) 0.1750 ( 2, 3) 0.1776 ( 2, 3, 0) 0.1776 ( 3, 1) 0.1801 ( 3, 1, 0) 0.1801 (-3, 3) 0.1812 (-3, 3, 0) 0.1812 (-1, 5) 0.1881 (-1, 5, 0) 0.1881 ( 0, 5) 0.1924 ( 0, 5, 0) 0.1924 ( 3, 2) 0.1993 ( 3, 2, 0) 0.1993 (-2, 5) 0.1999 (-2, 5, 0) 0.1999 (-3, 4) 0.2008 (-3, 4, 0) 0.2008 ( 2, 4) 0.2093 ( 0, 0, 1) 0.2079 1st contributing index with l=1 ( 1, 5) 0.2119 ( 2, 4, 0) 0.2093 (-4, 1) 0.2181 ( 0, 1, 1) 0.2114 (-4, 2) 0.2196 ( 1, 5, 0) 0.2119 ( 4, 0) 0.2234 ( 1, 0, 1) 0.2153 ( 3, 3) 0.2236 (-1, 1, 1) 0.2165 (-3, 5) 0.2254 (-4, 1, 0) 0.2181 (-4, 3) 0.2276 (-4, 2, 0) 0.2196 ( 4, 1) 0.2350 ( 1, 1, 1) 0.2209 (-4, 4) 0.2416 ( 0, 2, 1) 0.2217 ( 2, 5) 0.2430 ( 4, 0, 0) 0.2234 ( 3, 4) 0.2515 ( 3, 3, 0) 0.2236 ( 4, 2) 0.2520 (-1, 2, 1) 0.2244 (-4, 5) 0.2605 (-3, 5, 0) 0.2254 (-5, 2) 0.2727 (-4, 3, 0) 0.2276 ( 4, 3) 0.2733 ( 1, 2, 1) 0.2328 (-5, 1) 0.2733 ( 4, 1, 0) 0.2350 (-5, 3) 0.2775 (-2, 1, 1) 0.2351 ( 5, 0) 0.2793 ( 2, 0, 1) 0.2360 ( 3, 5) 0.2818 ( 0, 3, 1) 0.2378 (-5, 4) 0.2874 (-1, 3, 1) 0.2383 ( 5, 1) 0.2903 (-2, 2, 1) 0.2404 ( 4, 4) 0.2982 (-4, 4, 0) 0.2416 (-5, 5) 0.3019 ( 2, 5, 0) 0.2430 ( 5, 2) 0.3057 ( 2, 1, 1) 0.2431 ( 5, 3) 0.3251 ( 1, 3, 1) 0.2501 ( 4, 5) 0.3257 ( 3, 4, 0) 0.2515 ( 5, 4) 0.3476 (-2, 3, 1) 0.2516 ( 5, 5) 0.3727 ( 4, 2, 0) 0.2520
Run 169 photon energy
See: PDG-2014
photon energy = 6003.1936 eV wavelength = 2.0653 A wave number/Evald radius k = 1/lambda = 0.484187 1/A
Lookup table generator
def make_lookup_table(b1 = (1.,0.,0.), b2 = (0.,1.,0.), b3 = (0.,0.,1.),\ hmax=3, kmax=2, lmax=1, cdtype=np.float32,\ evald_rad=3, sigma_q=0.001, fout=None, bpq=None, bpomega=None, bpbeta=None) : """Makes lookup table - peak information as a function of angle beta and omega, where beta [deg] - fiber axis tilt, omega [deg] - fiber rotation around axis, For each crysal orientation (beta, gamma) lookup table contains info about lattice nodes closest to the Evald's sphere: # beta 20.00 omega 178.50 degree # index beta omega h k l dr [1/A] R(h,k,l) qv [1/A] qh [1/A] P(omega) 1078 20.00 178.50 1 -5 0 0.000262 0.211944 -0.016779 0.211221 0.964192 1078 20.00 178.50 0 -1 0 0.002470 0.038484 0.000343 0.038306 0.038686 1078 20.00 178.50 0 1 0 0.000582 0.038484 -0.000344 -0.038455 0.834544 where: index - orientation index (just an unique integer number) beta, omega [deg] - crystal orientation angles, h, k, l - Miller indeces dr [1/A] - distance between lattice node and Evald's sphere R(h,k,l) [1/A] - distance between nodes (h,k,l) and (0,0,0) qv, qh [1/A] - vertical and horizontal components of scattering vector q P(omega) - un-normalized probability (<1) evaluated for dr(omega) using sigma_q. File name is generated automatically with current time stamp like lut-cxif5315-r0169-2015-10-23T14:58:36.txt Input parameters: b1, b2, b3 - reciprocal lattice primitive vectors, hmax, kmax, lmax - lattice node indeces cdtype - data type for lattice node coordinates, evald_rad - Evald's sphere radius, sigma_q - expected q resolution, fout - open output file object, bpq, bpomega, bpbeta - binning parameters for q, omega, and beta NOTE: Units of b1, b2, b3, evald_rad, and sigma_q should be the same, for example [1/A]. Returns 2-d numpy array for image; summed for all beta probobility(omega vs. q_horizontal). """
Lookup table content
Metadata
# file name: lut-cxif5315-r0169-2015-10-23T16:03:06.txt # Triclinic crystal cell parameters: # a = 18.36 A # b = 26.65 A # c = 4.81 A # alpha = 90.00 deg # beta = 90.00 deg # gamma = 102.83 deg # 3-d space primitive vectors: # a1 = (18.36, 0.0, 0.0) # a2 = (5.917873795354449, 25.984635262829016, 0.0) # a3 = (0.0, 0.0, 4.81) # reciprocal space primitive vectors: # b1 = [ 0.05446623 -0.01240442 0. ] # b2 = [ 0. 0.03848428 0. ] # b3 = [ 0. 0. 0.20790021] # photon energy = 6003.1936 eV # wavelength = 2.0653 A # wave number/Evald radius k = 1/lambda = 0.484187 1/A # sigma_q = 0.000484 1/A (approximately pixel size/sample-to-detector distance = 100um/100mm) # 3*sigma_q = 0.001453 1/A
Data
# beta 20.00 omega 170.50 degree # index beta omega h k l dr [1/A] R(h,k,l) qv [1/A] qh [1/A] P(omega) 1062 20.00 170.50 0 4 0 0.000595 0.153937 -0.008679 -0.153596 0.469484 # beta 20.00 omega 171.00 degree EMPTY # beta 20.00 omega 171.50 degree EMPTY # beta 20.00 omega 172.00 degree # index beta omega h k l dr [1/A] R(h,k,l) qv [1/A] qh [1/A] P(omega) 1065 20.00 172.00 0 3 0 -0.001336 0.115453 -0.005511 -0.115473 0.022208 # beta 20.00 omega 172.50 degree # index beta omega h k l dr [1/A] R(h,k,l) qv [1/A] qh [1/A] P(omega) 1066 20.00 172.50 1 -4 0 0.001294 0.175032 -0.011014 0.174446 0.028162 1066 20.00 172.50 0 3 0 -0.000396 0.115453 -0.005158 -0.115384 0.715354
Plots
Constant fiber tilt angle β = 15°
Superposition of tilt angles β = 5, 25°
Comparison of these images show that tiny difference (doubled peaks for β = 5, 25°) is observed for large values of |qh|.
Comparison of data with triclinic lattice prediction
Re-tune geometry
Left- and right-hand side aro not quite symmetric. Re-tune geometry Geometry re-alignment
The same plots for 2015-11-06 geometry:
Now data peaks look symmetric relative to the center of image, but predicted peaks are misaligned relative to data.
Re-rune lattice parameters
Measurement of peak radial parameters. Two dash-curve circles have radial parameters 100 and 300 pixels, respectively.
Radial parameters of the brightest peaks/rings
R (pix) | h,k | R-Ratio | qH (1/Å) |
---|---|---|---|
71.4 | 0,1 | 1 | 0.0375 |
104.7 | 1,0 | 1.466 | 0.0550 |
114.3 | -1,1 | 1.601 | 0.0601 |
144.6 | 1,1/0,2 | 2.025 | 0.0725/0.0751 |
159.9 | -1,2 | 2.239 | 0.0837 |
210.1 | -2,1/2,0 | 2.942 | 0.1089/0.1100 |
330.1 | 4.622 | ||
400.4 | 5.608 | ||
Ceramic | rings | ||
438.7 | 6.144 | ||
626.1 | 8.769 | ||
784.6 | 10.989 |
The three peaks with smallest radial parameters gives gamma = 101.53°.
Evaluated lattice parameters:
# Triclinic crystal cell parameters: # a = 18.55 A # b = 27.19 A # c = 4.86 A # gamma = 78.47 deg or 101.53 # 3-d space primitive vectors: # a1 = (18.55, 0.0, 0.0) # a2 = (-5.435623727109098, 26.645523961582906, 0.0) # a3 = (0.0, 0.0, 4.8601) # reciprocal space primitive vectors: # b1 = [ 0.05390836 0.01099718 -0. ] # b2 = [ 0. 0.03752976 0. ] # b3 = [ 0. -0. 0.20575708]
Table of lattice node parameters sorted by radius
( h, k) R(h,k)[1/A] ( 0, 0) 0.0000 ( 0, 1) 0.0375 cut ( 1, 0) 0.0550 * (-1, 1) 0.0601 * ( 1, 1) 0.0725 ( 0, 2) 0.0751 (-1, 2) 0.0837 * ( 1, 2) 0.1015 (-2, 1) 0.1089 + ( 2, 0) 0.1100 + ( 0, 3) 0.1126 (-1, 3) 0.1150 (-2, 2) 0.1202 ( 2, 1) 0.1232 ( 1, 3) 0.1348 (-2, 3) 0.1408 ( 2, 2) 0.1451 (-1, 4) 0.1492 ( 0, 4) 0.1501 (-3, 1) 0.1618 ( 3, 0) 0.1651 (-3, 2) 0.1671 (-2, 4) 0.1675 ( 1, 4) 0.1699 ( 2, 3) 0.1724 ( 3, 1) 0.1764 (-3, 3) 0.1803 (-1, 5) 0.1847 ( 0, 5) 0.1876 ( 3, 2) 0.1945 (-2, 5) 0.1977 (-3, 4) 0.1997 ( 2, 4) 0.2031 ( 1, 5) 0.2058 (-4, 1) 0.2157 ( 3, 3) 0.2176 (-4, 2) 0.2179 ( 4, 0) 0.2201 (-1, 6) 0.2209 (-3, 5) 0.2238 ( 0, 6) 0.2252 (-4, 3) 0.2263
Indexing optimization
Optimization parameters
- sigma_q - in lookup table, works for omega; fraction of the wave number from 0.001 to 0.003
- sigma_q - in record processing, works for dq = r(node) - r(Evald); 1/A
- range of omega angle, ex: 0-180, 360 - stands for 360 points in the range from 0 to 180°
- range(s) of beta angle, usually used for two bands, small angles and symmetric with +180° offset.
beta ranges from 0 to 30° and from 0 to -30° produces the same results.
Figure of merit
Total number of selected events with ≥2 peaks 1915
Number of indexed events with ≥2 peaks, and distribution of events indexed with 1, 2, 3 peaks
Optimal parameters
- sigma_q= 0.002 in both cases
- range omega (0-180,360)
- ranges beta (0-50,11) and (180-230,11)
In run 169 this look-up table yields in 1171 events indexed for ≥2 peaks
Plots
Image of the look-up table for low range of beta angles, superposition of low and high ranges, projection of the lookup table on q_h
Comparison of the look-up table and data (geometry and lattice parameters are re-tuned)
Indexing
Script
proc-cxif5315-r0169-peaks-from-file-v2.py - loop over peaks in event and try to associate event peaks with a list of predicted for each crystal orientation. Most probable combination is saved in the file.
File record for event
There are three states for matching peaks in event indexing:
- MATCHED - peak is matched to predicted crystal node,
PEAK-NM - peak in data is not matched with any of predicted nodes,
NODE-NM - predicted crystal node is on Evald sphere, but peak in data is missing.
Event indexing table contains records for all peaks from data and for all predicted nodes from crystal orientation. Each record consists of three parts; status word, peak information, and orientation information. In case if orientation or peak information is missing it is replaced by zeros, like shown in example below.
STATE phi-fit beta-fit qh-fit qv-fit dqh[1/A] Exp Run time(sec) time(nsec) fiduc Evnum Reg Seg Row Col Npix Amax Atot rcent ccent rsigma csigma rmin rmax cmin cmax bkgd rms son imrow imcol x[um] y[um] r[um] phi[deg] index beta omega h k l dr[1/A] R(h,k,l) qv[1/A] qh[1/A] P(omega) NODE-NM -7.98 -12.45 0.000000 0.000000 0.000000 cxif5315 169 1424601179 232228024 105684 85184 N/A 0 0 0 0 0.0 0.0 0.0 0.0 0.00 0.00 0 0 0 0 0.00 0.00 0.00 0 0 0 0 0 0.00 230 180.00 114.50 3 -4 0 0.001658 0.199684 0.000000 0.199336 0.230902 PEAK-NM -7.98 -12.45 0.083921 0.000014 0.000000 cxif5315 169 1424601179 232228024 105684 85184 EQU 1 72 44 31 220.9 1976.6 73.4 42.7 2.49 1.45 70 80 39 46 16.23 19.99 10.23 559 730 17471 2112 17598 6.89 0 0.00 0.00 0 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 MATCHED -7.98 -12.45 0.059485 -0.000022 0.000448 cxif5315 169 1424601179 232228024 105684 85184 EQU 1 119 39 59 1293.5 11106.4 119.0 39.5 1.69 1.50 112 125 36 45 17.81 31.87 40.03 564 683 12306 1551 12403 7.18 230 180.00 114.50 1 -1 0 0.001936 0.060084 0.000000 0.059933 0.135565 MATCHED -7.98 -12.45 -0.166810 -0.000001 0.000288 cxif5315 169 1424601179 232228024 105684 85184 EQU 16 121 101 88 276.3 6888.4 120.0 103.1 2.52 2.93 115 127 98 110 39.18 36.32 6.53 637 247 -35645 -6412 36217 -169.80 230 180.00 114.50 -3 2 0 0.000051 0.167107 0.000000 -0.167098 0.998636
This information for all events goes in the file with name like peak-idx-cxif5315-r0169-2015-11-13T17:04:37.txt.
Result presenter
cxif5315/proc-cxif5315-r0169-idx-file.py
reads file obtained in previous section using
from pyimgalgos.TDFileContainer import TDFileContainer from pyimgalgos.TDMatchRecord import TDMatchRecord
and generates summary tables/images with results as listed below.
Crystal in h-k space
k : -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 h=-4: 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 h=-3: 0.0000 0.0000 0.0000 0.0000 0.0000 0.0222 0.0618 0.0000 1.0000 0.0075 0.0680 0.0000 0.0000 h=-2: 0.0000 0.0000 0.0156 0.0158 0.0013 0.0000 0.2334 0.6190 0.0272 0.0000 0.0078 0.3472 0.0000 h=-1: 0.0000 0.0070 0.0395 0.0000 0.0023 0.0000 0.1424 0.2158 0.3511 0.0036 0.0273 0.0019 0.0000 h= 0: 0.0000 0.0015 0.0131 0.0135 0.0031 0.0000 0.4409 0.0000 0.0290 0.0600 0.0389 0.0015 0.0000 h= 1: 0.0000 0.0000 0.0319 0.0000 0.3228 0.1522 0.1187 0.0038 0.0000 0.0000 0.0173 0.0089 0.0000 h= 2: 0.0000 0.3036 0.0131 0.0011 0.0043 0.5837 0.2267 0.0000 0.0039 0.0000 0.0000 0.0000 0.0000 h= 3: 0.0000 0.0000 0.0708 0.0049 0.7698 0.0000 0.0699 0.0172 0.0014 0.0035 0.0000 0.0000 0.0000 h= 4: 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Crystal in reciprocal space
Try peak_finder_v3
We try to use peak_finder_v3
with parameters (see Peak finders for more detail. ).
alg_arc = PyAlgos(windows=winds_arc, mask=mask_arc, pbits=0) alg_arc.set_peak_selection_pars(npix_min=5, npix_max=100, amax_thr=0, atot_thr=2000, son_min=6) alg_equ = PyAlgos(windows=winds_equ, mask=mask_equ, pbits=0) alg_equ.set_peak_selection_pars(npix_min=5, npix_max=100, amax_thr=0, atot_thr=2000, son_min=6) ... peaks_arc = alg_arc.peak_finder_v3(nda, rank=5, r0=5, dr=0.05) peaks_equ = alg_equ.peak_finder_v3(nda, rank=5, r0=5, dr=0.05)
It finds approximately 3× more (seed) peaks with higher atot_thr
than peak_finder_v2.
This makes event selection more complicated and in result the same matching algorithm finds 4× less peaks.
References
- Crystal structure, Bravais lattice, Crystal system, Primitive cell, Lattice constant - 3-d lattice
- Reciprocal lattice, Ewald's sphere, Surface diffraction, Miller index - reciprocal space
- PDG-2014
- X-ray crystallography, Bragg's law, Fiber diffraction
- my not on units for q and reciprocal space