Skip to content

Commit

Permalink
work on
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfHielscher committed Sep 30, 2015
1 parent 02b45d4 commit 9ce3862
Show file tree
Hide file tree
Showing 5 changed files with 346 additions and 405 deletions.
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.*~
177 changes: 177 additions & 0 deletions scripts/ODFModelling.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
%% TEXMAT-CZM Texture School, Clausthal, 2015
%
%% ODF Modelling with MTEX
% Ralf Hielscher, TU Chemnitz
%
%%
% The following script demostrates some of the facilities of MTEX to
% import, correct and analyze pole figure data.
%
% Run this script section by section and follow the output. You are
% encauraged to alter the script to get a better feeling about MTEX.
%
% important shortcuts:
% Strg + Return - run the current section
% Shift + Strg + Return - run the current section and go to the next one
% F9 - evaluate the selected command
%


%%

% adjust plotting convention
plotx2east
close all

% determine the maximum value and the modal orientation of an ODF
[value,ori] = max(odf,2)

plot(odf,'sigma','sections',12)

annotate(ori(1),'label','A','backgroundColor','w')
annotate(ori(2),'label','B','backgroundColor','w')

%%

100 * volume(odf,ori(1),10*degree)
100 * volume(odf,ori(2),10*degree)

%%

odf_model = 0.3 * unimodalODF(ori(1),'halfwidth',8.5*degree) + ...
0.15 * unimodalODF(ori(2),'halfwidth',10*degree)
plot(odf - odf_model,'sigma','sections',12)
mtexColorMap blue2red
mtexColorbar

%%
% maybe there is some fibre portion

v = vector3d('polar',35*degree,45*degree);
annotate(v)

100 * fibreVolume(odf,Miller(0,0,1,CS),v,10*degree)

figure(2)
plotFibre(odf-odf_model,Miller(0,0,1,CS),v)



%%

unimodal_component2 = unimodalODF(ori(2))

figure(3)
model_odf = 0.5 * unimodal_component + 0.15*unimodal_component2;
plot(model_odf,'sigma','sections',12)


%%

figure(1)
h = Miller(0,0,1,CS)
plotPDF(odf - model_odf,Miller(0,0,1,CS))
mtexColorMap blue2red
colorbar(gcm)

%%

figure(2)
r = vector3d('polar',35*degree,42*degree)
h = Miller(0,0,1,CS)
fibre_component = fibreODF(h,r,'halfwidth',10*degree)

plot(fibre_component,'sections',12,'sigma')

%%

figure(2)
model_odf = 0.4 * unimodal_component + ...
0.15 * unimodal_component2 + ...
0.25 * fibre_component;

plot(model_odf,'sigma','sections',12)

figure(1)
plot(odf,'sigma','sections',12)

%% other posible components
%
% uniform components, Bingham distributed components, FourierComponent


%% Ghosts ....................

% some sample ODF
odf = SantaFe

% plot it
plot(odf)

%%
% simulate some pole figure data

% crystal directions
h = [Miller(1,0,0,odf.CS),Miller(1,1,0,odf.CS),Miller(1,1,1,odf.CS)];

% compute pole figures
pf = calcPoleFigure(odf,h);

plot(pf)

%%

odf_rec1 = calcODF(pf)
odf_rec2 = calcODF(pf,'noGhostCorrection')

%%

figure(1)
plotPDF(odf_rec1,h)

figure(2)
plotPDF(odf_rec2,h)

figure(3)
plotPDF(odf,h)

%%

figure(1)
plotODF(odf_rec1,'contourf')
mtexColorMap white2black

figure(2)
plotODF(odf_rec2,'contourf')
mtexColorMap white2black

%% Ghosts in Fourier space

close all;
plotFourier(odf,'linewidth',2)

% keep plotting windows and add next plots
hold all

% without ghost correction:
plotFourier(odf_rec2,'linewidth',2)

% with ghost correction
plotFourier(odf_rec1,'linewidth',2)

legend({'true ODF','without ghost correction','with ghost correction'})
% next plot command overwrites plot window
hold off

%% Options of calcODF
%
% * halfwidth - of the kernel used for reconstruction
% * resolution - how dense the kernels are placed
% * zero_range - useful for sharp textures
%
%% Exercise
%
% Play around with data correction and reconstruction options to get better
% RP values compare to the default values for the dubna example!
%
%%
25 changes: 17 additions & 8 deletions scripts/odfExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,24 @@
%% plot c-axis distribution

plotPDF(ebsd.orientations,Miller(0,0,1,ebsd.CS))
mtexColorMap LaboTeX

%% plot as contour plot

plotPDF(ebsd.orientations,Miller(0,0,1,ebsd.CS),'contourf')
mtexColorMap LaboTeX

%% do the same for a inverse pole figure

plotIPDF(ebsd.orientations,vector3d.X,'contourf')
mtexColorMap LaboTeX

%% plot measurements in orientation space

%plotSection(ebsd.orientations,'sections',6)
plotSection(ebsd.orientations,'sections',6,'contourf','all') % this takes some time
figure(1)
plotSection(ebsd.orientations,'sections',6)
%plotSection(ebsd.orientations,'sections',6,'contourf','all') % this takes some time
mtexColorMap LaboTeX

%% compute an ODF from the EBSD data

Expand All @@ -57,11 +62,12 @@

figure(2)
plot(odf,'sections',6,'contourf')
mtexColorMap LaboTeX

%% or as sigma sections

oS = pfSections(odf.CS,odf.SS)
plotSection(odf,oS)
plot(odf,'sigma')
mtexColorMap LaboTeX

%% plot pole figures of the odf

Expand Down Expand Up @@ -104,15 +110,18 @@
%% do the same with the EBSD data

r = ebsd.orientations * Miller(0,1,0,odf.CS)
rMean = mean(r,'antipodal')
rMean = mean(r)

fibreVolume(ebsd.orientations,Miller(0,1,0,odf.CS),rMean,10*degree) * 100

% what is wrong with the following formula? (hint to the teacher: anxxxxal
% - actually rMean = mean(...) should automatically set this property)

% this is actually only a shortcut for
%mean( angle(r,rMean) < 10*degree ) * 100

% Question: what is wrong with these lines?
% Tip:
% plot(r,'contourf')
% annotate(rMean)


%%

Expand Down
Loading

0 comments on commit 9ce3862

Please sign in to comment.