Skip to content

Commit

Permalink
Merge pull request #53 from ralfHielscher/master
Browse files Browse the repository at this point in the history
mtex 4.0.18
  • Loading branch information
ralfHielscher committed Apr 24, 2015
2 parents 02adb4e + 6677bd9 commit 81a4a44
Show file tree
Hide file tree
Showing 22 changed files with 348 additions and 154 deletions.
1 change: 1 addition & 0 deletions EBSDAnalysis/@EBSD/plotAngleDistribution.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@
mtexFig.drawNow(varargin{:})

if nargout==0, clear h;end
hold off
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ clean:


# rule for making release
RNAME = mtex-4.0.17
RNAME = mtex-4.0.18
RDIR = ../releases
release:
rm -rf $(RDIR)/$(RNAME)*
Expand Down
5 changes: 5 additions & 0 deletions PoleFigureAnalysis/@PoleFigure/calcError.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@
end
end

% TODO: implement a nice default output
%if nargout == 0
% disp('TODO')
% clear e;
%end
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MTEX 4.0.17
MTEX 4.0.18
11 changes: 5 additions & 6 deletions doc/GrainAnalysis/GrainSingleAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,20 @@
% some process, we are interessed in quantifications.

cs = ebsd(grain_selected).CS;
plotPDF(ebsd(grain_selected).orientations,...
[Miller(0,0,1,cs),Miller(0,1,1,cs),Miller(1,1,1,cs)],'antipodal')
ori = ebsd(grain_selected).orientations;
plotPDF(ori,[Miller(0,0,1,cs),Miller(0,1,1,cs),Miller(1,1,1,cs)],'antipodal')


%%
% Testing on the distribution shows a gentle prolatness, nevertheless we
% would reject the hypothesis for some level of significance, since the
% distribution is highly concentrated and the numerical results vague.

[qm,lambda,U,kappa] = mean(ebsd(grain_selected).orientations,'approximated');
num2str(kappa')
calcBinghamODF(ori,'approximated')

%%
%
ori = ebsd(grain_selected).orientations;

T_spherical = bingham_test(ori,'spherical','approximated');
T_prolate = bingham_test(ori,'prolate', 'approximated');
T_oblate = bingham_test(ori,'oblate', 'approximated');
Expand Down Expand Up @@ -137,4 +136,4 @@
close, plotIPDF(ebsd_line.orientations,[xvector,yvector,zvector],...
'property',ebsd_line.y,'markersize',3,'antipodal')

colorbar
colorbar
131 changes: 110 additions & 21 deletions doc/PoleFigureAnalysis/PoleFigureTutorial.m
Original file line number Diff line number Diff line change
@@ -1,37 +1,126 @@
%% Short Pole Figure Analysis Tutorial
% How to estimate ODFs from diffraction data.
%% Pole Figure Tutorial
% Tutorial on x-ray and neutron diffraction data.

%% Open in Editor
%
%% Import diffraction data
% The following script is automatically generated by the import wizard.
% Click on <matlab:import_wizard('PoleFigure') Import pole figure data> to
% start the import wizard which is a GUI leading you throught the import of
% pole figure data. After finishing the wizard you will end with a script
% similar to the following one.

% specify scrystal and specimen symmetry
cs = crystalSymmetry('-3m',[1.4,1.4,1.5]);
% This script was automatically created by the import wizard. You should
% run the whoole script or parts of it in order to import your data. There
% is no problem in making any changes to this script.

% specify file names
% *Specify Crystal and Specimen Symmetries*

% crystal symmetry
CS = crystalSymmetry('6/mmm', [2.633 2.633 4.8], 'X||a*', 'Y||b', 'Z||c');

% specimen symmetry
SS = specimenSymmetry('1');

% plotting convention
setMTEXpref('xAxisDirection','north');
setMTEXpref('zAxisDirection','outOfPlane');

% *Specify File Names*

% path to files
pname = '/home/hielscher/Downloads/mtexerrordefocusing';

% which files to be imported
fname = {...
fullfile(mtexDataPath,'PoleFigure','dubna','Q(10-10)_amp.cnv'),...
fullfile(mtexDataPath,'PoleFigure','dubna','Q(10-11)(01-11)_amp.cnv'),...
fullfile(mtexDataPath,'PoleFigure','dubna','Q(11-22)_amp.cnv')};
[pname '/ZnCuTi_Wal_50_5x5_PF_002_R.UXD'],...
[pname '/ZnCuTi_Wal_50_5x5_PF_100_R.UXD'],...
[pname '/ZnCuTi_Wal_50_5x5_PF_101_R.UXD'],...
[pname '/ZnCuTi_Wal_50_5x5_PF_102_R.UXD'],...
};

