Features of the free and open source toolbox MTEX for texture analysis Ralf Hielscher 1 Florian Bachmann 2 Helmut Schaeben 3 David Mainprice 4 1 Applied Functional Analysis, Technische Universität Chemnitz, Germany 2 Geoscience Mathematics and Informatics, Technische Universität Bergakademie Freiberg, Germany 3 Géosciences Montpellier UMR 5242, Université Montpellier 2 & CNRS, France Internal MTEX Training Géosciences Montpellier, September 2012
Outline 1 Introduction MTEX project MATLAB environment 2 EBSD Data Analysis Importing EBSD Data 3 Visualization Grains Analysis EBSD - to - ODF Reconstruction
History of MTEX : A Texture Calculation Toolbox 1 Originally developed by Ralf Hielscher as part of this Ph.D. thesis The Radon Transform on the Rotation Group : Inversion and Application to Texture Analysis (2007) under the direction of Helmut Schaeben at Technische Universität Bergakademie Freiberg, Germany. 2 The toolbox has been extended to include the analysis of 2D and 3D EBSD data by Florian Bachmann and others. 3 The physical properties of 2 nd, 3 rd and 4 th rank tensors have been incorporated by David Mainprice and others.
Features of MTEX crystal geometry: all kind of symmetries, different Euler angle conventions, import from crystallographic information files (CIF); pole figure data analysis: 20 data formats, data correction; pole figure to ODF inversion: all symmetries, any sampling of pole figures including irregular grids, incomplete and non-normalized pole figures, ghost correction option, zero range option; EBSD data analysis: 5 data formats, data correction; grain detection: fabric analysis, misorientation analysis; ODF estimation from EBSD data: automized determination of kernel width, arbitrarily many individual orientations; ODF analysis: modal orientations, difference ODFs, volume portions, entropy, texture index, Fourier coefficients; ODF modeling: any composition of uniform, unimodal, fibre and Bingham ODFs, simulation of pole figure and individual orientation data; material property tensors: average tensors from EBSD data and ODFs; elasticity tensors: elastic stiffness tensor, elastic compliance tensor, Young s modulus, shear modulus, Poisson s ratio, linear compressibility, compressional and shear elastic wave velocities, velocity ratios.
MTEX : The Concept ODF Estimation EBSD Data Analysis Plotting MTEX Pole Figure Analysis Texture Characteristics ODF Modelling MATLAB toolbox Fourier and numerical methods on SO3 Pole figure inversion route to ODF Individual orientation route to ODF Spatially referenced data in 2D or 3D EBSD... > 1000 functions > 20 data formats imported Publication ready plots Batch processing FREE! for everyone
MTEX : Webpage an import source of information
MTEX : Not so frequently asked questions
MTEX : Issues - a contact with the development team
MTEX : Central role of Orientation Distribution Function (ODF)
MTEX : Analyzing and Visualizing ODFs
Overview of MATLAB 1 High-level (line by line interpreter) language for technical computing 2 A large number of mathematical functions integrated in the language for matrix algebra, statistics, Fourier analysis,... 3 2-D and 3-D graphics functions for visualizing data 4 Extensions using commercial or free open source toolboxes (e.g. MTEX ) 5 Functions for integrating MATLAB based algorithms with external languages, such as C, C++, FORTRAN...
Vectors and Matrices Define vectors: v = [ 1 ; 2 ; 3 ; 4 ] ; % a v e r t i c a l v e c t o r h = [ 1 2 3 4 ] ; % a h o r i z o n t a l v e c t o r M = [ [ 1 ; 2 ] [ 3 ; 4 ] ] ; % a 2 by 2 Matrix s = 1 : 4 ; % the same as h i n l i n e 2 Calculate with vectors: u = 5 v % m u l t i p l y v e c t o r s by a s c a l a r w = u v % s u b t r a c t two v e c t o r s x = u. v % e l e m e n t w i s e m u l t i p l i c a t i o n u v, u v % i n n e r & o u t e r p roduct y = [ u v ] % c o n c a t e n a t i o n o f v e c t o r s Example: polar to Euclidean coordinates x = s i n ( t h e t a ). cos ( rho ) y = s i n ( t h e t a ). s i n ( rho )
Vectors Indexing by numbers: v ( 1 ) % the f i r s t element v ( 2 : end ) % the l a s t t h r e e e l e m e n t s M( 2, 1 ) % the bottom l e f t element M( :, 2 ) % the second column Indexing by conditions: v ( v > 1 ) % a l l e l e m e n t s t h a t a r e l a r g e r then 1 v ( u == v ) % a l l e l e m e n t s where u and v c o i n c i d e Changing elements v ( 1 : 3 ) = 1 % s e t the f i r s t t h r e e e l e m e n t s to 1 v ( v == 0 ) = [ ] % remove a l l z e r o s
MATLAB programming style - Orientation tensor 1 For a pole figure displaying one crystallographic direction h of number (N) individual orientation pixels or grains the orientation tensor is traditionally defined in the geological literature as: M ij = 1 N N i xi 2 N i x i y N i i x i z i N i x i y N i i yi 2 N i y i z i N i x i z N i i y i z N i i zi 2 where r = (x i y i z i ) are direction cosines of a crystallographic direction h in specimen coordinates r with Cartesian reference axes X, Y and Z.
MATLAB programming style - Orientation tensor 2 The same Orientation tensor can also be formulated as a symmetric matrix and the product of the multiplication of a vector containing all r by its transpose: M ij = M 11 M 12 M 13 M 12 M 22 M 23 M 13 M 23 M 33 = 1 N N r T i r i i where r = (x i y i z i ) are direction cosines of a crystallographic direction h in specimen coordinates r with Cartesian reference axes X, Y and Z.
MATLAB programming style - Orientation tensor 3 The two methods of calculation are illustrated by small MATLAB script. The method using the formation of covariance matrix from a column and row vector of r is 300 times faster. Efficient programming requires adapting to the MATLAB style.
MATLAB programming style - Orientation tensor 4 An example of c-axes pole figure of ice 1h at 1171m Talos Dome ice core, Antarctica. Eigen-vectors (red squares) : E1, E2, E3 Eigen-values (magnitudes) : EM1 > EM2 > EM3 G50 fabric analyser data courtesy of Maurine Montagnat LGGE UMR5183, CNRS / UJF Grenoble, France
Single Orientation Measurements in MTEX Parameters of a single EBSD phase in MTEX arbitrary as list: crystal symmetry specimen symmetry list of individual orientations phase example olivine spatial coordinates x y Band Contrast diffraction signal MAD Mean Angular Deviation... Olivine in torsion: EBSD map data courtesy of Sylvie Demouchy,Montpellier Colorcode for crystallographic directions parallel to shear direction
Importing EBSD Data with The MTEX Import Wizard Two ways to import EBSD data 1 From command window link Import EBSD data 2 Type in the command window import_wizard( EBSD ) Formats supported by MTEX : *.ang TSL-EDAX *.ctf HKL-Oxford *.csv Oxford *.sor LaboTEX *.txt (Generic ASCII files generated by user)
Importing EBSD Data - Using a script This script was generated by the EBSD import wizard: % C r y s t a l s y m m e t r i e s d e f i n e a, b, c, alpha, beta, gamma % and c r y s t a l d i r e c t i o n s used f o r E u l e r a n g l e C a r t e s i a n r e f e r e n c e frame CS = {... n o t I n d e x e d,... symmetry ( mmm, [ 4. 7 5 6 1 0.207 5. 9 8 ], m i n e r a l, O l i v i n e ),... symmetry ( mmm, [ 1 8. 2 4 0 6 8.8302 5. 1 8 5 2 ], m i n e r a l, E n s t a t i t e ),... symmetry ( 2/m, [ 9. 7 4 6 8. 9 9 5. 2 5 1 ], [ 9 0. 0 0, 1 0 5. 6 3, 9 0. 0 0 ] degree,... X a, Y b, Z c, m i n e r a l, D i o p s i d e ),... symmetry ( m 3m, m i n e r a l, Magnetite ),... symmetry ( m 3m, m i n e r a l, Chromite ) } ; % Specimen symmetry SS = symmetry ( 1 ) ; % path to f i l e s pname = / MatLab Programs / % which f i l e s to be i m p o r t e d fname = {[ pname 920D 13. c t f ], } % c r e a t e an EBSD v a r i a b l e c o n t a i n i n g t h e data ebsd = loadebsd ( fname, CS, SS, i n t e r f a c e, c t f )
Visualize EBSD Data in MTEX : orientation space Scatter plots in orientation space (Rodrigues space, axis-angle space or Euler angle space) % Not v e r y u s e f u l as a x e s a r e not l a b e l l e d s c a t t e r ( ebsd ( O l i v i n e ), AXISANGLE ) s c a t t e r ( ebsd ( O l i v i n e ), RODRIGUES ) % More u s e f u l w i t h l a b e l l e d s e c t i o n s p l o t o d f ( ebsd ( O l i v i n e ), sigma, SECTIONS, 1 8, p o i n t s,320744)
Visualize EBSD Data in MTEX : specimen space Scatter plots of pole figures: crystal direction h in specimen space r % O l i v i n e p o l e f i g u r e s % p l o t t i n g c o n v e n t i o n p l o t x 2 e a s t % X=East Y=North Z=C e n t e r upper h e m i s p h e r e p l o t x 2 e a s t % s p e c i f y c r y s t a l d i r e c t i o n s h w i t h h k l f o r p o l e and uvw d i r e c t i o n s h = [ M i l l e r ( 1, 0, 0, uvw ), M i l l e r ( 0, 1, 0, uvw ), M i l l e r ( 0, 0, 1, uvw ) ] f i g u r e ( p o s i t i o n, [ 1 0 0 100 700 3 5 0 ] ) p l o t p d f ( ebsd ( O l i v i n e ), h, a n t i p o d a l, p o i n t s,320744) % s p e c i f y specimen d i r e c t i o n s r % you can used predefined xvector, yvector or zvector % o r d e f i n e a r b i t a r y d i r e c t i o n s w i t h v e c t o r 3 d ( 1. 0, 0. 0, 0. 0 ) r = [ v e c t o r 3 d ( 1. 0, 0. 0, 0. 0 ), v e c t o r 3 d ( 0. 0, 1. 0, 0. 0 ), v e c t o r 3 d ( 0. 0, 0. 0, 1. 0 ) ] a n n o t a t e ( r, a l l, l a b e l,{ X, Y, Z }, BackgroundColor, w ) Option : Antipodal (non-polar) Option : Complete (polar)
Visualize EBSD Data in MTEX : crystal space Scatter plots of inverse pole figures: specimen direction r in crystal space h % O l i v i n e i n v e r s e p o l e f i g u r e s : specimen d i r e c t i o n r i n c r y s t a l s p a c e h % s p e c i f y specimen d i r e c t i o n s r r = [ v e c t o r 3 d ( 1. 0, 0. 0, 0. 0 ), v e c t o r 3 d ( 0. 0, 1. 0, 0. 0 ), v e c t o r 3 d ( 0. 0, 0. 0, 1. 0 ) ] f i g u r e ( p o s i t i o n, [ 1 0 0 100 700 3 5 0 ] ) p l o t i p d f ( ebsd ( O l i v i n e ), r, a n t i p o d a l, p o i n t s,320744) % s p e c i f y c r y s t a l d i r e c t i o n s h h = [ M i l l e r ( 1, 0, 0, uvw ), M i l l e r ( 0, 1, 0, uvw ), M i l l e r ( 0, 0, 1, uvw ) ] a n n o t a t e ( h, a l l, l a b e l e d, BackgroundColor, w )
Visualize EBSD Data in MTEX : Spatial maps Spatial plots of EBSD data Example hkl color coded orientation map % i p f o r i e n t a t i o n map p l o t ( ebsd, c o l o r c o d i n g, i p d f ) % phase d i s t r i b u t i o n map p l o t ( ebsd, p r o p e r t y, phase ) % d i f f r a c t e d i n t e n s i t y map p l o t ( ebsd, p r o p e r t y, bc ) % mean a n g u l a r d e v i a t i o n e r r o r map p l o t ( ebsd, p r o p e r t y, mad ) Color Codings: bunge, angle, sigma, ihs, ipdf, rodriguesquat, rodriguesinverse, euler, bunge2, hkl (Olivine torsion data courtesy of Sylvie Demouchy, GM, UM2, Montpellier)
Grain Analysis with MTEX Grain reconstruction in MTEX is done via the command calcgrains. As an optional argument the desired threshold angle for misorientation defining a grains boundary can be specified. A grain is defined as a region, in which the misorientation of at least one neighbouring measurement site is smaller than a given threshold angle. The command grainsize returns the number of indexed pixels within a grain. % F i l l s a l l non i n d e x e d a r e a s. Angle i s t h e same f o r a l l p h a s e s. g r a i n s = c a l c G r a i n s ( ebsd, a n g l e,10 degree ) ; % Angle i s 0,10 & 15 f o r p h a s e s 1, 2, 3. F i l l s a l l non i n d e x e d a r e a s. g r a i n s = c a l c G r a i n s ( ebsd, a n g l e, [ 0 10 5] degree ) ; % Conserves non indexed areas. Angle i s the same f o r a l l phases. g r a i n s = c a l c G r a i n s ( ebsd, a n g l e,10 degree, keepnotindexed ) ; EBSD Map Grain Map : calcgrains(ebsd( Olivine ), angle,10*degree)
Grain Properties EBSD properties p l ot ( g r a i n s ) % p l o t a l l g r a i n s p l ot ( g r a i n s ( O l i v i n e ) % p l o t o l i v i n e g r a i n s p l ot ( g r a i n s, p r o p e r t y, phase ) % p l o t the phase o f eac plotboundary ( g r a i n s ) % p l o t g r a i n b o u n d a r i e s Plot grain boundaries: p l o t b o u n d a r y ( g r a i n s,/+<o p t i o n s>+/) p l o t b o u n d a r y ( g r a i n s, p r o p e r t y, a n g l e ) p l o t b o u n d a r y ( g r a i n s, p r o p e r t y, r o t ) Access to properties of grains phase = get ( g r a i n s, phase ) g r a i n s q u a r t z = g r a i n s ( Quartz ) o = get ( g r a i n s q u a r t z, o r i e n t a t i o n )
Grain Properties EBSD properties p l ot ( g r a i n s,/+<o p t i o n s>+/) /+p l o t ( g r a i n s, p r o p e r t y, phase )+/ Plot grain boundaries: p l o t b o u n d a r y ( g r a i n s,/+<o p t i o n s>+/) p l o t b o u n d a r y ( g r a i n s, p r o p e r t y, a n g l e ) p l o t b o u n d a r y ( g r a i n s, p r o p e r t y, r o t ) Access to properties of grains phase = get ( g r a i n s, phase ) g r a i n s q u a r t z = g r a i n s ( Quartz ) o = get ( g r a i n s q u a r t z, o r i e n t a t i o n )
Grain Properties: Geometry Basic functions of grain geometry % commands that i n c l u d e non index points ( holes ) p e r i m e t e r ( g r a i n s ) ; % p e r i m e t e r o f a g r a i n p o l y g o n a r e a ( g r a i n s ) ; % a r e a o f a g r a i n p o l y g o n c e n t r o i d ( g r a i n s ) ; % b a r y c e n t e r o f t h e g r a i n p o l y g o n % e q u i v a l e n t r a d i u s and p e r i m e t e r e q u i v a l e n t r a d i u s ( g r a i n s ) ; % d e f i n e d as s q r t ( a r e a / p i ) e q u i v a l e n t p e r i m e t e r ( g r a i n s ) ; % d e f i n e d as 2 p i e q u i v a l e n t r a d i u s % g r a i n geometry d i a m e t e r ( g r a i n s ) ; % l o n g e s t d i s t a n c e between two v e r t i c e s o f g r a i n a s p e c t r a t i o ( g r a i n s ) ; % r a t i o o f two p r i n c i p a l components o f a g r a i n s h a p e f a c t o r ( g r a i n s ) ; % d e f i n e d as p e r i m e t e r / e q u i v a l e n t p e r i m e t e r g r a i n S i z e ( g r a i n s ) ; % t h e number o f i n d e x e d measurements p e r g r a i n Grain-size distribution A = a r e a ( g r a i n s ) ; % h i s t o g r a m bar ( h i s t (A, exp ( 1. 5 : 6. 5 ) ) ) Other properties: h a s h o l e s, h a s s u b f r a c t i o n
Working with EBSD Data Directly Access EBSD properties o r i e n t a t i o n s = get ( ebsd, o r i e n t a t i o n ) x = get ( ebsd, x ) Rotate EBSD data ebsd = rotate ( ebsd, r o t a t i o n (... a x i s, xvector, a n g l e,90 degree ) ) Omit one pixel grains % g r a i n s c o n t a i n i n g more than one i n d e x e d p i x e l g r a i n s = g r a i n s ( g r a i n s i z e ( g r a i n s ) > 1)
EBSD to ODF Reconstruction in MTEX MTEX uses kernel density estimation to compute an ODF from EBSD data. The sensitive parameter of this method is the kernel function. Syntax: odf = calcodf ( ebsd,<o p t i o n s>) Options: k e r n e l % the k e r n e l to be used h a l f w i d t h % h a l f width o f the k e r n e l r e s o l u t i o n % r e s o l u t i o n o f a p p r o x i m a t i o n g r i d F o u r i e r % ODF by i t s F o u r i e r c o e f f i c i e n t s e x a c t % e x a c t g r i d