Explains how to read and write ODFs to a data file
MTEX support the following formats for storing and importing of ODFs:
We will demonstrate the the import and export of ODFs at the following sample ODF which is defined as the superposition of several model ODFs.
cs = crystalSymmetry('cubic'); mod1 = orientation.byAxisAngle(xvector,45*degree,cs); mod2 = orientation.byAxisAngle(yvector,65*degree,cs); model_odf = 0.5*uniformODF(cs) + ... 0.05*fibreODF(Miller(1,0,0,cs),xvector,'halfwidth',10*degree) + ... 0.05*fibreODF(Miller(0,1,0,cs),yvector,'halfwidth',10*degree) + ... 0.05*fibreODF(Miller(0,0,1,cs),zvector,'halfwidth',10*degree) + ... 0.05*unimodalODF(mod1,'halfwidth',15*degree) + ... 0.3*unimodalODF(mod2,'halfwidth',25*degree); plot(model_odf,'sections',6,'silent')
The most simplest way to store an ODF is to store the corresponding variable odf as any other MATLAB variable.
% the filename fname = fullfile(mtexDataPath, 'ODF', 'odf.mat'); save(fname,'model_odf')
Importing a .mat file is done simply by
load(fname)
By default and ODF is exported in an ASCII file which consists of a large table with four columns, where the first three column describe the Euler angles of a regular 5� grid in the orientation space and the fourth column contains the value of the ODF at this specific position.
% the filename fname = fullfile(mtexDataPath, 'ODF', 'odf.txt'); % export the ODF export(model_odf,fname,'Bunge')
Other Euler angle conventions or other resolutions can by specified by options to export. Even more control you have, if you specify the grid in the orientation space directly.
% define a equispaced grid in orientation space with resolution of 5 degree S3G = equispacedSO3Grid(cs,'resolution',5*degree); % export the ODF by values at these locations export(model_odf,fname,S3G,'Bunge','generic')
Using the options MTEX the ODF is exported to an ASCII file which contains descriptions of all components of the ODF in a human readable fassion. This format can be imported by MTEX without loss.
% the filename fname = [mtexDataPath '/ODF/odf.mtex']; % export the ODF export(model_odf,fname,'Bunge','MTEX')
TODO!!!
Importing ODF data into MTEX means to create an ODF variable from data files containing Euler angles and weights. Once such an variable has been created the data can be analyzed and processed in many ways. See e.g. ODFCalculations. The most simplest way to import ODF data is to use the import wizard, which can be started either by typing into the command line
import_wizard('ODF')
or using from the start menu the item Start/Toolboxes/MTEX/Import Wizard. The import wizard provides a gui to import data of almost all ASCII data formats and allows to save the imported data as an ODF variable to the workspace or to generate a m-file loading the data automatically.
A script generated by the import wizard typically look as follows.
% define crystal and specimen symmetry cs = crystalSymmetry('cubic'); % the file name fname = [mtexDataPath '/ODF/odf.txt']; % TODO: write about halfwidth and the missing 1-1 relationship between ODF % and single orientations. % the resolution used for the reconstruction of the ODF res = 10*degree; % load the data odf = ODF.load(fname,cs,'resolution',res,'Bunge',... 'ColumnNames',{'Euler 1','Euler 2','Euler 3','weights'}); % plot data plot(odf,'sections',6,'silent')
Interpolating the ODF. This might take some time... progress: 100%
So far ODFs may only exported from and imported into ASCII files that consists of a table of orientations and weights. The orientations may be given either as Euler angles or as quaternions. The weight may either represent the value of the ODF at this specific orientation or it may represent the volume of a bell shaped function centered at this orientation.
DocHelp 0.1 beta |