% specify crystal directions
h = {Miller(1,0,-1,0,cs),[Miller(0,1,-1,1,cs),Miller(1,0,-1,1,cs)],Miller(1,1,-2,2,cs)};
% defocusing
pname = '/home/hielscher/Downloads/mtexerrordefocusing';
fname_def = {...
[pname '/ZnCuTi_defocusing_PF_002_R.UXD'],...
[pname '/ZnCuTi_defocusing_PF_100_R.UXD'],...
[pname '/ZnCuTi_defocusing_PF_101_R.UXD'],...
[pname '/ZnCuTi_defocusing_PF_102_R.UXD'],...
};

% specify structure coefficients
c = {1,[0.52 ,1.23],1};
% *Specify Miller Indice*

% import pole figure data
pf = loadPoleFigure(fname,h,cs,'superposition',c,...
'comment','Dubna Tutorial pole figures')
h = { ...
Miller(0,0,2,CS),...
Miller(1,0,0,CS),...
Miller(1,0,1,CS),...
Miller(1,0,2,CS),...
};

%% Plot pole figures
% *Import the Data*

% create a Pole Figure variable containing the data
pf = loadPoleFigure(fname,h,CS,SS,'interface','uxd');

% defocussing
pf_def = loadPoleFigure(fname_def,h,CS,SS,'interface','uxd');

% correct data
pf = correct(pf,'def',pf_def);

%% Plot Raw Data
% You should run the sript section wise to see how MTEX imports the pole
% figure data. Next you can plot your data

plot(pf)
annotate([xvector,yvector,zvector],'label',{'X','Y','Z'},'backgroundColor','w')

%%
% Make sure that the Miller indices are correctly assigned to the pole
% figures and that the alignment of the specimen coordinate system, i.e.,
% X, Y, Z is correct. In case of outliers or misanligned data you may want
% to correct you raw data. See <ModifyPoleFigureData.html how to modify
% pole figure data> for further information.
%
%% ODF Estimation
%
% Once your data are in a good shape, i.e. defocussing correction has been
% done and only few outliers are left you can step to reconstruct an ODF
% out of these data. This is done by the command <PoleFigure_calcODF.html
% calcODF>.

odf = calcODF(pf,'silent')

%%
% Note that reconstructing an ODF from pole figure data is a severly ill
% posed problem, i.e., it does *not* provide an unique solution. A more
% troughout discussion on the ambiguity of ODF reconstruction from pole
% figure data can be found <PF2ODFAmbiguity.html here>. As a rule of thumb:
% as more pole figures you have and as more consistent you pole figure data
% are as better you reconstructed ODF will be.
%
% To check how well your reconstructd ODF fitts the measured pole figure
% data do

plotPDF(odf,pf.h)

%%
% Compare the recalculated pole figures with the measured data.
% Quantitative measure for the fitting are the so called RP values. They
% can be computed by

calcError(odf,pf)

%%
% In case of a bad fitting you may want to tweak the reconstruction
% algorithm. See <PoleFigure2odf.html here> for more information.

%% Quantify the Reconstruction Error




%% Estimate an ODF
odf = calcODF(pf)

%% Calculate c-axis pole figure from the ODF
plotPDF(odf,Miller(0,0,1,cs),'antipodal')
%% Visualize the ODF

plotODF(odf)
mtexColorMap LaboTeX
7 changes: 5 additions & 2 deletions geometry/@Miller/Miller.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@

