CrystalParameters¶
This module belong to LaueTools package. It gathers procedures to define crystal lattice parameters and strain calculations
Main authors are JS Micha, O. Robach, S. Tardif June 2019
-
LaueTools.CrystalParameters.
GrainParameter_from_Material
(key_material, dictmaterials={'Al': ['Al', [4.05, 4.05, 4.05, 90, 90, 90], 'fcc'], 'Al2Cu': ['Al2Cu', [6.063, 6.063, 4.872, 90, 90, 90], 'no'], 'Al2O3': ['Al2O3', [4.785, 4.785, 12.991, 90, 90, 120], 'Al2O3'], 'Al2O3_all': ['Al2O3_all', [4.785, 4.785, 12.991, 90, 90, 120], 'no'], 'AlN': ['AlN', [3.11, 3.11, 4.98, 90.0, 90.0, 120.0], 'wurtzite'], 'Au': ['Au', [4.078, 4.078, 4.078, 90, 90, 90], 'fcc'], 'CCDL1949': ['CCDL1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'h+k=2n'], 'CdHgTe': ['CdHgTe', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'dia'], 'CdHgTe_fcc': ['CdHgTe_fcc', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'fcc'], 'CdTe': ['CdTe', [6.487, 6.487, 6.487, 90, 90, 90], 'fcc'], 'CdTeDiagB': ['CdTeDiagB', [4.5721, 7.9191, 11.1993, 90, 90, 90], 'no'], 'Crocidolite': ['Crocidolite', [9.811, 18.013, 5.326, 90, 103.68, 90], 'no'], 'Crocidolite_2': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 103.6, 90], 'no'], 'Crocidolite_2_72deg': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 76.4, 90], 'no'], 'Crocidolite_small': ['Crocidolite_small', [3.2533333333333334, 5.976666666666667, 1.7833333333333332, 90, 103.6, 90], 'no'], 'Crocidolite_whittaker_1949': ['Crocidolite_whittaker_1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'no'], 'Cu': ['Cu', [3.6, 3.6, 3.6, 90, 90, 90], 'fcc'], 'Cu6Sn5_monoclinic': ['Cu6Sn5_monoclinic', [11.02, 7.28, 9.827, 90, 98.84, 90], 'no'], 'Cu6Sn5_tetra': ['Cu6Sn5_tetra', [3.608, 3.608, 5.037, 90, 90, 90], 'no'], 'DIA': ['DIA', [5.0, 5.0, 5.0, 90, 90, 90], 'dia'], 'DIAs': ['DIAs', [3.56683, 3.56683, 3.56683, 90, 90, 90], 'dia'], 'DarinaMolecule': ['DarinaMolecule', [9.4254, 13.5004, 13.8241, 61.83, 84.555, 75.231], 'no'], 'FCC': ['FCC', [5.0, 5.0, 5.0, 90, 90, 90], 'fcc'], 'Fe': ['Fe', [2.856, 2.856, 2.856, 90, 90, 90], 'bcc'], 'Fe2Ta': ['Fe2Ta', [4.83, 4.83, 0.788, 90, 90, 120], 'no'], 'FeAl': ['FeAl', [5.871, 5.871, 5.871, 90, 90, 90], 'fcc'], 'GaAs': ['GaAs', [5.65325, 5.65325, 5.65325, 90, 90, 90], 'dia'], 'GaN': ['GaN', [3.189, 3.189, 5.185, 90, 90, 120], 'wurtzite'], 'GaN_all': ['GaN_all', [3.189, 3.189, 5.185, 90, 90, 120], 'no'], 'Ge': ['Ge', [5.6575, 5.6575, 5.6575, 90, 90, 90], 'dia'], 'Ge_compressedhydro': ['Ge_compressedhydro', [5.64, 5.64, 5.64, 90, 90, 90.0], 'dia'], 'Ge_s': ['Ge_s', [5.6575, 5.6575, 5.6575, 90, 90, 89.5], 'dia'], 'Getest': ['Getest', [5.6575, 5.6575, 5.6574, 90, 90, 90], 'dia'], 'Hematite': ['Hematite', [5.03459, 5.03459, 13.7533, 90, 90, 120], 'no'], 'In': ['In', [3.2517, 3.2517, 4.9459, 90, 90, 90], 'h+k+l=2n'], 'InGaN': ['InGaN', [3.3609999999999998, 3.3609999999999998, 5.439, 90, 90, 120], 'wurtzite'], 'InN': ['InN', [3.533, 3.533, 5.693, 90, 90, 120], 'wurtzite'], 'Magnetite': ['Magnetite', [8.391, 8.391, 8.391, 90, 90, 90], 'dia'], 'Magnetite_fcc': ['Magnetite_fcc', [8.391, 8.391, 8.391, 90, 90, 90], 'fcc'], 'Magnetite_sc': ['Magnetite_sc', [8.391, 8.391, 8.391, 90, 90, 90], 'no'], 'Nd45': ['Nd45', [5.4884, 5.4884, 5.4884, 90, 90, 90], 'fcc'], 'Ni': ['Ni', [3.5238, 3.5238, 3.5238, 90, 90, 90], 'fcc'], 'NiO': ['NiO', [2.96, 2.96, 7.23, 90, 90, 120], 'no'], 'NiTi': ['NiTi', [3.5506, 3.5506, 3.5506, 90, 90, 90], 'fcc'], 'SC': ['SC', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'SC5': ['SC5', [5.0, 5.0, 5.0, 90, 90, 90], 'no'], 'SC7': ['SC7', [7.0, 7.0, 7.0, 90, 90, 90], 'no'], 'Sb': ['Sb', [4.3, 4.3, 11.3, 90, 90, 120], 'no'], 'Si': ['Si', [5.4309, 5.4309, 5.4309, 90, 90, 90], 'dia'], 'Sn': ['Sn', [5.83, 5.83, 3.18, 90, 90, 90], 'h+k+l=2n'], 'Ti': ['Ti', [2.95, 2.95, 4.68, 90, 90, 120], 'no'], 'Ti2AlN': ['Ti2AlN', [2.989, 2.989, 13.624, 90, 90, 120], 'Ti2AlN'], 'Ti2AlN_w': ['Ti2AlN_w', [2.989, 2.989, 13.624, 90, 90, 120], 'wurtzite'], 'Ti_beta': ['Ti_beta', [3.2587, 3.2587, 3.2587, 90, 90, 90], 'bcc'], 'Ti_omega': ['Ti_omega', [4.6085, 4.6085, 2.8221, 90, 90, 120], 'no'], 'Ti_s': ['Ti_s', [3.0, 3.0, 4.7, 90.5, 89.5, 120.5], 'no'], 'UO2': ['UO2', [5.47, 5.47, 5.47, 90, 90, 90], 'fcc'], 'VO2M1': ['VO2M1', [5.75175, 4.52596, 5.38326, 90.0, 122.6148, 90.0], 'VO2_mono'], 'VO2M2': ['VO2M2', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'no'], 'VO2R': ['VO2R', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'rutile'], 'W': ['W', [3.1652, 3.1652, 3.1652, 90, 90, 90], 'bcc'], 'YAG': ['YAG', [9.2, 9.2, 9.2, 90, 90, 90], 'no'], 'ZnO': ['ZnO', [3.252, 3.252, 5.213, 90, 90, 120], 'wurtzite'], 'ZrO2': ['ZrO2', [5.1505, 5.2116, 5.3173, 90, 99.23, 90], 'VO2_mono'], 'ZrO2Y2O3': ['ZrO2Y2O3', [5.1378, 5.1378, 5.1378, 90, 90, 90], 'fcc'], 'alphaQuartz': ['alphaQuartz', [4.9, 4.9, 5.4, 90, 90, 120], 'no'], 'betaQuartznew': ['betaQuartznew', [4.9, 4.9, 6.685, 90, 90, 120], 'no'], 'bigpro': ['bigpro', [112.0, 112.0, 136.0, 90, 90, 90], 'no'], 'dummy': ['dummy', [4.0, 8.0, 2.0, 90, 90, 90], 'no'], 'ferrydrite': ['ferrydrite', [2.96, 2.96, 9.4, 90, 90, 120], 'no'], 'hexagonal': ['hexagonal', [1.0, 1.0, 3.0, 90, 90, 120.0], 'no'], 'inputB': ['inputB', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'quartz_alpha': ['quartz_alpha', [4.913, 4.913, 5.404, 90, 90, 120], 'no'], 'smallpro': ['smallpro', [20.0, 4.8, 49.0, 90, 90, 90], 'no'], 'test_reference': ['test_reference', [3.2, 4.5, 5.2, 83, 92.0, 122], 'wurtzite'], 'test_solution': ['test_solution', [3.252, 4.48, 5.213, 83.2569, 92.125478, 122.364], 'wurtzite'], 'testindex': ['testindex', [2.0, 1.0, 4.0, 90, 90, 90], 'no'], 'testindex2': ['testindex2', [2.0, 1.0, 4.0, 75, 90, 120], 'no']})[source]¶ create grain parameters list for the Laue pattern simulation
Can handle material defined in dictionary by four elements instead of 6 lattice parameters
Parameters: key_material (string) – material or structure label Returns: grain (4 elements list), contains_U (boolean)
-
LaueTools.CrystalParameters.
Prepare_Grain
(key_material, OrientMatrix, force_extinction=None, dictmaterials={'Al': ['Al', [4.05, 4.05, 4.05, 90, 90, 90], 'fcc'], 'Al2Cu': ['Al2Cu', [6.063, 6.063, 4.872, 90, 90, 90], 'no'], 'Al2O3': ['Al2O3', [4.785, 4.785, 12.991, 90, 90, 120], 'Al2O3'], 'Al2O3_all': ['Al2O3_all', [4.785, 4.785, 12.991, 90, 90, 120], 'no'], 'AlN': ['AlN', [3.11, 3.11, 4.98, 90.0, 90.0, 120.0], 'wurtzite'], 'Au': ['Au', [4.078, 4.078, 4.078, 90, 90, 90], 'fcc'], 'CCDL1949': ['CCDL1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'h+k=2n'], 'CdHgTe': ['CdHgTe', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'dia'], 'CdHgTe_fcc': ['CdHgTe_fcc', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'fcc'], 'CdTe': ['CdTe', [6.487, 6.487, 6.487, 90, 90, 90], 'fcc'], 'CdTeDiagB': ['CdTeDiagB', [4.5721, 7.9191, 11.1993, 90, 90, 90], 'no'], 'Crocidolite': ['Crocidolite', [9.811, 18.013, 5.326, 90, 103.68, 90], 'no'], 'Crocidolite_2': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 103.6, 90], 'no'], 'Crocidolite_2_72deg': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 76.4, 90], 'no'], 'Crocidolite_small': ['Crocidolite_small', [3.2533333333333334, 5.976666666666667, 1.7833333333333332, 90, 103.6, 90], 'no'], 'Crocidolite_whittaker_1949': ['Crocidolite_whittaker_1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'no'], 'Cu': ['Cu', [3.6, 3.6, 3.6, 90, 90, 90], 'fcc'], 'Cu6Sn5_monoclinic': ['Cu6Sn5_monoclinic', [11.02, 7.28, 9.827, 90, 98.84, 90], 'no'], 'Cu6Sn5_tetra': ['Cu6Sn5_tetra', [3.608, 3.608, 5.037, 90, 90, 90], 'no'], 'DIA': ['DIA', [5.0, 5.0, 5.0, 90, 90, 90], 'dia'], 'DIAs': ['DIAs', [3.56683, 3.56683, 3.56683, 90, 90, 90], 'dia'], 'DarinaMolecule': ['DarinaMolecule', [9.4254, 13.5004, 13.8241, 61.83, 84.555, 75.231], 'no'], 'FCC': ['FCC', [5.0, 5.0, 5.0, 90, 90, 90], 'fcc'], 'Fe': ['Fe', [2.856, 2.856, 2.856, 90, 90, 90], 'bcc'], 'Fe2Ta': ['Fe2Ta', [4.83, 4.83, 0.788, 90, 90, 120], 'no'], 'FeAl': ['FeAl', [5.871, 5.871, 5.871, 90, 90, 90], 'fcc'], 'GaAs': ['GaAs', [5.65325, 5.65325, 5.65325, 90, 90, 90], 'dia'], 'GaN': ['GaN', [3.189, 3.189, 5.185, 90, 90, 120], 'wurtzite'], 'GaN_all': ['GaN_all', [3.189, 3.189, 5.185, 90, 90, 120], 'no'], 'Ge': ['Ge', [5.6575, 5.6575, 5.6575, 90, 90, 90], 'dia'], 'Ge_compressedhydro': ['Ge_compressedhydro', [5.64, 5.64, 5.64, 90, 90, 90.0], 'dia'], 'Ge_s': ['Ge_s', [5.6575, 5.6575, 5.6575, 90, 90, 89.5], 'dia'], 'Getest': ['Getest', [5.6575, 5.6575, 5.6574, 90, 90, 90], 'dia'], 'Hematite': ['Hematite', [5.03459, 5.03459, 13.7533, 90, 90, 120], 'no'], 'In': ['In', [3.2517, 3.2517, 4.9459, 90, 90, 90], 'h+k+l=2n'], 'InGaN': ['InGaN', [3.3609999999999998, 3.3609999999999998, 5.439, 90, 90, 120], 'wurtzite'], 'InN': ['InN', [3.533, 3.533, 5.693, 90, 90, 120], 'wurtzite'], 'Magnetite': ['Magnetite', [8.391, 8.391, 8.391, 90, 90, 90], 'dia'], 'Magnetite_fcc': ['Magnetite_fcc', [8.391, 8.391, 8.391, 90, 90, 90], 'fcc'], 'Magnetite_sc': ['Magnetite_sc', [8.391, 8.391, 8.391, 90, 90, 90], 'no'], 'Nd45': ['Nd45', [5.4884, 5.4884, 5.4884, 90, 90, 90], 'fcc'], 'Ni': ['Ni', [3.5238, 3.5238, 3.5238, 90, 90, 90], 'fcc'], 'NiO': ['NiO', [2.96, 2.96, 7.23, 90, 90, 120], 'no'], 'NiTi': ['NiTi', [3.5506, 3.5506, 3.5506, 90, 90, 90], 'fcc'], 'SC': ['SC', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'SC5': ['SC5', [5.0, 5.0, 5.0, 90, 90, 90], 'no'], 'SC7': ['SC7', [7.0, 7.0, 7.0, 90, 90, 90], 'no'], 'Sb': ['Sb', [4.3, 4.3, 11.3, 90, 90, 120], 'no'], 'Si': ['Si', [5.4309, 5.4309, 5.4309, 90, 90, 90], 'dia'], 'Sn': ['Sn', [5.83, 5.83, 3.18, 90, 90, 90], 'h+k+l=2n'], 'Ti': ['Ti', [2.95, 2.95, 4.68, 90, 90, 120], 'no'], 'Ti2AlN': ['Ti2AlN', [2.989, 2.989, 13.624, 90, 90, 120], 'Ti2AlN'], 'Ti2AlN_w': ['Ti2AlN_w', [2.989, 2.989, 13.624, 90, 90, 120], 'wurtzite'], 'Ti_beta': ['Ti_beta', [3.2587, 3.2587, 3.2587, 90, 90, 90], 'bcc'], 'Ti_omega': ['Ti_omega', [4.6085, 4.6085, 2.8221, 90, 90, 120], 'no'], 'Ti_s': ['Ti_s', [3.0, 3.0, 4.7, 90.5, 89.5, 120.5], 'no'], 'UO2': ['UO2', [5.47, 5.47, 5.47, 90, 90, 90], 'fcc'], 'VO2M1': ['VO2M1', [5.75175, 4.52596, 5.38326, 90.0, 122.6148, 90.0], 'VO2_mono'], 'VO2M2': ['VO2M2', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'no'], 'VO2R': ['VO2R', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'rutile'], 'W': ['W', [3.1652, 3.1652, 3.1652, 90, 90, 90], 'bcc'], 'YAG': ['YAG', [9.2, 9.2, 9.2, 90, 90, 90], 'no'], 'ZnO': ['ZnO', [3.252, 3.252, 5.213, 90, 90, 120], 'wurtzite'], 'ZrO2': ['ZrO2', [5.1505, 5.2116, 5.3173, 90, 99.23, 90], 'VO2_mono'], 'ZrO2Y2O3': ['ZrO2Y2O3', [5.1378, 5.1378, 5.1378, 90, 90, 90], 'fcc'], 'alphaQuartz': ['alphaQuartz', [4.9, 4.9, 5.4, 90, 90, 120], 'no'], 'betaQuartznew': ['betaQuartznew', [4.9, 4.9, 6.685, 90, 90, 120], 'no'], 'bigpro': ['bigpro', [112.0, 112.0, 136.0, 90, 90, 90], 'no'], 'dummy': ['dummy', [4.0, 8.0, 2.0, 90, 90, 90], 'no'], 'ferrydrite': ['ferrydrite', [2.96, 2.96, 9.4, 90, 90, 120], 'no'], 'hexagonal': ['hexagonal', [1.0, 1.0, 3.0, 90, 90, 120.0], 'no'], 'inputB': ['inputB', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'quartz_alpha': ['quartz_alpha', [4.913, 4.913, 5.404, 90, 90, 120], 'no'], 'smallpro': ['smallpro', [20.0, 4.8, 49.0, 90, 90, 90], 'no'], 'test_reference': ['test_reference', [3.2, 4.5, 5.2, 83, 92.0, 122], 'wurtzite'], 'test_solution': ['test_solution', [3.252, 4.48, 5.213, 83.2569, 92.125478, 122.364], 'wurtzite'], 'testindex': ['testindex', [2.0, 1.0, 4.0, 90, 90, 90], 'no'], 'testindex2': ['testindex2', [2.0, 1.0, 4.0, 75, 90, 120], 'no']})[source]¶ Constructor of the grain (crystal) parameters for Laue pattern simulation
if in key_material definition (see dict_Materials) orient matrix is missing (i.e. only lattice parameter are input)
Parameters: key_material (str) – material label then list parameter will consider the provided value of the optional OrientMatrix argument
Parameters: force_extinction (str) – None, use default extinction rules, otherwise use other extinction correspondoing to the label
-
LaueTools.CrystalParameters.
AngleBetweenNormals
(HKL1s, HKL2s, Gstar)[source]¶ compute pairwise angles (in degrees) between reflections or lattice plane normals of two sets according to unit cell metrics Gstar
Parameters: - HKL1s – list of [H1,K1,L1]
- HKL2s – list of [H2,K2,L2]
- Gstar – 3*3 matrix corresponding to reciprocal metric tensor of unit cell (as provided by Gstar_from_directlatticeparams())
Returns: array of pairwise angles between reflections
-
LaueTools.CrystalParameters.
FilterHarmonics_2
(hkl, return_indices_toremove=0)[source]¶ keep only hkl 3d vectors that are representative of direction nh,nk,nl for any h,k,l signed integers
It removes only parallel vector but KEEPs antiparallel vectors (vec , -n vec) with n>0
Parameters: - hkl – array of 3d hkl indices
- return_indices_toremove – 1, returns indices of element in hkl that have been removed
-
LaueTools.CrystalParameters.
calc_B_RR
(latticeparameters, directspace=1, setvolume=False)[source]¶ - Calculate B0 matrix (columns = vectors a*,b*,c*) from direct (real) space lattice parameters (directspace=1)
- Calculate a matrix (columns = vectors a,b,c) from direct (real) space lattice parameters (directspace=0)
\(\boldsymbol q_{ortho}=B_0 {\bf G^*}\) where \({\bf G^*}=h{\bf a^*}+k{\bf b^*}+l{\bf c^*}\)
Parameters: - latticeparameters –
- [a,b,c, alpha, beta, gamma] (angles are in degrees) if directspace=1
- [a*,b*,c*, alpha*, beta*, gamma*] (angles are in degrees) if directspace=0
- directspace –
- 1 (default) converts (reciprocal) direct lattice parameters
- to (direct) reciprocal space calculates “B” matrix in the reciprocal space of input latticeparameters
- 0 converts (reciprocal) direct lattice parameters to (reciprocal) direct space
- calculates “B” matrix in same space of input latticeparameters
- setvolume –
- False, sets direct unit cell volume to the true volume from lattice parameters
- 1, sets direct unit cell volume to 1
- ’a**3’, sets direct unit cell volume to a**3
- ’b**3’, sets direct unit cell volume to b**3
- ’c**3’, sets direct unit cell volume to c**3
Returns: B Matrix (triangular up) from crystal (reciprocal space) frame to orthonormal frame matrix
Return type: numpy array
- B matrix is used in q=U B G* formula or
- as B0 in q= (UB) B0 G*
after Busing Levy, Acta Crysta 22 (1967), p 457
\[\begin{split}\left( \begin{matrix} a^* & b^*\cos \gamma^* & c^*\cos beta^*\\ 0 & b^*\sin \gamma^* &-c^*\sin \beta^*\cos \alpha\\ 0 & 0 & c^*\sin \beta^*\sin \alpha\\ \end{matrix} \right)\end{split}\]with
\[\cos(\alpha)=(\cos \beta^*\cos \gamma^*-\cos \alpha^*)/(\sin \beta^*\sin \gamma^*)\]and
\[c^* \sin \beta^* \sin \alpha = 1/c\]
-
LaueTools.CrystalParameters.
DeviatoricStrain_LatticeParams
(newUBmat, latticeparams, constantlength='a')[source]¶ Computes deviatoric strain and new direct (real) lattice parameters from matrix newUBmat (rotation and deformation) considering that one lattice length is chosen to be constant
Zero strain corresponds to reference state of input lattice parameters
Parameters: - newUBmat – (3x3) matrix operator including rotation and deformation
- latticeparams – 6 lattice parameters [a,b,c,:math:alpha, beta, gamma] in Angstrom and degrees
- constantlength – ‘a’,’b’, or ‘c’ to set one length according to the value in latticeparams
Returns: - 3x3 deviatoric strain tensor)
- lattice_parameter_direct_strain (direct (real) lattice parameters)
Return type: 3x3 numpy array, 6 elements list
Note
- q = newUBmat . B0 . G* where B0 (triangular up matrix) comes from lattice parameters input.
- equivalently, q = UBstar_s . G*
-
LaueTools.CrystalParameters.
VolumeCell
(latticeparameters)[source]¶ Computes unit cell volume from lattice parameters (either real or reciprocal)
Parameters: latticeparameters – 6 lattice parameters Returns: scalar volume
-
LaueTools.CrystalParameters.
VolumeCell
(latticeparameters)[source] Computes unit cell volume from lattice parameters (either real or reciprocal)
Parameters: latticeparameters – 6 lattice parameters Returns: scalar volume
-
LaueTools.CrystalParameters.
matrix_to_rlat
(mat, angles_in_deg=1)[source]¶ Returns RECIPROCAL lattice parameters of the unit cell a*,b*,c* in columns of mat
Parameters: mat – matrix where columns are respectively a*,b*,c* coordinates in orthonormal frame Returns: [a*,b*,c*, alpha*, beta*, gamma*] (angles are in degrees) Note
Reciprocal lattice parameters are contained in UB matrix : q = mat G*
Laue Pattern Simulation¶
Core module to compute Laue Pattern in various geometry
Main author is J. S. Micha: micha [at] esrf [dot] fr
version July 2019 from LaueTools package hosted in
http://sourceforge.net/projects/lauetools/
or
https://gitlab.esrf.fr/micha/lauetools
-
LaueTools.lauecore.
Quicklist
(OrientMatrix, ReciprocBasisVectors, listRSnorm, lambdamin, verbose=0)[source]¶ return 6 indices min and max boundary values for each Miller index h, k, l to be contained in the largest Ewald Sphere.
Parameters: - OrientMatrix – orientation matrix (3*3 matrix)
- ReciprocBasisVectors – list of the three vectors a*,b*,c* in the lab frame before rotation with OrientMatrix
- listRSnorm – : list of the three reciprocal space lengthes of a*,b*,c*
- lambdamin – : lambdamin (in Angstrom) corresponding to energy max
Returns: [[hmin,hmax],[kmin,kmax],[lmin,lmax]]
-
LaueTools.lauecore.
genHKL_np
(listn, Extinc)[source]¶ Generate all Miller indices hkl from indices limits given by listn and taking into account for systematic exctinctions
Parameters: - listn ([[hmin,hmax],[kmin,kmax],[lmin,lmax]]) – Miller indices limits (warning: these lists are used in python range (last index is excluded))
- Extinc (string) – label corresponding to systematic exctinction rules on h k and l miller indics such as (‘fcc’, ‘bcc’, ‘dia’, …) or ‘no’ for any rules
Returns: array of [h,k,l]
Note
node [0,0,0] is excluded
-
LaueTools.lauecore.
getLaueSpots
(wavelmin, wavelmax, crystalsParams, linestowrite, kf_direction='Z>0', OpeningAngleCollection=22.0, fastcompute=0, ResolutionAngstrom=False, fileOK=1, verbose=1, dictmaterials=None)[source]¶ Compute Qxyz vectors and corresponding HKL miller indices for nodes in recicprocal space that can be measured for the given detection geometry and energy bandpass configuration.
Parameters: - wavelmin – smallest wavelength in Angstrom
- wavelmax – largest wavelength in Angstrom
- crystalsParams –
list of SingleCrystalParams, each of them being a list of 4 elements for crystal orientation and strain properties:
- [0](array): is the B matrix a*,b*,c* vectors are expressed in column
- in LaueTools frame in reciprocal angstrom units
- [1](str): peak Extinction rules (‘no’,’fcc’,’dia’, etc…)
- [2](array): orientation matrix
- [3](str): key for material element
- kf_direction –
string defining the average geometry, mean value of exit scattered vector: ‘Z>0’ top spots
’Y>0’ one side spots (towards hutch door)
’Y<0’ other side spots
’X>0’ transmission spots
’X<0’ backreflection spots
- fastcompute –
- 1, compute reciprocal space (RS) vector BUT NOT the Miller indices
- 0, returns both RS vectors (normalised) and Miller indices
- ResolutionAngstrom –
- scalar, smallest interplanar distance ordered in crystal in angstrom.
- None, all reflections will be calculated that can be time-consuming for large unit cell
- linestowrite – list of [string] that can be write in file or display in stdout. Example: [[“”]] or [[“******”],[“lauetools”]]
Returns: - list of [Qx,Qy,Qz]s for each grain, list of [H,K,L]s for each grain (fastcompute = 0)
- list of [Qx,Qy,Qz]s for each grain, None (fastcompute = 1)
Caution
This method doesn’t create spot instances.
This is done in filterLaueSpots with fastcompute = 0
Caution
finer selection of nodes : on camera , without harmonics can be done later with filterLaueSpots()
Note
lauetools laboratory frame is in this case: x// ki (center of ewald sphere has neagtive x component) z perp to x and belonging to the plane defined by x and dd vectors (where dd vector is the smallest vector joining sample impact point and points on CCD plane) y is perpendicular to x and z
-
LaueTools.lauecore.
create_spot
(pos_vec, miller, detectordistance, allattributes=False, pixelsize=0.08056640625, dim=(2048, 2048))[source]¶ From reciprocal space position and 3 miller indices create a spot instance (on top camera geometry)
Parameters: - pos_vec (list of 3 float) – 3D vector
- miller – list of 3 miller indices
- detectordistance – approximate distance detector sample (to compute complementary spots attributes)
- allattributes – False or 0 not to compute complementary spot attributes
- allattributes – boolean
Returns: spot instance
Note
spot.Qxyz is a vector expressed in lauetools frame
X along x-ray and Z towards CCD when CCD on top and y towards experimental hutch door
-
LaueTools.lauecore.
create_spot_np
(Qxyz, miller, detectordistance, allattributes=False, pixelsize=0.08056640625, dim=(2048, 2048))[source]¶ From reciprocal space position and 3 miller indices create a spot instance (on top camera geometry)
Parameters: - pos_vec (list of 3 float) – 3D vector
- miller – list of 3 miller indices
- detectordistance – approximate distance detector sample (to compute complementary spots attributes)
- allattributes – False or 0 not to compute complementary spot attributes
- allattributes – boolean
Returns: spot instance
Note
spot.Qxyz is a vector expressed in lauetools frame
X along x-ray and Z towards CCD when CCD on top and y towards experimental hutch door
-
LaueTools.lauecore.
filterLaueSpots
(vec_and_indices, HarmonicsRemoval=1, fastcompute=0, kf_direction='Z>0', fileOK=0, detectordistance=70.0, detectordiameter=165.0, pixelsize=0.08056640625, dim=(2048, 2048), linestowrite=[['']])[source]¶ Calculates list of grains spots on camera and without harmonics and on CCD camera from [[spots grain 0],[spots grain 1],etc] => returns [[spots grain 0],[spots grain 1],etc] w / o harmonics and on camera CCD
Parameters: - vec_and_indices –
list of elements corresponding to 1 grain, each element is composed by * [0] array of vector
- [1] array of indices
- HarmonicsRemoval – 1, removes harmonics according to their miller indices (only for fastcompute = 0)
- fastcompute –
- 1, outputs a list for each grain of 2theta spots and a list for each grain of chi spots
- (HARMONICS spots are still HERE!)
- 0, outputs list for each grain of spots with
- kf_direction (string) – label for detection geometry (CCD plane with respect to the incoming beam and sample)
Returns: - list of spot instances if fastcompute=0
- 2theta, chi if fastcompute=1
Note
- USED IMPORTANTLY in lauecore.SimulateResults lauecore.SimulateLaue
- USED in matchingrate.AngularResidues
- USED in ParametricLaueSimulator.dosimulation_parametric
- USED in AutoindexationGUI.OnSimulate_S3, DetectorCalibration.Reckon_2pts, and others
Todo
add dim in create_spot in various geometries
- vec_and_indices –
-
LaueTools.lauecore.
get2ThetaChi_geometry
(oncam_vec, oncam_HKL, detectordistance=70.0, pixelsize=0.08056640625, dim=(2048, 2048), kf_direction='Z>0')[source]¶ computes list of spots instances from oncam_vec (q 3D vectors) and oncam_HKL (miller indices 3D vectors)
Parameters: - oncam_vec (array with 3D elements (shape = (n,3))) – q vectors [qx,qy,qz] (corresponding to kf collected on camera)
- dim (list or tuple of 2 integers) – CCD frame dimensions (nb pixels, nb pixels)
- detectordistance – approximate distance detector sample
- detectordistance – float or integer
- pixelsize (float) – pixel size in mm
Param: kf_direction : label for detection geometry (CCD plane with respect to the incoming beam and sample)
Type: kf_direction: string
Returns: list of spot instances
Note
USED in lauecore.filterLaueSpots
Todo
- to be replaced by something else not using spot class
- put this function in LaueGeometry module ?
-
LaueTools.lauecore.
calcSpots_fromHKLlist
(UB, B0, HKL, dictCCD)[source]¶ computes all Laue Spots properties on 2D detector from a list of hkl (given structure by B0 matrix, orientation by UB matrix, and detector geometry by dictCCD)
Parameters: - UB (3x3 array (or list)) – orientation matrix (rotation -and if any- strain)
- B0 (3x3 array (or list)) – initial a*,b*,c* reciprocal unit cell basis vector in Lauetools frame (x// ki))
- HKL (array with shape = (n,3)) – array of Miller indices
- dictCCD – dictionnary of CCD properties (with key ‘CCDparam’, ‘pixelsize’,’dim’) for ‘ccdparam’ 5 CCD calibration parameters [dd,xcen,ycen,xbet,xgam], pixelsize in mm, and (dim1, dim2)
- dictCCD – dict object
Returns: list of arrays H, K, L, Qx, Qy, Qz, X, Y, twthe, chi, Energy
Fundamental equation \({\bf q} = UB*B0 * {\bf G^*}\) with \({\bf G^*} = h{\bf a^*}+k{\bf b^*}+l{\bf c^*}\)
Note
USED in DetectorCalibration.OnWriteResults, and PlotRefineGUI.onWriteFitFile
-
LaueTools.lauecore.
SimulateLaue
(grain, emin, emax, detectorparameters, kf_direction='Z>0', ResolutionAngstrom=False, removeharmonics=0, pixelsize=0.08056640625, dim=(2048, 2048), detectordiameter=None, force_extinction=None, dictmaterials={'Al': ['Al', [4.05, 4.05, 4.05, 90, 90, 90], 'fcc'], 'Al2Cu': ['Al2Cu', [6.063, 6.063, 4.872, 90, 90, 90], 'no'], 'Al2O3': ['Al2O3', [4.785, 4.785, 12.991, 90, 90, 120], 'Al2O3'], 'Al2O3_all': ['Al2O3_all', [4.785, 4.785, 12.991, 90, 90, 120], 'no'], 'AlN': ['AlN', [3.11, 3.11, 4.98, 90.0, 90.0, 120.0], 'wurtzite'], 'Au': ['Au', [4.078, 4.078, 4.078, 90, 90, 90], 'fcc'], 'CCDL1949': ['CCDL1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'h+k=2n'], 'CdHgTe': ['CdHgTe', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'dia'], 'CdHgTe_fcc': ['CdHgTe_fcc', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'fcc'], 'CdTe': ['CdTe', [6.487, 6.487, 6.487, 90, 90, 90], 'fcc'], 'CdTeDiagB': ['CdTeDiagB', [4.5721, 7.9191, 11.1993, 90, 90, 90], 'no'], 'Crocidolite': ['Crocidolite', [9.811, 18.013, 5.326, 90, 103.68, 90], 'no'], 'Crocidolite_2': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 103.6, 90], 'no'], 'Crocidolite_2_72deg': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 76.4, 90], 'no'], 'Crocidolite_small': ['Crocidolite_small', [3.2533333333333334, 5.976666666666667, 1.7833333333333332, 90, 103.6, 90], 'no'], 'Crocidolite_whittaker_1949': ['Crocidolite_whittaker_1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'no'], 'Cu': ['Cu', [3.6, 3.6, 3.6, 90, 90, 90], 'fcc'], 'Cu6Sn5_monoclinic': ['Cu6Sn5_monoclinic', [11.02, 7.28, 9.827, 90, 98.84, 90], 'no'], 'Cu6Sn5_tetra': ['Cu6Sn5_tetra', [3.608, 3.608, 5.037, 90, 90, 90], 'no'], 'DIA': ['DIA', [5.0, 5.0, 5.0, 90, 90, 90], 'dia'], 'DIAs': ['DIAs', [3.56683, 3.56683, 3.56683, 90, 90, 90], 'dia'], 'DarinaMolecule': ['DarinaMolecule', [9.4254, 13.5004, 13.8241, 61.83, 84.555, 75.231], 'no'], 'FCC': ['FCC', [5.0, 5.0, 5.0, 90, 90, 90], 'fcc'], 'Fe': ['Fe', [2.856, 2.856, 2.856, 90, 90, 90], 'bcc'], 'Fe2Ta': ['Fe2Ta', [4.83, 4.83, 0.788, 90, 90, 120], 'no'], 'FeAl': ['FeAl', [5.871, 5.871, 5.871, 90, 90, 90], 'fcc'], 'GaAs': ['GaAs', [5.65325, 5.65325, 5.65325, 90, 90, 90], 'dia'], 'GaN': ['GaN', [3.189, 3.189, 5.185, 90, 90, 120], 'wurtzite'], 'GaN_all': ['GaN_all', [3.189, 3.189, 5.185, 90, 90, 120], 'no'], 'Ge': ['Ge', [5.6575, 5.6575, 5.6575, 90, 90, 90], 'dia'], 'Ge_compressedhydro': ['Ge_compressedhydro', [5.64, 5.64, 5.64, 90, 90, 90.0], 'dia'], 'Ge_s': ['Ge_s', [5.6575, 5.6575, 5.6575, 90, 90, 89.5], 'dia'], 'Getest': ['Getest', [5.6575, 5.6575, 5.6574, 90, 90, 90], 'dia'], 'Hematite': ['Hematite', [5.03459, 5.03459, 13.7533, 90, 90, 120], 'no'], 'In': ['In', [3.2517, 3.2517, 4.9459, 90, 90, 90], 'h+k+l=2n'], 'InGaN': ['InGaN', [3.3609999999999998, 3.3609999999999998, 5.439, 90, 90, 120], 'wurtzite'], 'InN': ['InN', [3.533, 3.533, 5.693, 90, 90, 120], 'wurtzite'], 'Magnetite': ['Magnetite', [8.391, 8.391, 8.391, 90, 90, 90], 'dia'], 'Magnetite_fcc': ['Magnetite_fcc', [8.391, 8.391, 8.391, 90, 90, 90], 'fcc'], 'Magnetite_sc': ['Magnetite_sc', [8.391, 8.391, 8.391, 90, 90, 90], 'no'], 'Nd45': ['Nd45', [5.4884, 5.4884, 5.4884, 90, 90, 90], 'fcc'], 'Ni': ['Ni', [3.5238, 3.5238, 3.5238, 90, 90, 90], 'fcc'], 'NiO': ['NiO', [2.96, 2.96, 7.23, 90, 90, 120], 'no'], 'NiTi': ['NiTi', [3.5506, 3.5506, 3.5506, 90, 90, 90], 'fcc'], 'SC': ['SC', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'SC5': ['SC5', [5.0, 5.0, 5.0, 90, 90, 90], 'no'], 'SC7': ['SC7', [7.0, 7.0, 7.0, 90, 90, 90], 'no'], 'Sb': ['Sb', [4.3, 4.3, 11.3, 90, 90, 120], 'no'], 'Si': ['Si', [5.4309, 5.4309, 5.4309, 90, 90, 90], 'dia'], 'Sn': ['Sn', [5.83, 5.83, 3.18, 90, 90, 90], 'h+k+l=2n'], 'Ti': ['Ti', [2.95, 2.95, 4.68, 90, 90, 120], 'no'], 'Ti2AlN': ['Ti2AlN', [2.989, 2.989, 13.624, 90, 90, 120], 'Ti2AlN'], 'Ti2AlN_w': ['Ti2AlN_w', [2.989, 2.989, 13.624, 90, 90, 120], 'wurtzite'], 'Ti_beta': ['Ti_beta', [3.2587, 3.2587, 3.2587, 90, 90, 90], 'bcc'], 'Ti_omega': ['Ti_omega', [4.6085, 4.6085, 2.8221, 90, 90, 120], 'no'], 'Ti_s': ['Ti_s', [3.0, 3.0, 4.7, 90.5, 89.5, 120.5], 'no'], 'UO2': ['UO2', [5.47, 5.47, 5.47, 90, 90, 90], 'fcc'], 'VO2M1': ['VO2M1', [5.75175, 4.52596, 5.38326, 90.0, 122.6148, 90.0], 'VO2_mono'], 'VO2M2': ['VO2M2', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'no'], 'VO2R': ['VO2R', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'rutile'], 'W': ['W', [3.1652, 3.1652, 3.1652, 90, 90, 90], 'bcc'], 'YAG': ['YAG', [9.2, 9.2, 9.2, 90, 90, 90], 'no'], 'ZnO': ['ZnO', [3.252, 3.252, 5.213, 90, 90, 120], 'wurtzite'], 'ZrO2': ['ZrO2', [5.1505, 5.2116, 5.3173, 90, 99.23, 90], 'VO2_mono'], 'ZrO2Y2O3': ['ZrO2Y2O3', [5.1378, 5.1378, 5.1378, 90, 90, 90], 'fcc'], 'alphaQuartz': ['alphaQuartz', [4.9, 4.9, 5.4, 90, 90, 120], 'no'], 'betaQuartznew': ['betaQuartznew', [4.9, 4.9, 6.685, 90, 90, 120], 'no'], 'bigpro': ['bigpro', [112.0, 112.0, 136.0, 90, 90, 90], 'no'], 'dummy': ['dummy', [4.0, 8.0, 2.0, 90, 90, 90], 'no'], 'ferrydrite': ['ferrydrite', [2.96, 2.96, 9.4, 90, 90, 120], 'no'], 'hexagonal': ['hexagonal', [1.0, 1.0, 3.0, 90, 90, 120.0], 'no'], 'inputB': ['inputB', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'quartz_alpha': ['quartz_alpha', [4.913, 4.913, 5.404, 90, 90, 120], 'no'], 'smallpro': ['smallpro', [20.0, 4.8, 49.0, 90, 90, 90], 'no'], 'test_reference': ['test_reference', [3.2, 4.5, 5.2, 83, 92.0, 122], 'wurtzite'], 'test_solution': ['test_solution', [3.252, 4.48, 5.213, 83.2569, 92.125478, 122.364], 'wurtzite'], 'testindex': ['testindex', [2.0, 1.0, 4.0, 90, 90, 90], 'no'], 'testindex2': ['testindex2', [2.0, 1.0, 4.0, 75, 90, 120], 'no']})[source]¶ - Computes Laue Pattern spots positions, scattering angles, miller indices
- for a SINGLE grain or Xtal
Parameters: - grain – crystal parameters made of a 4 elements list
- emin – minimum bandpass energy (keV)
- emax – maximum bandpass energy (keV)
- removeharmonics –
- 1, removes harmonics spots and keep fondamental spots (or reciprocal direction)
- (with lowest Miller indices)
- 0 keep all spots (including harmonics)
Returns: single grain data: Twicetheta, Chi, Miller_ind, posx, posy, Energy
Todo
To update to accept kf_direction not only in reflection geometry
Note
USED in detectorCalibration…simulate_theo for non routine geometry (ie except Z>0 (reflection top) X>0 (transmission)
-
LaueTools.lauecore.
SimulateLaue_full_np
(grain, emin, emax, detectorparameters, kf_direction='Z>0', ResolutionAngstrom=False, removeharmonics=0, pixelsize=0.08056640625, dim=(2048, 2048), detectordiameter=None, force_extinction=None, dictmaterials={'Al': ['Al', [4.05, 4.05, 4.05, 90, 90, 90], 'fcc'], 'Al2Cu': ['Al2Cu', [6.063, 6.063, 4.872, 90, 90, 90], 'no'], 'Al2O3': ['Al2O3', [4.785, 4.785, 12.991, 90, 90, 120], 'Al2O3'], 'Al2O3_all': ['Al2O3_all', [4.785, 4.785, 12.991, 90, 90, 120], 'no'], 'AlN': ['AlN', [3.11, 3.11, 4.98, 90.0, 90.0, 120.0], 'wurtzite'], 'Au': ['Au', [4.078, 4.078, 4.078, 90, 90, 90], 'fcc'], 'CCDL1949': ['CCDL1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'h+k=2n'], 'CdHgTe': ['CdHgTe', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'dia'], 'CdHgTe_fcc': ['CdHgTe_fcc', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'fcc'], 'CdTe': ['CdTe', [6.487, 6.487, 6.487, 90, 90, 90], 'fcc'], 'CdTeDiagB': ['CdTeDiagB', [4.5721, 7.9191, 11.1993, 90, 90, 90], 'no'], 'Crocidolite': ['Crocidolite', [9.811, 18.013, 5.326, 90, 103.68, 90], 'no'], 'Crocidolite_2': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 103.6, 90], 'no'], 'Crocidolite_2_72deg': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 76.4, 90], 'no'], 'Crocidolite_small': ['Crocidolite_small', [3.2533333333333334, 5.976666666666667, 1.7833333333333332, 90, 103.6, 90], 'no'], 'Crocidolite_whittaker_1949': ['Crocidolite_whittaker_1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'no'], 'Cu': ['Cu', [3.6, 3.6, 3.6, 90, 90, 90], 'fcc'], 'Cu6Sn5_monoclinic': ['Cu6Sn5_monoclinic', [11.02, 7.28, 9.827, 90, 98.84, 90], 'no'], 'Cu6Sn5_tetra': ['Cu6Sn5_tetra', [3.608, 3.608, 5.037, 90, 90, 90], 'no'], 'DIA': ['DIA', [5.0, 5.0, 5.0, 90, 90, 90], 'dia'], 'DIAs': ['DIAs', [3.56683, 3.56683, 3.56683, 90, 90, 90], 'dia'], 'DarinaMolecule': ['DarinaMolecule', [9.4254, 13.5004, 13.8241, 61.83, 84.555, 75.231], 'no'], 'FCC': ['FCC', [5.0, 5.0, 5.0, 90, 90, 90], 'fcc'], 'Fe': ['Fe', [2.856, 2.856, 2.856, 90, 90, 90], 'bcc'], 'Fe2Ta': ['Fe2Ta', [4.83, 4.83, 0.788, 90, 90, 120], 'no'], 'FeAl': ['FeAl', [5.871, 5.871, 5.871, 90, 90, 90], 'fcc'], 'GaAs': ['GaAs', [5.65325, 5.65325, 5.65325, 90, 90, 90], 'dia'], 'GaN': ['GaN', [3.189, 3.189, 5.185, 90, 90, 120], 'wurtzite'], 'GaN_all': ['GaN_all', [3.189, 3.189, 5.185, 90, 90, 120], 'no'], 'Ge': ['Ge', [5.6575, 5.6575, 5.6575, 90, 90, 90], 'dia'], 'Ge_compressedhydro': ['Ge_compressedhydro', [5.64, 5.64, 5.64, 90, 90, 90.0], 'dia'], 'Ge_s': ['Ge_s', [5.6575, 5.6575, 5.6575, 90, 90, 89.5], 'dia'], 'Getest': ['Getest', [5.6575, 5.6575, 5.6574, 90, 90, 90], 'dia'], 'Hematite': ['Hematite', [5.03459, 5.03459, 13.7533, 90, 90, 120], 'no'], 'In': ['In', [3.2517, 3.2517, 4.9459, 90, 90, 90], 'h+k+l=2n'], 'InGaN': ['InGaN', [3.3609999999999998, 3.3609999999999998, 5.439, 90, 90, 120], 'wurtzite'], 'InN': ['InN', [3.533, 3.533, 5.693, 90, 90, 120], 'wurtzite'], 'Magnetite': ['Magnetite', [8.391, 8.391, 8.391, 90, 90, 90], 'dia'], 'Magnetite_fcc': ['Magnetite_fcc', [8.391, 8.391, 8.391, 90, 90, 90], 'fcc'], 'Magnetite_sc': ['Magnetite_sc', [8.391, 8.391, 8.391, 90, 90, 90], 'no'], 'Nd45': ['Nd45', [5.4884, 5.4884, 5.4884, 90, 90, 90], 'fcc'], 'Ni': ['Ni', [3.5238, 3.5238, 3.5238, 90, 90, 90], 'fcc'], 'NiO': ['NiO', [2.96, 2.96, 7.23, 90, 90, 120], 'no'], 'NiTi': ['NiTi', [3.5506, 3.5506, 3.5506, 90, 90, 90], 'fcc'], 'SC': ['SC', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'SC5': ['SC5', [5.0, 5.0, 5.0, 90, 90, 90], 'no'], 'SC7': ['SC7', [7.0, 7.0, 7.0, 90, 90, 90], 'no'], 'Sb': ['Sb', [4.3, 4.3, 11.3, 90, 90, 120], 'no'], 'Si': ['Si', [5.4309, 5.4309, 5.4309, 90, 90, 90], 'dia'], 'Sn': ['Sn', [5.83, 5.83, 3.18, 90, 90, 90], 'h+k+l=2n'], 'Ti': ['Ti', [2.95, 2.95, 4.68, 90, 90, 120], 'no'], 'Ti2AlN': ['Ti2AlN', [2.989, 2.989, 13.624, 90, 90, 120], 'Ti2AlN'], 'Ti2AlN_w': ['Ti2AlN_w', [2.989, 2.989, 13.624, 90, 90, 120], 'wurtzite'], 'Ti_beta': ['Ti_beta', [3.2587, 3.2587, 3.2587, 90, 90, 90], 'bcc'], 'Ti_omega': ['Ti_omega', [4.6085, 4.6085, 2.8221, 90, 90, 120], 'no'], 'Ti_s': ['Ti_s', [3.0, 3.0, 4.7, 90.5, 89.5, 120.5], 'no'], 'UO2': ['UO2', [5.47, 5.47, 5.47, 90, 90, 90], 'fcc'], 'VO2M1': ['VO2M1', [5.75175, 4.52596, 5.38326, 90.0, 122.6148, 90.0], 'VO2_mono'], 'VO2M2': ['VO2M2', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'no'], 'VO2R': ['VO2R', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'rutile'], 'W': ['W', [3.1652, 3.1652, 3.1652, 90, 90, 90], 'bcc'], 'YAG': ['YAG', [9.2, 9.2, 9.2, 90, 90, 90], 'no'], 'ZnO': ['ZnO', [3.252, 3.252, 5.213, 90, 90, 120], 'wurtzite'], 'ZrO2': ['ZrO2', [5.1505, 5.2116, 5.3173, 90, 99.23, 90], 'VO2_mono'], 'ZrO2Y2O3': ['ZrO2Y2O3', [5.1378, 5.1378, 5.1378, 90, 90, 90], 'fcc'], 'alphaQuartz': ['alphaQuartz', [4.9, 4.9, 5.4, 90, 90, 120], 'no'], 'betaQuartznew': ['betaQuartznew', [4.9, 4.9, 6.685, 90, 90, 120], 'no'], 'bigpro': ['bigpro', [112.0, 112.0, 136.0, 90, 90, 90], 'no'], 'dummy': ['dummy', [4.0, 8.0, 2.0, 90, 90, 90], 'no'], 'ferrydrite': ['ferrydrite', [2.96, 2.96, 9.4, 90, 90, 120], 'no'], 'hexagonal': ['hexagonal', [1.0, 1.0, 3.0, 90, 90, 120.0], 'no'], 'inputB': ['inputB', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'quartz_alpha': ['quartz_alpha', [4.913, 4.913, 5.404, 90, 90, 120], 'no'], 'smallpro': ['smallpro', [20.0, 4.8, 49.0, 90, 90, 90], 'no'], 'test_reference': ['test_reference', [3.2, 4.5, 5.2, 83, 92.0, 122], 'wurtzite'], 'test_solution': ['test_solution', [3.252, 4.48, 5.213, 83.2569, 92.125478, 122.364], 'wurtzite'], 'testindex': ['testindex', [2.0, 1.0, 4.0, 90, 90, 90], 'no'], 'testindex2': ['testindex2', [2.0, 1.0, 4.0, 75, 90, 120], 'no']})[source]¶ - Compute Laue Pattern spots positions, scattering angles, miller indices
- for a SINGLE grain or Xtal using numpy vectorization
Parameters: - grain – crystal parameters in a 4 elements list
- emin – minimum bandpass energy (keV)
- emax – maximum bandpass energy (keV)
- removeharmonics – 1, remove harmonics spots and keep fondamental spots (with lowest Miller indices)
Returns: single grain data: Twicetheta, Chi, Miller_ind, posx, posy, Energy
Todo
update to accept kf_direction not only in reflection geometry
Note
USED in detectorCalibration…simulate_theo for routine geometry Z>0 (reflection top) X>0 (transmission)
-
LaueTools.lauecore.
SimulateResult
(grain, emin, emax, simulparameters, fastcompute=1, ResolutionAngstrom=False, dictmaterials={'Al': ['Al', [4.05, 4.05, 4.05, 90, 90, 90], 'fcc'], 'Al2Cu': ['Al2Cu', [6.063, 6.063, 4.872, 90, 90, 90], 'no'], 'Al2O3': ['Al2O3', [4.785, 4.785, 12.991, 90, 90, 120], 'Al2O3'], 'Al2O3_all': ['Al2O3_all', [4.785, 4.785, 12.991, 90, 90, 120], 'no'], 'AlN': ['AlN', [3.11, 3.11, 4.98, 90.0, 90.0, 120.0], 'wurtzite'], 'Au': ['Au', [4.078, 4.078, 4.078, 90, 90, 90], 'fcc'], 'CCDL1949': ['CCDL1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'h+k=2n'], 'CdHgTe': ['CdHgTe', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'dia'], 'CdHgTe_fcc': ['CdHgTe_fcc', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'fcc'], 'CdTe': ['CdTe', [6.487, 6.487, 6.487, 90, 90, 90], 'fcc'], 'CdTeDiagB': ['CdTeDiagB', [4.5721, 7.9191, 11.1993, 90, 90, 90], 'no'], 'Crocidolite': ['Crocidolite', [9.811, 18.013, 5.326, 90, 103.68, 90], 'no'], 'Crocidolite_2': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 103.6, 90], 'no'], 'Crocidolite_2_72deg': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 76.4, 90], 'no'], 'Crocidolite_small': ['Crocidolite_small', [3.2533333333333334, 5.976666666666667, 1.7833333333333332, 90, 103.6, 90], 'no'], 'Crocidolite_whittaker_1949': ['Crocidolite_whittaker_1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'no'], 'Cu': ['Cu', [3.6, 3.6, 3.6, 90, 90, 90], 'fcc'], 'Cu6Sn5_monoclinic': ['Cu6Sn5_monoclinic', [11.02, 7.28, 9.827, 90, 98.84, 90], 'no'], 'Cu6Sn5_tetra': ['Cu6Sn5_tetra', [3.608, 3.608, 5.037, 90, 90, 90], 'no'], 'DIA': ['DIA', [5.0, 5.0, 5.0, 90, 90, 90], 'dia'], 'DIAs': ['DIAs', [3.56683, 3.56683, 3.56683, 90, 90, 90], 'dia'], 'DarinaMolecule': ['DarinaMolecule', [9.4254, 13.5004, 13.8241, 61.83, 84.555, 75.231], 'no'], 'FCC': ['FCC', [5.0, 5.0, 5.0, 90, 90, 90], 'fcc'], 'Fe': ['Fe', [2.856, 2.856, 2.856, 90, 90, 90], 'bcc'], 'Fe2Ta': ['Fe2Ta', [4.83, 4.83, 0.788, 90, 90, 120], 'no'], 'FeAl': ['FeAl', [5.871, 5.871, 5.871, 90, 90, 90], 'fcc'], 'GaAs': ['GaAs', [5.65325, 5.65325, 5.65325, 90, 90, 90], 'dia'], 'GaN': ['GaN', [3.189, 3.189, 5.185, 90, 90, 120], 'wurtzite'], 'GaN_all': ['GaN_all', [3.189, 3.189, 5.185, 90, 90, 120], 'no'], 'Ge': ['Ge', [5.6575, 5.6575, 5.6575, 90, 90, 90], 'dia'], 'Ge_compressedhydro': ['Ge_compressedhydro', [5.64, 5.64, 5.64, 90, 90, 90.0], 'dia'], 'Ge_s': ['Ge_s', [5.6575, 5.6575, 5.6575, 90, 90, 89.5], 'dia'], 'Getest': ['Getest', [5.6575, 5.6575, 5.6574, 90, 90, 90], 'dia'], 'Hematite': ['Hematite', [5.03459, 5.03459, 13.7533, 90, 90, 120], 'no'], 'In': ['In', [3.2517, 3.2517, 4.9459, 90, 90, 90], 'h+k+l=2n'], 'InGaN': ['InGaN', [3.3609999999999998, 3.3609999999999998, 5.439, 90, 90, 120], 'wurtzite'], 'InN': ['InN', [3.533, 3.533, 5.693, 90, 90, 120], 'wurtzite'], 'Magnetite': ['Magnetite', [8.391, 8.391, 8.391, 90, 90, 90], 'dia'], 'Magnetite_fcc': ['Magnetite_fcc', [8.391, 8.391, 8.391, 90, 90, 90], 'fcc'], 'Magnetite_sc': ['Magnetite_sc', [8.391, 8.391, 8.391, 90, 90, 90], 'no'], 'Nd45': ['Nd45', [5.4884, 5.4884, 5.4884, 90, 90, 90], 'fcc'], 'Ni': ['Ni', [3.5238, 3.5238, 3.5238, 90, 90, 90], 'fcc'], 'NiO': ['NiO', [2.96, 2.96, 7.23, 90, 90, 120], 'no'], 'NiTi': ['NiTi', [3.5506, 3.5506, 3.5506, 90, 90, 90], 'fcc'], 'SC': ['SC', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'SC5': ['SC5', [5.0, 5.0, 5.0, 90, 90, 90], 'no'], 'SC7': ['SC7', [7.0, 7.0, 7.0, 90, 90, 90], 'no'], 'Sb': ['Sb', [4.3, 4.3, 11.3, 90, 90, 120], 'no'], 'Si': ['Si', [5.4309, 5.4309, 5.4309, 90, 90, 90], 'dia'], 'Sn': ['Sn', [5.83, 5.83, 3.18, 90, 90, 90], 'h+k+l=2n'], 'Ti': ['Ti', [2.95, 2.95, 4.68, 90, 90, 120], 'no'], 'Ti2AlN': ['Ti2AlN', [2.989, 2.989, 13.624, 90, 90, 120], 'Ti2AlN'], 'Ti2AlN_w': ['Ti2AlN_w', [2.989, 2.989, 13.624, 90, 90, 120], 'wurtzite'], 'Ti_beta': ['Ti_beta', [3.2587, 3.2587, 3.2587, 90, 90, 90], 'bcc'], 'Ti_omega': ['Ti_omega', [4.6085, 4.6085, 2.8221, 90, 90, 120], 'no'], 'Ti_s': ['Ti_s', [3.0, 3.0, 4.7, 90.5, 89.5, 120.5], 'no'], 'UO2': ['UO2', [5.47, 5.47, 5.47, 90, 90, 90], 'fcc'], 'VO2M1': ['VO2M1', [5.75175, 4.52596, 5.38326, 90.0, 122.6148, 90.0], 'VO2_mono'], 'VO2M2': ['VO2M2', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'no'], 'VO2R': ['VO2R', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'rutile'], 'W': ['W', [3.1652, 3.1652, 3.1652, 90, 90, 90], 'bcc'], 'YAG': ['YAG', [9.2, 9.2, 9.2, 90, 90, 90], 'no'], 'ZnO': ['ZnO', [3.252, 3.252, 5.213, 90, 90, 120], 'wurtzite'], 'ZrO2': ['ZrO2', [5.1505, 5.2116, 5.3173, 90, 99.23, 90], 'VO2_mono'], 'ZrO2Y2O3': ['ZrO2Y2O3', [5.1378, 5.1378, 5.1378, 90, 90, 90], 'fcc'], 'alphaQuartz': ['alphaQuartz', [4.9, 4.9, 5.4, 90, 90, 120], 'no'], 'betaQuartznew': ['betaQuartznew', [4.9, 4.9, 6.685, 90, 90, 120], 'no'], 'bigpro': ['bigpro', [112.0, 112.0, 136.0, 90, 90, 90], 'no'], 'dummy': ['dummy', [4.0, 8.0, 2.0, 90, 90, 90], 'no'], 'ferrydrite': ['ferrydrite', [2.96, 2.96, 9.4, 90, 90, 120], 'no'], 'hexagonal': ['hexagonal', [1.0, 1.0, 3.0, 90, 90, 120.0], 'no'], 'inputB': ['inputB', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'quartz_alpha': ['quartz_alpha', [4.913, 4.913, 5.404, 90, 90, 120], 'no'], 'smallpro': ['smallpro', [20.0, 4.8, 49.0, 90, 90, 90], 'no'], 'test_reference': ['test_reference', [3.2, 4.5, 5.2, 83, 92.0, 122], 'wurtzite'], 'test_solution': ['test_solution', [3.252, 4.48, 5.213, 83.2569, 92.125478, 122.364], 'wurtzite'], 'testindex': ['testindex', [2.0, 1.0, 4.0, 90, 90, 90], 'no'], 'testindex2': ['testindex2', [2.0, 1.0, 4.0, 75, 90, 120], 'no']})[source]¶ Simulates 2theta chi of Laue Pattern spots for ONE SINGLE grain
Parameters: - grain – crystal parameters in a 4 elements list
- emin – minimum bandpass energy (keV)
- emax – maximum bandpass energy (keV)
Returns: 2theta, chi
Warning
Need of approximate detector distance and diameter to restrict simulation to a limited solid angle
Note
- USED: in AutoindexationGUI.OnStart, LaueToolsGUI.OnCheckOrientationMatrix
- USED also IndexingImageMatching, lauecore.SimulateLaue_merge
2D Detection Geometry¶
Module of lauetools project to compute Laue spots position on CCD camera. It handles detection and source geometry.
Warning
The frame (LT2) considered in this package (with y axis parallel to the incoming beam) in not the LaueTools frame (for which x is parallel to the incoming beam)
JS Micha June 2019
- Vectors Definitions
- q momentum transfer vector from resp. incoming and outgoing wave vector ki and kf, \(q=kf-ki\)
- When a Laue spot exists, q is equal to the one node of the reciprocal lattice given by G* vector
- G* is perpendicular to atomic planes defined by the three Miller indices h,k,l
- such as G***=h**a* + k**b*** +l**c*** where a*, b*, and c* are the unit cell lattice basis vectors.
- kf: scattered beam vector whose corresponding unit vector is uf
- ki incoming beam vector, ui corresponding unit vector
- Laboratory Frame LT2
- I: origin
- z vertical up perpendicular to CCD plane (top camera geometry)
- y along X-ray horizontal
- x towards wall behind horizontal
- O: origin of pixel CCD frame in detecting plane
- j // ui incoming beam unit vector
- z axis is defined by the CCD camera position. z axis is perpendicular to CCD plane
- such as IO belongs to the plane Iyz
- bet: angle between IO and k
- i**= **j**^**k (when entering the BM32 hutch i is approximately towards the wall
- (in CCD on top geometry and beam coming from the right)
- M: point lying in CCD plane corresponding to Laue spot
- uf is the unit vector relative to vector IM
kf is also a vector collinear to IM with a length of R=1/wavelength=E/12.398 [keV] with wavelength and Energy of the corresponding bragg’s reflections.
I is the point from which calibration parameters (CCD position) are deduced (from a perfectly known crystal structure Laue pattern) Iprime is an other source of emission (posI or offset in functions)
\(2 \theta\) is the scattering angle between ui and uf, i.e.
\(\cos(2 \theta)=u_i.u_f\)
Energy= 12.398* q**2/(2* q.**ui**)=12.398 * q**2/ (-2 sin theta)
- Calibration parameters (CCD position and detection geometry)
- calib: list of the 5 calibration parameters [dd,xcen,ycen,xbet,xgam]
- dd: norm of IO [mm]
- xcen,ycen [pixel unit]: pixels values in CCD frame of point O with respect to Oprime where
- Oprime is the origin of CCD pixels frame (at a corner of the CCD array)
- xbet: angle between IO and k [degree]
- xgam: azimutal rotation angle around z axis. Angle between CCD array axes
- and (i,**j**) after rotation by xbet [degree].
sample frame
Origin is I and unit frame vectors (is, js, ks) are derived from absolute frame by the rotation (axis= - i, angle= wo) where wo is the angle between js and j
-
LaueTools.LaueGeometry.
calc_uflab
(xcam, ycam, detectorplaneparameters, offset=0, returnAngles=1, verbose=0, pixelsize=0.08056640625, rectpix=0, kf_direction='Z>0')[source]¶ Computes unit vector \({\bf u_f}=\frac{\bf k_f}{\|k_f\|}\) in laboratory frame of scattered beam \(k_f\) (angle scattering angles 2theta and chi) from X, Y pixel Laue spot position
Unit vector uf correspond to normalized kf vector: q = kf - ki from lists of X and Y Laue spots pixels positions on detector
Parameters: - xcam (list of floats) – list of pixel X position
- ycam (list of floats) – list of pixel Y position
- detectorplaneparameters – list of 5 calibration parameters
- offset – float, offset in position along incoming beam of source of scattered rays if positive: offset in sample depth units: mm
Returns: - if returnAngles=1 : twicetheta, chi (default)
- if returnAngles!=1 : uflab, IMlab
-
LaueTools.LaueGeometry.
calc_uflab_trans
(xcam, ycam, calib, returnAngles=1, verbose=0, pixelsize=0.08056640625, rectpix=0)[source]¶ compute \(2 \theta\) and \(\chi\) scattering angles or uf and kf vectors from lists of X and Y Laue spots positions in TRANSMISSION geometry
Parameters: - xcam (list of floats) – list of pixel X position
- ycam (list of floats) – list of pixel Y position
- calib – list of 5 calibration parameters
Returns: - if returnAngles=1 : twicetheta, chi (default)
- if returnAngles!=1 : uflab, IMlab
# TODO: add offset like in reflection geometry
-
LaueTools.LaueGeometry.
calc_xycam
(uflab, calib, energy=0, offset=None, verbose=0, returnIpM=False, pixelsize=0.08056640625, rectpix=0)[source]¶ Computes Laue spots position x and y in pixels units in CCD frame from unit scattered vector uf expressed in Lab. frame
computes coordinates of point M on CCD from point source and uflab. Point Ip (source Iprime of x-ray scattered beams) (for each Laue spot uflab is the unit vector of IpM) Point Ip is shifted by offset (if not None) from the default point I (used to calibrate the CCD camera and 2theta chi determination)
th0 (theta in degrees) Energy (energy in keV)
Parameters: - uflab (list or array (length must > 1)) – list or array of [qx,qy,qz] (q vector)
- calib (list of floats) – list 5 detector calibration parameters
- offset (list of floats ([x,y,z])) – offset (in mm) in the scattering source (origin of Laue spots) position with respect to the position which has been used for the calibration of the CCD detector plane. Offset is positive when in the same direction as incident beam (i.e. in sample depth) (incident beam direction remains constant)
Returns: - xcam: list of pixel X coordinates
- ycam: list of pixel Y coordinates
- theta: list half scattering angle “theta” (in degree)
- optionally energy=1: add in output list of spot energies (in keV)
- if returnIpM and offset not None: return list of vectors IprimeM
-
LaueTools.LaueGeometry.
calc_xycam_transmission
(uflab, calib, energy=0, offset=None, verbose=0, returnIpM=False, pixelsize=0.08056640625, rectpix=0)[source]¶ Computes Laue spots position x and y in pixels units (in CCD frame) from scattering vector q
As calc_xycam() but in TRANSMISSION geometry
-
LaueTools.LaueGeometry.
uflab_from2thetachi
(twicetheta, chi, verbose=0)[source]¶ Computes \({\bf u_f}\) vectors coordinates in lauetools LT2 frame from \({\bf k_f}\) scattering angles \(2 \theta\) and \(2 \chi\) angles
Parameters: - twicetheta – (list) \(2 \theta\) angle(s) ( in degree)
- chi – (list) \(2 \chi\) angle(s) ( in degree)
Returns: list of {bf u_f} = [\(uf_x,uf_y,uf_z\)]
Return type:
-
LaueTools.LaueGeometry.
from_twchi_to_qunit
(Angles)[source]¶ from kf 2theta, chi to q unit in LaueTools frame (xx// ki) q=kf-ki returns array = (all x’s, all y’s, all z’s)
Angles in degrees !! Angles[0] 2theta deg values, Angles[1] chi values in deg
this is the inverse function of from_qunit_to_twchi(), useful to check it
-
LaueTools.LaueGeometry.
from_twchi_to_q
(Angles)[source]¶ From kf 2theta,chi to q (arbitrary lenght) in lab frame (xx// ki) q=kf-ki returns array = (all qx’s, all qy’s, all qz’s)
Angles in degrees !! Angles[0] 2theta deg values, Angles[1] chi values in deg
-
LaueTools.LaueGeometry.
from_qunit_to_twchi
(arrayXYZ, labXMAS=0)[source]¶ Returns 2theta chi from a q unit vector (defining a direction) expressed in LaueTools frame (xx// ki) q=kf-ki
\[\begin{split}\left [ \begin{matrix} -\sin \theta \\ \cos \theta \sin \chi \\ \cos \theta \cos \chi \end{matrix} \right ]\end{split}\]Note
in LaueTools frame
\[ \begin{align}\begin{aligned}\begin{split}kf = \left [ \begin{matrix} \cos 2\theta \\ \sin 2\theta \sin \chi \\ \sin 2\theta \cos \chi \end{matrix} \right ]\end{split}\\\begin{split}q = 2 \sin \theta \left [ \begin{matrix} -\sin \theta \\ \cos \theta \sin \chi \\ \cos \theta \cos \chi \end{matrix} \right ]\end{split}\end{aligned}\end{align} \]In LT2 Frame labXMAS=1
\[ \begin{align}\begin{aligned}\begin{split}kf = \left [ \begin{matrix} \sin 2\theta \sin \chi \\ \cos 2\theta \\ \sin 2\theta \cos \chi \end{matrix} \right ]\end{split}\\\begin{split}q = 2 \sin \theta \left [ \begin{matrix} \cos \theta \sin \chi \\ -\sin \theta \\ \cos \theta \cos \chi \end{matrix} \right ]\end{split}\end{aligned}\end{align} \]
-
LaueTools.LaueGeometry.
qvector_from_xy_E
(xcamList, ycamList, energy, detectorplaneparameters, pixelsize)[source]¶ Returns q vectors in Lauetools frame given x and y pixel positions on detector for a given Energy (keV)
Parameters: - xcamList – list pixel x postions
- ycamList – list pixel y postions
- energy – list pf energies
- detectorplaneparameters – list of 5 calibration parameters
- pixelsize – pixel size in mm
-
LaueTools.LaueGeometry.
unit_q
(ttheta, chi, frame='lauetools', anglesample=40.0)[source]¶ Returns unit q vector from 2theta,chi coordinates
Parameters: - ttheta – list of 2theta angles (in degrees)
- chi – list of chi angles (in degrees)
- anglesample – incidence angle of beam to surface plane (degrees)
- frame – frame to express vectors in: ‘lauetools’ , ‘XMASlab’ (LT2 frame),’XMASsample’
Returns: list of 3D u_f (unit vector of scattering transfer q)
-
LaueTools.LaueGeometry.
Compute_data2thetachi
(filename, tuple_column_X_Y_I, _nblines_headertoskip, sorting_intensity='yes', param=None, kf_direction='Z>0', verbose=1, pixelsize=0.08056640625, dim=(2048, 2048), saturation=0, forceextension_lines_to_extract=None, col_isbadspot=None, alpha_xray_incidence_correction=None)[source]¶ Converts spot positions x,y to scattering angles 2theta, chi from a list of peaks
Parameters: - filename (string) – fullpath to peaks list ASCII file
- tuple_column_X_Y_I (3 elements) – tuple with column indices of spots X, Y (pixels on CCD) and intensity
- _nblines_headertoskip – nb of line to skip before reading an array of data in ascii file
- param – list of CCD calibration parameters [det, xcen, ycen, xbet, xgam]
- pixelsize – pixelsize in mm
- dim – (nb pixels x, nb pixels y)
- kf_direction (string) – label of detection geometry (CCD position): ‘Z>0’,’X>0’,…
- sorting_intensity – ‘yes’ sort spots list by decreasing intensity
saturation = 0 : do not read Ipixmax column of DAT file from LaueTools peaksearch saturation > 0 : read Ipixmax column and create data_sat list data_sat[i] = 1 if Ipixmax[i]> saturation, =0 otherwise
- Note: _nblines_headertoskip =0 for .pik file (no header at all)
- _nblines_headertoskip =1 for .peaks coming from fit2d
col_Ipixmax = 10 for .dat from LT peak search using method “Local Maxima” (TODO : bug in Ipixmax for method “convolve”)
-
LaueTools.LaueGeometry.
convert2corfile
(filename, calibparam, dirname_in=None, dirname_out=None, pixelsize=0.08056640625, CCDCalibdict=None, add_props=False)[source]¶ Convert .dat (peaks list from peaksearch procedure) to .cor (adding scattering angles 2theta chi)
From X,Y pixel positions in peak list file (x,y,I,…) and detector plane geometry comptues scattering angles 2theta chi and creates a .cor file (ascii peaks list (2theta chi X Y int …))
Parameters: - calibparam – list of 5 CCD cakibration parameters (used if CCDCalibdict is None or CCDCalibdict[‘CCDCalibPameters’] is missing)
- pixelsize – CCD pixelsize (in mm) (used if CCDCalibdict is None or CCDCalibdict[‘pixelsize’] is missing)
- CCDCalibdict – dictionary of CCD file and calibration parameters
- add_props – add all peaks properties to .cor file instead of the 5 columns
-
LaueTools.LaueGeometry.
convert2corfile_fileseries
(fileindexrange, filenameprefix, calibparam, suffix='', nbdigits=4, dirname_in=None, dirname_out=None, pixelsize=0.08056640625, fliprot='no')[source]¶ convert a serie of peaks list ascii files to .cor files (adding scattering angles).
Filename is decomposed as following for incrementing file index in ####: prefix####suffix example: myimage_0025.myccd => prefix=myimage_ nbdigits=4 suffix=.myccd
Parameters: - nbdigits – nb of digits of file index in filename (with zero padding) (example: for myimage_0002.ccd nbdigits = 4
- calibparam – list of 5 CCD cakibration parameters
-
LaueTools.LaueGeometry.
convert2corfile_multiprocessing
(fileindexrange, filenameprefix, calibparam, dirname_in=None, suffix='', nbdigits=4, dirname_out=None, pixelsize=0.08056640625, fliprot='no', nb_of_cpu=6)[source]¶ launch several processes in parallel to convert .dat file to .cor file
-
LaueTools.LaueGeometry.
vec_normalTosurface
(mat_labframe)[source]¶ solve Mat * X = (0,0,1) for X for pure rotation invMat = transpose(Mat)
TODO: add option sample angle and axis
-
LaueTools.LaueGeometry.
vec_onsurface_alongys
(mat_labframe)[source]¶ solve Mat * X = (0,1,0) for X for pure rotation invMat = transpose(Mat)
-
LaueTools.LaueGeometry.
convert_xycam_from_sourceshift
(OMs, IIp, calib, verbose=0)[source]¶ From x,y on CCD camera (OMs) and source shift (IIprime) compute modified x,y values for the SAME calibration (calib)(for further analysis)
return new value of x,y
-
LaueTools.LaueGeometry.
lengthInSample
(depth, twtheta, chi, omega, verbose=False)[source]¶ compute geometrical lengthes in sample from impact point (I) at the surface to a point (B) where xray are scattered (or fluorescence is emitted) and finally escape from inside at point (C) lying at the sample surface (intersection of line with unit vector u with sample surface plane tilted by omega)
Warning
twtheta and chi angles can be misleading. Assumption is made that angles of unit vector from B to C (or to detector frame pixel) are \(2 \theta\) and \(\chi\). For large depth D, unit vector scattered beam direction is not given by \(2 \theta\) and \(\chi\) angles as they are used for describing the scattering direction from point I and a given detector frame position (you should then compute the two angles correction , actually \(\chi\) is unchanged, and the \(2 \theta\) change is approx d/ distance .i.e. 3 10-4 for d=20 µm and CCD at 70 mm)
Note
- incoming beam coming from the right positive x direction with
- IB = (-D,0,0)
- BC =(xc+D,yc,zc)
- and length BC is proportional to the depth D
Multiple Grains and Strain/orientation Distribution¶
Module to compute Laue Patterns from several crystals in various geometry
Main author is J. S. Micha: micha [at] esrf [dot] fr
version July 2019 from LaueTools package for python2 hosted in
http://sourceforge.net/projects/lauetools/
or for python3 and 2 in
https://gitlab.esrf.fr/micha/lauetools
-
LaueTools.multigrainsSimulator.
Read_GrainListparameter
(param)[source]¶ Read dictionary of input key parameters for simulation
-
LaueTools.multigrainsSimulator.
Construct_GrainsParameters_parametric
(SelectGrains_parametric)[source]¶ return list of simulation parameters for each grain set (mother and children grains)
-
LaueTools.multigrainsSimulator.
dosimulation_parametric
(_list_param, Transform_params=None, SelectGrains=None, emax=25.0, emin=5.0, detectordistance=68.7, detectordiameter=165.0, posCEN=(1024.0, 1024.0), cameraAngles=(0.0, 0.0), gauge=None, kf_direction='Z>0', pixelsize=0.08056640625, dictmaterials={'Al': ['Al', [4.05, 4.05, 4.05, 90, 90, 90], 'fcc'], 'Al2Cu': ['Al2Cu', [6.063, 6.063, 4.872, 90, 90, 90], 'no'], 'Al2O3': ['Al2O3', [4.785, 4.785, 12.991, 90, 90, 120], 'Al2O3'], 'Al2O3_all': ['Al2O3_all', [4.785, 4.785, 12.991, 90, 90, 120], 'no'], 'AlN': ['AlN', [3.11, 3.11, 4.98, 90.0, 90.0, 120.0], 'wurtzite'], 'Au': ['Au', [4.078, 4.078, 4.078, 90, 90, 90], 'fcc'], 'CCDL1949': ['CCDL1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'h+k=2n'], 'CdHgTe': ['CdHgTe', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'dia'], 'CdHgTe_fcc': ['CdHgTe_fcc', [6.46678, 6.46678, 6.46678, 90, 90, 90], 'fcc'], 'CdTe': ['CdTe', [6.487, 6.487, 6.487, 90, 90, 90], 'fcc'], 'CdTeDiagB': ['CdTeDiagB', [4.5721, 7.9191, 11.1993, 90, 90, 90], 'no'], 'Crocidolite': ['Crocidolite', [9.811, 18.013, 5.326, 90, 103.68, 90], 'no'], 'Crocidolite_2': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 103.6, 90], 'no'], 'Crocidolite_2_72deg': ['Crocidolite_2', [9.76, 17.93, 5.35, 90, 76.4, 90], 'no'], 'Crocidolite_small': ['Crocidolite_small', [3.2533333333333334, 5.976666666666667, 1.7833333333333332, 90, 103.6, 90], 'no'], 'Crocidolite_whittaker_1949': ['Crocidolite_whittaker_1949', [9.89, 17.85, 5.31, 90, 107.5, 90], 'no'], 'Cu': ['Cu', [3.6, 3.6, 3.6, 90, 90, 90], 'fcc'], 'Cu6Sn5_monoclinic': ['Cu6Sn5_monoclinic', [11.02, 7.28, 9.827, 90, 98.84, 90], 'no'], 'Cu6Sn5_tetra': ['Cu6Sn5_tetra', [3.608, 3.608, 5.037, 90, 90, 90], 'no'], 'DIA': ['DIA', [5.0, 5.0, 5.0, 90, 90, 90], 'dia'], 'DIAs': ['DIAs', [3.56683, 3.56683, 3.56683, 90, 90, 90], 'dia'], 'DarinaMolecule': ['DarinaMolecule', [9.4254, 13.5004, 13.8241, 61.83, 84.555, 75.231], 'no'], 'FCC': ['FCC', [5.0, 5.0, 5.0, 90, 90, 90], 'fcc'], 'Fe': ['Fe', [2.856, 2.856, 2.856, 90, 90, 90], 'bcc'], 'Fe2Ta': ['Fe2Ta', [4.83, 4.83, 0.788, 90, 90, 120], 'no'], 'FeAl': ['FeAl', [5.871, 5.871, 5.871, 90, 90, 90], 'fcc'], 'GaAs': ['GaAs', [5.65325, 5.65325, 5.65325, 90, 90, 90], 'dia'], 'GaN': ['GaN', [3.189, 3.189, 5.185, 90, 90, 120], 'wurtzite'], 'GaN_all': ['GaN_all', [3.189, 3.189, 5.185, 90, 90, 120], 'no'], 'Ge': ['Ge', [5.6575, 5.6575, 5.6575, 90, 90, 90], 'dia'], 'Ge_compressedhydro': ['Ge_compressedhydro', [5.64, 5.64, 5.64, 90, 90, 90.0], 'dia'], 'Ge_s': ['Ge_s', [5.6575, 5.6575, 5.6575, 90, 90, 89.5], 'dia'], 'Getest': ['Getest', [5.6575, 5.6575, 5.6574, 90, 90, 90], 'dia'], 'Hematite': ['Hematite', [5.03459, 5.03459, 13.7533, 90, 90, 120], 'no'], 'In': ['In', [3.2517, 3.2517, 4.9459, 90, 90, 90], 'h+k+l=2n'], 'InGaN': ['InGaN', [3.3609999999999998, 3.3609999999999998, 5.439, 90, 90, 120], 'wurtzite'], 'InN': ['InN', [3.533, 3.533, 5.693, 90, 90, 120], 'wurtzite'], 'Magnetite': ['Magnetite', [8.391, 8.391, 8.391, 90, 90, 90], 'dia'], 'Magnetite_fcc': ['Magnetite_fcc', [8.391, 8.391, 8.391, 90, 90, 90], 'fcc'], 'Magnetite_sc': ['Magnetite_sc', [8.391, 8.391, 8.391, 90, 90, 90], 'no'], 'Nd45': ['Nd45', [5.4884, 5.4884, 5.4884, 90, 90, 90], 'fcc'], 'Ni': ['Ni', [3.5238, 3.5238, 3.5238, 90, 90, 90], 'fcc'], 'NiO': ['NiO', [2.96, 2.96, 7.23, 90, 90, 120], 'no'], 'NiTi': ['NiTi', [3.5506, 3.5506, 3.5506, 90, 90, 90], 'fcc'], 'SC': ['SC', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'SC5': ['SC5', [5.0, 5.0, 5.0, 90, 90, 90], 'no'], 'SC7': ['SC7', [7.0, 7.0, 7.0, 90, 90, 90], 'no'], 'Sb': ['Sb', [4.3, 4.3, 11.3, 90, 90, 120], 'no'], 'Si': ['Si', [5.4309, 5.4309, 5.4309, 90, 90, 90], 'dia'], 'Sn': ['Sn', [5.83, 5.83, 3.18, 90, 90, 90], 'h+k+l=2n'], 'Ti': ['Ti', [2.95, 2.95, 4.68, 90, 90, 120], 'no'], 'Ti2AlN': ['Ti2AlN', [2.989, 2.989, 13.624, 90, 90, 120], 'Ti2AlN'], 'Ti2AlN_w': ['Ti2AlN_w', [2.989, 2.989, 13.624, 90, 90, 120], 'wurtzite'], 'Ti_beta': ['Ti_beta', [3.2587, 3.2587, 3.2587, 90, 90, 90], 'bcc'], 'Ti_omega': ['Ti_omega', [4.6085, 4.6085, 2.8221, 90, 90, 120], 'no'], 'Ti_s': ['Ti_s', [3.0, 3.0, 4.7, 90.5, 89.5, 120.5], 'no'], 'UO2': ['UO2', [5.47, 5.47, 5.47, 90, 90, 90], 'fcc'], 'VO2M1': ['VO2M1', [5.75175, 4.52596, 5.38326, 90.0, 122.6148, 90.0], 'VO2_mono'], 'VO2M2': ['VO2M2', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'no'], 'VO2R': ['VO2R', [4.5546, 4.5546, 2.8514, 90.0, 90, 90.0], 'rutile'], 'W': ['W', [3.1652, 3.1652, 3.1652, 90, 90, 90], 'bcc'], 'YAG': ['YAG', [9.2, 9.2, 9.2, 90, 90, 90], 'no'], 'ZnO': ['ZnO', [3.252, 3.252, 5.213, 90, 90, 120], 'wurtzite'], 'ZrO2': ['ZrO2', [5.1505, 5.2116, 5.3173, 90, 99.23, 90], 'VO2_mono'], 'ZrO2Y2O3': ['ZrO2Y2O3', [5.1378, 5.1378, 5.1378, 90, 90, 90], 'fcc'], 'alphaQuartz': ['alphaQuartz', [4.9, 4.9, 5.4, 90, 90, 120], 'no'], 'betaQuartznew': ['betaQuartznew', [4.9, 4.9, 6.685, 90, 90, 120], 'no'], 'bigpro': ['bigpro', [112.0, 112.0, 136.0, 90, 90, 90], 'no'], 'dummy': ['dummy', [4.0, 8.0, 2.0, 90, 90, 90], 'no'], 'ferrydrite': ['ferrydrite', [2.96, 2.96, 9.4, 90, 90, 120], 'no'], 'hexagonal': ['hexagonal', [1.0, 1.0, 3.0, 90, 90, 120.0], 'no'], 'inputB': ['inputB', [1.0, 1.0, 1.0, 90, 90, 90], 'no'], 'quartz_alpha': ['quartz_alpha', [4.913, 4.913, 5.404, 90, 90, 120], 'no'], 'smallpro': ['smallpro', [20.0, 4.8, 49.0, 90, 90, 90], 'no'], 'test_reference': ['test_reference', [3.2, 4.5, 5.2, 83, 92.0, 122], 'wurtzite'], 'test_solution': ['test_solution', [3.252, 4.48, 5.213, 83.2569, 92.125478, 122.364], 'wurtzite'], 'testindex': ['testindex', [2.0, 1.0, 4.0, 90, 90, 90], 'no'], 'testindex2': ['testindex2', [2.0, 1.0, 4.0, 75, 90, 120], 'no']})[source]¶ Simulation of orientation or deformation gradient. From parent grain simulate a list of transformations (deduced by a parametric variation)
_list_param : list of parameters for each grain [grain parameters, grain name]
posCEN =(Xcen, Ycen) cameraAngles =(Xbet, Xgam)
Returns: (list_twicetheta, list_chi, list_energy, list_Miller, list_posX, list_posY, ParentGrainName_list, list_ParentGrain_transforms, calib, total_nb_grains) TODO:simulate for any camera position TODO: simulate spatial distribution of laue pattern origin