MTEX Scripts edit page

Unlike most other texture analysis software MTEX does not have any graphical user interface. Instead the user is supposed to write scripts. Those scripts usually have the following structure

  1. import data
  2. inspect the data
  3. correct the data
  4. analyze the data
  5. plot and export the results of the analysis

During all these steps the data are stored as variables of different type. There are many different types of variables (called classes) for different objects, like vectors, rotations, EBSD data, grains or ODFs. A complete list of all classes and all functions can be found in the Function Reference.

Variables are generated automatically when data are imported. E.g., the commands

fileName = [mtexEBSDPath filesep 'Forsterite.ctf'];
ebsd = EBSD.load(fileName,'EulerCorrection',rotation.byAxisAngle(xvector,180*degree))
ebsd = EBSDsquare (Y1↓→X1, row↓→col)
 
 Phase  Orientations     Mineral         Color  Symmetry  Crystal reference frame
     0   58485 (24%)  notIndexed          none                                   
     1  152345 (62%)  Forsterite  LightSkyBlue       mmm                         
     2   26058 (11%)   Enstatite  DarkSeaGreen       mmm                         
     3   9064 (3.7%)    Diopside     Goldenrod     12/m1        X||a*, Y||b, Z||c
 
 Properties: bands, bc, bs, error, mad, oldId
 Scan unit : um
 X x Y x Z : [0 → 36550] x [0 → 16750] x [0 → 0]
 Normal vector: (0,0,1)
 Square grid  :336 x 732

imports data from the file fileName.ctf and stores them in the variable ebsd of type EBSD.

Next one can pass the variable ebsd to different MTEX function. E.g. to plot a phase plot one simply does

plot(ebsd)

The grain structure is reconstructed by the command

grains = calcGrains(ebsd,'minPixel',3)
grains = grain2d (Y1↓→X1)
 
 Phase  Grains  Pixels     Mineral  Symmetry         Color
     0       8     811  notIndexed                    none
     1     490  151675  Forsterite       mmm  LightSkyBlue
     2     223   25747   Enstatite       mmm  DarkSeaGreen
     3     229    7674    Diopside     12/m1     Goldenrod
 
 boundary segments: 35830 (1.7e+06 µm)
 inner boundary segments: 285 (13165 µm)
 triple points: 1567
 
 Properties: meanRotation, GOS

which returns a new variable of type grain2d, here called grains. This variable contains the entire grain structure. Finally, we my visualize this structure by

hold on
plot(grains.boundary,'linewidth',2)
hold off

An MTEX script is a sequence of MTEX commands. Usually, these are accompanied by comments (lines starting with %), describing the purpose of each command and making the script understandable in the future. It is also good practice to subdivide MTEX scripts into sections by adding lines starting with %% and executing those scripts only section by section Shift Strg Enter.

Citing this page. This page is part of the documentation of MTEX, a free and open source MATLAB toolbox for analyzing and modeling crystallographic textures. It was written by The MTEX Developers and is published at https://mtex-toolbox.github.io/MTEXScripts.html. If you use MTEX, or reuse text or figures from this page, in your research, please cite

F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63

BibTeX
@article{bachmann2010mtex,
  author  = {F. Bachmann and R. Hielscher and H. Schaeben},
  title   = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
  journal = {Solid State Phenomena},
  volume  = {160},
  pages   = {63-68},
  year    = {2010},
  doi     = {10.4028/www.scientific.net/SSP.160.63},
  url     = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}

Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.