% check for symmetry
m.CSprivate = getClass(varargin,'crystalSymmetry',[]);
assert(~isempty(m.CSprivate),['Starting with MTEX 4.0 Miller ' ...
assert(isa(varargin{1},'Miller') || ~isempty(m.CSprivate),...
['Starting with MTEX 4.0 Miller ' ...
'indices always require to specify a crystal symmetry!']);

if nargin == 0 %empty constructor
Expand All @@ -69,7 +70,9 @@
elseif isa(varargin{1},'Miller') % copy constructor

if ~isempty(m.CSprivate), varargin{1}.CSprivate = m.CSprivate;end
m = varargin{1};
m = varargin{1};
dispStyle = extract_option(varargin,{'uvw','UVTW','hkl','hkil','xyz'}); %#ok<*PROP>
if ~isempty(dispStyle), m.dispStyle = dispStyle{1}; end

return;

Expand Down
4 changes: 2 additions & 2 deletions geometry/@Miller/display.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function display(m)

eps = 1e4;

switch m.dispStyle
switch lower(m.dispStyle)

case 'uvw'

Expand All @@ -28,7 +28,7 @@ function display(m)

cprintf(uvtw.','-L',' ','-Lr',{'u' 'v' 'w'});

case 'UVTW'
case 'uvtw'

uvtw = round(m.UVTW * eps)./eps;
uvtw(uvtw==0) = 0;
Expand Down
10 changes: 5 additions & 5 deletions geometry/@Miller/round.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
% tries to round miller indizes to greatest common divisor


switch h.dispStyle
switch lower(h.dispStyle)

case 'uvw'
mOld = h.uvw;
case 'UVTW'
case 'uvtw'
mOld = h.UVTW;
case 'hkl'
mOld = h.hkl;
Expand Down Expand Up @@ -44,11 +44,11 @@
h = h .* multiplier;

% now round
switch h.dispStyle
switch lower(h.dispStyle)

case 'uvw'
case 'uvw'
h.uvw = round(h.uvw);
case 'UVTW'
case 'uvtw'
h.UVTW = round(h.UVTW);
case 'hkl'
h.hkl = round(h.hkl);
Expand Down
3 changes: 2 additions & 1 deletion geometry/@orientation/angle.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
if nargin == 1

[~,omega] = project2FundamentalRegion(o1);

omega = reshape(omega,size(o1));

else

omega = real(2*acos(dot(o1,o2)));
Expand Down
2 changes: 1 addition & 1 deletion geometry/@orientation/calcBinghamODF.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
[~,~,ev,kappa] = mean(ori,varargin{:});

% set up Bingham ODF
odf = BinghamODF(kappa,ev,CS,SS);
odf = BinghamODF(kappa,ev,ori.CS,ori.SS);
31 changes: 16 additions & 15 deletions geometry/@orientation/calcKernelODF.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@
%
% *calcKernelODF* is one of the core function of the MTEX toolbox.
% It estimates an ODF from a set of individual crystal orientations by
% [[EBSD2odf.html kernel,density estimation]].
% [[EBSD2odf.html kernel density estimation]].
%
% The function *calcKernelODF* has several options to control the halfwidth of
% the kernel functions, the resolution, etc. Most important the estimated
% ODF is affected by the *halfwidth* of the kernel function.
% The function *calcKernelODF* has several options to control the halfwidth
% of the kernel functions, the resolution, etc. Most important the
% estimated ODF is affected by the *halfwidth* of the kernel function.
%
% If the halfwidth is large the estimated ODF is smooth whereas a small halfwidth
% results in a sharp ODF. It depends on your prior information about the
% ODF to choose this parameter right. Look at this
% If the halfwidth is large the estimated ODF is smooth whereas a small
% halfwidth results in a sharp ODF. It depends on your prior information
% about the ODF to choose this parameter right. Look at this
% [[EBSDSimulation_demo.html, description]] for exhausive discussion.
%
% Syntax
% calcODF(ori,...,param,var,...)
% calcODF(ebsd,...,param,var,...)
% odf = calcKernelODF(ori)
% odf = calcKernelODF(grains.meanOrientation,'weigths',grains.area)
% odf = calcKernelODF(ebsd.orientations,'halfwidth',5*degree)
%
% Input
% ori - @orientation
% ebsd - @EBSD
% ori - @orientation
%
% Output
% odf - @ODF
%
% Options
% HALFWIDTH - halfwidth of the kernel function
% RESOLUTION - resolution of the grid where the ODF is approximated
% KERNEL - kernel function (default -- de la Valee Poussin kernel)
% halfwidth - halfwidth of the kernel function
% resolution - resolution of the grid where the ODF is approximated
% kernel - kernel function (default -- de la Valee Poussin kernel)
% weights - list of weights for the orientations
%
% Flags
% EXACT - no approximation to a corser grid
% exact - no approximation to a corser grid
%
% See also
% ebsd_demo EBSD2odf EBSDSimulation_demo loadEBSD ODF/calcEBSD EBSD/calcKernel kernel/kernel
Expand Down
5 changes: 4 additions & 1 deletion geometry/@orientation/calcODF.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
% % use kernel density estimation with a 10 degree kernel
% odf = calcODF(ori,'halfwidth',10*degree)
%
% % use grain area as weights for the orientations
% odf = calcODF(grains.meanOrientation,'weights',grains.area)
%
% % use a specific kernel
% psi = AbelPoissonKernel('halfwidth',10*degree)
% odf = calcODF(ori,'kernel',psi)
Expand All @@ -27,6 +30,7 @@
% odf - @ODF
%
% Options
% weights - list of weights for the orientations
% halfwidth - halfwidth of the kernel function
% resolution - resolution of the grid where the ODF is approximated
% kernel - kernel function (default -- de la Valee Poussin kernel)
Expand Down Expand Up @@ -63,4 +67,3 @@
odf = calcKernelODF(ori,varargin{:},'kernel',psi);

end

Loading

0 comments on commit 81a4a44

Please sign in to comment.