User Tools

Site Tools


evaluation:plotting-grain-orientations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
evaluation:plotting-grain-orientations [2019/12/03 14:36]
smerkel created
evaluation:plotting-grain-orientations [2019/12/05 15:37] (current)
smerkel
Line 20: Line 20:
 Here is an example of a script that will load these orientations and plot them in a pole figures. The example is for olivine and can be adjusted to your needs. Here is an example of a script that will load these orientations and plot them in a pole figures. The example is for olivine and can be adjusted to your needs.
  
-<​code>​+<​code ​matlab plotGrainPF.m>
 %% %%
 % Define crystal and sample symmetry % Define crystal and sample symmetry
Line 49: Line 49:
 plotPDF(ori0,​h,'​antipodal','​MarkerSize',​10,​ '​MarkerFaceColor',​ '​b',​ '​MarkerEdgeColor',​ '​b'​) plotPDF(ori0,​h,'​antipodal','​MarkerSize',​10,​ '​MarkerFaceColor',​ '​b',​ '​MarkerEdgeColor',​ '​b'​)
  
 +</​code>​
 +
 +
 +===== Loading and plotting grain orientations in MTeX, with colors! =====
 +
 +Here is an example of a script that will load these orientations and plot them in a pole figures. The example is for olivine and can be adjusted to your needs.
 +
 +In this case grains are assigned a color based on the ODF intensity for their orientations.
 +
 +{{ :​processing:​resultsevalutation:​grains-indexing-1.jpg?​direct&​600 |}}
 +
 +<code matlab plotColorGrainPF.m>​
 +%%
 +% Define crystal and sample symmetry
 +cs_ol = crystalSymmetry('​Pnma',​[9.915267 5.886196 4.713400])
 +ss = specimenSymmetry()
 +% Plotting convention
 +plotx2east
 +% File with Euler angles
 +fname = fullfile('/​path/​to/​folder/',​...
 +    '','​euler.txt'​);​
 +
 +%%
 +% Load file and create the corresponding list of orientations
 +ori = load(fname)
 +n = size(ori);
 +n = n(1);
 +
 +for i = 1:n
 +    phi1 = ori(i,​1)*degree;​
 +    Phi = ori(i,​2)*degree;​
 +    phi2 = ori(i,​3)*degree;​
 +    ori0(i) = orientation('​Euler',​phi1,​Phi,​phi2,​cs_ol,​ss);​
 +end
 +
 +%%
 +% Plots grains using a color scale base on ODF fitted to the grains
 +
 +% Fit an ODF to the data
 +odf = calcODF(ori0,​15*degree)
 +
 +% Plot orientations,​ colored based on ODF
 +plotPDF(ori0,​eval(odf,​ori0),​h,'​antipodal','​MarkerSize',​10,​ '​MarkerEdgeColor',​ '​b'​)
 +CLim(gcm,​[0,​10])
 +mtexColorbar
 +
 +
 +</​code>​
 +
 +
 +===== Loading and plotting grain orientations in MTeX, in an inverse pole figure, and with colors! =====
 +
 +Here is an example of a script that will load these orientations and plot them in a inverse pole figures. The example is for olivine and can be adjusted to your needs. Grains are assigned a color based on the ODF intensity for their orientations.
 +
 +{{ :​processing:​resultsevalutation:​ipf-grains-indexing-1.jpg?​direct&​400 |}}
 +
 +<code matlab plotColorGrainIPF.m>​
 +%%
 +% Define crystal and sample symmetry
 +cs_ol = crystalSymmetry('​Pnma',​[9.915267 5.886196 4.713400])
 +ss = specimenSymmetry()
 +% Plotting convention
 +plotx2east
 +% File with Euler angles
 +fname = fullfile('/​path/​to/​folder/',​...
 +    '','​euler.txt'​);​
 +
 +%%
 +% Load file and create the corresponding list of orientations
 +ori = load(fname)
 +n = size(ori);
 +n = n(1);
 +
 +for i = 1:n
 +    phi1 = ori(i,​1)*degree;​
 +    Phi = ori(i,​2)*degree;​
 +    phi2 = ori(i,​3)*degree;​
 +    ori0(i) = orientation('​Euler',​phi1,​Phi,​phi2,​cs_ol,​ss);​
 +end
 +
 +%%
 +% Plots grains using a color scale base on ODF fitted to the grains
 +
 +% Fit an ODF to the data
 +odf = calcODF(ori0,​15*degree)
 +
 +
 +% Plot grains as IPF of the compression (if compression is in X), colored based on ODF
 +plotIPDF(ori0,​eval(odf,​ori0),​[vector3d.X],'​antipodal','​MarkerSize',​10,​ '​MarkerEdgeColor',​ '​b'​)
 +CLim(gcm,​[0,​10])
 +mtexColorbar
 +
 +
 +</​code>​
 +
 +
 +===== Comparing grain orientations in MTeX =====
 +
 +The following script will load results from 3 different indexings a plot the results so they can be compared. ​
 +
 +The image below for instance shows the results of a first indexing in blue, a second indexing in red, and a third indexing in yellow.
 +
 +{{ :​processing:​resultsevalutation:​indexations-1-2-3.jpg?​direct&​600 |}}
 +
 +<code matlab compareGrainPF.m>​
 +%%
 +% Define crystal and sample symmetry
 +cs_ol = crystalSymmetry('​Pnma',​[9.915267 5.886196 4.713400])
 +ss = specimenSymmetry()
 +% Plotting convention
 +plotx2east
 +% Files with Euler angles
 +fname1 = fullfile('/​path/​to/​folder/',​...
 +    '','​euler-1.txt'​);​
 +fname0 = fullfile('/​path/​to/​folder/',​...
 +    '','​euler-2.txt'​);​
 +fname2 = fullfile('/​path/​to/​folder/',​...
 +    '','​euler-3.txt'​);​
 +
 +%%
 +% Load file and create the corresponding 3 lists of orientations
 +ori = load(fname0)
 +n = size(ori);
 +n = n(1);
 +
 +for i = 1:n
 +    phi1 = ori(i,​1)*degree;​
 +    Phi = ori(i,​2)*degree;​
 +    phi2 = ori(i,​3)*degree;​
 +    ori0(i) = orientation('​Euler',​phi1,​Phi,​phi2,​cs_ol,​ss);​
 +end
 +
 +ori = load(fname1)
 +n = size(ori);
 +n = n(1);
 +
 +for i = 1:n
 +    phi1 = ori(i,​1)*degree;​
 +    Phi = ori(i,​2)*degree;​
 +    phi2 = ori(i,​3)*degree;​
 +    ori1(i) = orientation('​Euler',​phi1,​Phi,​phi2,​cs_ol,​ss);​
 +end
 +
 +ori = load(fname2)
 +n = size(ori);
 +n = n(1);
 +
 +for i = 1:n
 +    phi1 = ori(i,​1)*degree;​
 +    Phi = ori(i,​2)*degree;​
 +    phi2 = ori(i,​3)*degree;​
 +    ori2(i) = orientation('​Euler',​phi1,​Phi,​phi2,​cs_ol,​ss);​
 +end
 +
 +%%
 +% Plot grain orientations from the 3 files in a way they can be compared
 +h = Miller({1,​0,​0},​{0,​1,​0},​{0,​0,​1},​cs_ol)
 +plotPDF(ori0,​h,'​antipodal','​MarkerSize',​10,​ '​MarkerFaceColor',​ '​b',​ '​MarkerEdgeColor',​ '​b'​)
 +hold on
 +plotPDF(ori1,​h,'​antipodal','​MarkerSize',​8,​ '​MarkerFaceColor',​ '​r',​ '​MarkerEdgeColor',​ '​b'​)
 +hold on
 +plotPDF(ori2,​h,'​antipodal','​MarkerSize',​6,​ '​MarkerFaceColor',​ '​y',​ '​MarkerEdgeColor',​ '​b'​)
  
 </​code>​ </​code>​
evaluation/plotting-grain-orientations.1575383818.txt.gz · Last modified: 2019/12/03 14:36 by smerkel