Skip to content

Commit

Permalink
Merge pull request #49 from ralfHielscher/master
Browse files Browse the repository at this point in the history
mtex 4.0.17
  • Loading branch information
ralfHielscher committed Apr 15, 2015
2 parents 10b756d + 106f047 commit 02adb4e
Show file tree
Hide file tree
Showing 52 changed files with 24,829 additions and 1,868 deletions.
37 changes: 0 additions & 37 deletions EBSDAnalysis/@EBSD/export_VPSC.m

This file was deleted.

3 changes: 2 additions & 1 deletion EBSDAnalysis/@EBSD/plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
% keep track of the extend of the graphics
% this is needed for the zoom: TODO maybe this can be done better
%if isNew, ; end % TODO set axis tight removes all the plot
axis(mP.ax,'tight'); set(mP.ax,'zlim',[0,1]);
try axis(mP.ax,'tight'); end
set(mP.ax,'zlim',[0,1]);
mP.extend(1) = min(mP.extend(1),min(ebsd.prop.x(:)));
mP.extend(2) = max(mP.extend(2),max(ebsd.prop.x(:)));
mP.extend(3) = min(mP.extend(3),min(ebsd.prop.y(:)));
Expand Down
2 changes: 1 addition & 1 deletion EBSDAnalysis/@grain2d/area.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
poly = grains.poly;
V = grains.V;

for ig = 1:length(grains.poly)
for ig = 1:length(poly)
A(ig) = polySgnArea(V(poly{ig},1),V(poly{ig},2));
end
30 changes: 12 additions & 18 deletions EBSDAnalysis/@grain2d/diameter.m
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
function [d] = diameter(grains)
% diameter of a grain (longest distance between any two vertices of a grain
% boundary)

% diameter of a grain
% longest distance between any two vertices of the grain boundary

% do extract this as it is much faster
V = grains.V;
dim = size(V,2);

[v,g] = find(grains.I_VG);

cs = [0; find(diff(g));size(g,1)];
poly = grains.poly;

d = zeros(size(grains));

for k=1:size(grains,1)
Vg = V(v(cs(k)+1:cs(k+1)),:);
nv = size(Vg,1);
for ig = 1:length(grains)

if nv > 100 % if it is a large Vertex-Set, reduce it to its convex hull
Vg = Vg(convhulln(Vg),:);
nv = size(Vg,1);
end

diffVg = bsxfun(@minus,reshape(Vg,[nv,1,dim]),reshape(Vg,[1,nv,dim]));
Vg = V(poly{ig},:);

% if it is a large Vertex-Set, reduce it to its convex hull
if size(Vg,1) > 100, Vg = Vg(convhulln(Vg),:); end
diffVg = bsxfun(@minus,reshape(Vg,[],1,2),reshape(Vg,1,[],2));
diffVg = sum(diffVg.^2,3);

d(k) = sqrt(max(diffVg(:)));
d(ig) = sqrt(max(diffVg(:)));
end
10 changes: 10 additions & 0 deletions EBSDAnalysis/@grain2d/grain2d.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
scanUnit % unit of the vertice coordinates
id2ind %
GOS % intergranular average misorientation angle
x % x coordinates of the vertices of the grains
y % y coordinates of the vertices of the grains
end

properties (Dependent = true, Access = protected)
Expand Down Expand Up @@ -104,6 +106,14 @@
V = grains.boundary.V;
end

function x = get.x(grains)
x = grains.boundary.x;
end

function y = get.y(grains)
y = grains.boundary.y;
end

function grains = set.V(grains,V)
grains.boundary.V = V;
end
Expand Down
15 changes: 10 additions & 5 deletions EBSDAnalysis/@grain2d/hist.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ function hist(grains,varargin)
%
%

[mtexFig,isNew] = newMtexFigure(varargin{:});
mtexFig.keepAspectRatio = false;

if nargin>1 && isnumeric(varargin{1})
nbins = varargin{1};
else
Expand Down Expand Up @@ -32,11 +35,13 @@ function hist(grains,varargin)

% plot the result as a bar plot
binCenter = 0.5*(bins(1:end-1)+bins(2:end));
bar(binCenter,100*cumArea,'BarWidth',1.5)
xlim([bins(1),bins(end)])
xlabel('grain area')
ylabel('relative volume (%)')
title('grain size distribution')
bar(binCenter,100*cumArea,'BarWidth',1.5,'parent',mtexFig.gca)
xlim(mtexFig.gca,[bins(1),bins(end)])
xlabel(mtexFig.gca,'grain area')
ylabel(mtexFig.gca,'relative volume (%)')
title(mtexFig.gca,'grain size distribution')

min = grains.mineralList(idList);
legend(min{:})

if isNew, mtexFig.drawNow(varargin{:});end
92 changes: 0 additions & 92 deletions EBSDAnalysis/@grain2d/joinCount.m

