MTEX Scripts edit page

Unlike most other texture analysis software MTEX does not have any graphical user interface. Instead the user is suposed 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,'convertEuler2SpatialReferenceFrame')
ebsd = EBSD
 
 Phase  Orientations     Mineral         Color  Symmetry  Crystal reference frame
     0   58485 (24%)  notIndexed                                                 
     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, x, y
 Scan unit : um

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 diferent 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)
grains = grain2d
 
 Phase  Grains  Pixels     Mineral  Symmetry  Crystal reference frame
     0   16334   58485  notIndexed                                   
     1    4092  152345  Forsterite       mmm                         
     2    1864   26058   Enstatite       mmm                         
     3    1991    9064    Diopside     12/m1       X||a*, Y||b*, Z||c
 
 boundary segments: 147957
 inner boundary segments: 33
 triple points: 11456
 
 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 scipt 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.