This file was deleted.

10 changes: 10 additions & 0 deletions EBSDAnalysis/@grainBoundary/grainBoundary.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
A_F % adjecency matrix faces - faces
segmentId % connected component id
segmentSize % number of faces that form a segment
x % x coordinates of the vertices of the grains
y % y coordinates of the vertices of the grains
end

methods
Expand Down Expand Up @@ -115,6 +117,14 @@
dir = normalize(v1-v2);
end

function x = get.x(gB)
x = gB.V(unique(gB.F(:)),1);
end

function y = get.y(gB)
y = gB.V(unique(gB.F(:)),2);
end

function I_VF = get.I_VF(gB)
[i,~,f] = find(gB.F);
I_VF = sparse(f,i,1,size(gB.V,1),size(gB.F,1));
Expand Down
3 changes: 2 additions & 1 deletion EBSDAnalysis/@grainBoundary/plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
legend('-DynamicLegend','location','NorthEast');
warning('on','MATLAB:legend:PlotEmpty');

axis(mP.ax,'tight'); set(mP.ax,'zlim',[0,1]);
try axis(mP.ax,'tight'); end
set(mP.ax,'zlim',[0,1]);
mP.micronBar.setOnTop

if nargout == 0, clear h; end
Expand Down
1 change: 1 addition & 0 deletions EBSDAnalysis/@grainBoundary/plotAngleDistribution.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
%

[mtexFig,isNew] = newMtexFigure(varargin{:});
mtexFig.keepAspectRatio = false;

% only consider indexed data
gB = subSet(gB,gB.isIndexed);
Expand Down
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.15
RNAME = mtex-4.0.17
RDIR = ../releases
release:
rm -rf $(RDIR)/$(RNAME)*
Expand Down
6 changes: 3 additions & 3 deletions ODFAnalysis/@ODF/export_VPSC.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function export_VPSC(odf,filename,varargin)
% get number of points
points = get_option(varargin,'points',10000);

% simulate EBSD
ebsd = calcEBSD(odf,points,varargin{:});
% simulate orientations
ori = calcOrientations(odf,points,varargin{:});

% export EBSD
export_VPSC(ebsd,filename,varargin{:});
export_VPSC(ori,filename,varargin{:});
14 changes: 5 additions & 9 deletions ODFAnalysis/@ODFComponent/calcTensor.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@

% Voigt mean
if check_option(varargin,{'Voigt','Hill'})

% rotate tensor according to the grid
T = rotate(T,S3G);


% rotate tensor according to the grid and
% take the mean of the tensor according to the weight
TVoigt = sum(f .* T);
TVoigt = sum(f .* rotate(T,S3G));

end

if check_option(varargin,{'Reuss','Hill'})

% for Reuss tensor invert tensor
Tinv = inv(T);
Tinv = rotate(Tinv,S3G);
TReuss = inv(sum(f .* Tinv));
% for Reuss tensor invert tensor
TReuss = inv(sum(f .* rotate(inv(T),S3G)));

end
4 changes: 0 additions & 4 deletions PoleFigureAnalysis/@PoleFigure/calcFEMODF.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,3 @@
odf = femODF(DSO3,'weights',c);

end

function vdisp(s,varargin)
if ~check_option(varargin,'silent'), disp(s);end
end
13 changes: 2 additions & 11 deletions PoleFigureAnalysis/@PoleFigure/calcODF.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@
vdisp(['required time: ',int2str(toc),'s'],varargin{:});

% return ODF
S3G.CS = pf.CS;
S3G.SS = pf.SS;
odf = unimodalODF(S3G,psi,'weights',c./sum(c));

if check_option(varargin,'noGhostCorrection'), return;end
Expand All @@ -159,7 +157,7 @@
end

if phon > 0.99
odf = uniformODF(pf.CS,pf.SS);
odf = uniformODF(CS,SS);
return
elseif phon > 0.1
vdisp('ghost correction',varargin{:});
Expand All @@ -182,14 +180,7 @@
'EXTERN',P,r,gh,A,c0,w,char(extract_option(varargin,'silent')));

% return ODF
S3G.CS = pf.CS;
S3G.SS = pf.SS;
odf = phon * uniformODF(pf.CS,pf.SS) + ...
odf = phon * uniformODF(CS,SS) + ...
(1-phon) * unimodalODF(S3G,psi,'weights',c./sum(c));

end


function vdisp(s,varargin)
if ~check_option(varargin,'silent'), disp(s);end
end
2 changes: 1 addition & 1 deletion PoleFigureAnalysis/@PoleFigure/correct.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

% check for identical specimen directions
if all(pf.r == pf_orig.r)
pf_orig.intensities = pf.intensities;
pf_orig.allI = pf.allI;
return
end

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MTEX 4.0.15
MTEX 4.0.17
Loading

0 comments on commit 02adb4e

Please sign in to comment.