Skip to content

Commit

Permalink
Merge pull request #29 from ralfHielscher/master
Browse files Browse the repository at this point in the history
mtex 4.0.13
  • Loading branch information
ralfHielscher committed Feb 26, 2015
2 parents c1d612c + 5b3068f commit 991b041
Show file tree
Hide file tree
Showing 21 changed files with 154,265 additions and 122 deletions.
13 changes: 7 additions & 6 deletions EBSDAnalysis/@EBSD/plotAxisDistribution.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function plotAxisDistribution(ebsd1,varargin)
% S2Grid/plot savefigure Plotting Annotations_demo ColorCoding_demo PlotTypes_demo
% SphericalProjection_demo

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

% get phases
if nargin > 1 && isa(varargin{1},'EBSD')
Expand Down Expand Up @@ -62,14 +62,15 @@ function plotAxisDistribution(ebsd1,varargin)
if i > 1, mtexFig.nextAxis; end

mori = calcMisorientation(objSplit{ph1(i)},objSplit{ph2(i)},varargin{:});
plot(mori.axis,'doNotDraw','symmetrised','parent',mtexFig.gca,'FundamentalRegion',varargin{:});
plot(mori.axis,'doNotDraw','symmetrised','parent',mtexFig.gca,...
'FundamentalRegion',varargin{:});
mtexTitle(mtexFig.gca,[mori.CS.mineral ' - ' mori.SS.mineral])

end

%set(gcf,'tag','AxisDistribution');
%setappdata(gcf,'CS',axes.CS);
set(gcf,'Name','Axis Distribution');
mtexFig.drawNow
if isNew % finalize plot
set(gcf,'Name','Misorientation Axes Distribution');
mtexFig.drawNow('figSize',getMTEXpref('figSize'),varargin{:});
end

if nargout == 0, clear h; end
53 changes: 10 additions & 43 deletions EBSDAnalysis/@grain2d/cat.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% concatenation of grains from the same GrainSet
%
% Syntax
% g = [grains_1, grains_2, ..., grains_n]
% g = [grains_1, grains_2, grains_n]
%
% Example
% g = [grains('fe') grains('mg')]
Expand All @@ -11,50 +11,17 @@
% See also
% GrainSet/vertcat

grains = varargin{1};
grains = cat@dynProp(dim,varargin{:});

for k = 2:numel(varargin)
g = varargin{k};

gOld = find(any(grains.I_DG,1));
gNew = find(any(g.I_DG,1));
dOld = find(any(grains.I_DG,2));
dNew = find(any(g.I_DG,2));

% intersection of sets and indexes
[a,gndx] = unique([gOld(:);gNew(:)]);
[a,dndx] = unique([dOld(:);dNew(:)]);

grains.A_D = max(grains.A_D,g.A_D);
grains.I_DG = max(grains.I_DG,g.I_DG);
grains.A_G = max(grains.A_G,g.A_G);

grains.meanRotation = [grains.meanRotation;g.meanRotation];
grains.meanRotation = grains.meanRotation(gndx);

grains.phase = [grains.phaseId;g.phaseId];
grains.phase = grains.phaseId(gndx);

grains.I_FDext = max(grains.I_FDext,g.I_FDext);
grains.I_FDint = max(grains.I_FDint,g.I_FDint);

grains.F = max(grains.F,g.F);
grains.V = max(grains.V,g.V);

for fn = fieldnames(grains.options)'
cfn = char(fn);
newoption = vertcat(grains.options.(cfn),g.options.(cfn));
grains.options.(cfn) = newoption(gndx);
end

ng = varargin{k};

grains.EBSD = [grains.EBSD g.EBSD];
grains.EBSD = grains.EBSD('sort',dndx);
grains.id = [grains.id; ng.id];
grains.phaseId = [grains.phaseId; ng.phaseId];
grains.grainSize = [grains.grainSize; ng.grainSize];
grains.poly = [grains.poly; ng.poly];
grains.boundary = [grains.boundary; ng.boundary];
grains.innerBoundary = [grains.innerBoundary; ng.innerBoundary];

end

%grains = subSet@dynProp(grains,ind);

%grains.poly = grains.poly(ind);
%grains.id = grains.id(ind);
%grains.meanRotation = grains.meanRotation(ind);
%grains.phaseId = grains.phaseId(ind);
34 changes: 22 additions & 12 deletions EBSDAnalysis/@grain2d/neighbors.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
function [n,pairs] = neighbors(grains)
function [counts,pairs] = neighbors(grains)
% returns the number of neighboring grains
%
%% Input
% grains - @GrainSet
%% Output
% n - number of neighbors per grain
% pairs - index list of size N x 2, where
% Input
% grains - @GrainSet
%
% Output
% counts - number of neighbors per grain
% pairs - index list of size N x 2, where
% $$N = 2 \sum n_i $$
% is the total number of neighborhood relations (without self--reference).
%
Expand All @@ -15,11 +16,20 @@
%
% selects two neighbored grains.
%
s = logical(grains);

A_G = grains.A_G(s,s);
A_G = A_G | A_G' - diag(diag(A_G));
% extract grainIds for each boundary segment
gbid = grains.boundary.grainId;
gbid(any(gbid == 0,2),:) = [];

% sort columnwise
gbid = sort(gbid,2);

% get unique pairs
pairs = unique(gbid,'rows');

% get the number of neighbours per grain
ng = max(grains.id);
countIds = full(sparse(pairs(pairs<=ng),1,1,ng,1));

[a,b,n] = find(sum(A_G,2));
[a,b] = find(triu(A_G,1));
pairs = [a,b];
% rearange with respect to grain order
counts = countIds(grains.id);
1 change: 1 addition & 0 deletions EBSDAnalysis/@grain2d/subsasgn.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

grains = subsasgn@dynProp(grains,s(1),b);
grains.id = subsasgn(grains.id,s(1),b.id);
grains.phaseId = subsasgn(grains.phaseId,s(1),b.phaseId);
grains.grainSize = subsasgn(grains.grainSize,s(1),b.grainSize);
grains.poly = subsasgn(grains.poly,s(1),b.poly);
grains.CSList = b.CSList;
Expand Down
23 changes: 23 additions & 0 deletions EBSDAnalysis/@grainBoundary/grainBoundary.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@
.* ebsd.rotations(gB.ebsdId(isNotBoundary,2));

end

function gB = cat(dim,varargin)

gB = cat@dynProp(dim,varargin{:});

for k = 2:numel(varargin)

ngB = varargin{k};

gB.F = [gB.F;ngB.F];
gB.grainId = [gB.grainId; ngB.grainId];
gB.ebsdId = [gB.ebsdId; ngB.ebsdId];
gB.misrotation = [gB.misrotation;ngB.misrotation];
gB.phaseId = [gB.phaseId; ngB.phaseId];

end

% remove duplicates
[~,ind] = unique(gB.F,'rows');
gB = gB.subSet(ind);

end


function mori = get.misorientation(gB)

Expand Down
10 changes: 8 additions & 2 deletions EBSDAnalysis/@grainBoundary/plotAxisDistribution.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
% orientation/calcAngleDistribution
%

mtexFig = newMtexFigure(varargin{:});
[mtexFig,isNew] = newMtexFigure(varargin{:});
h = [];

% only consider indexed data
Expand All @@ -30,5 +30,11 @@

end

mtexFig.drawNow;
if isNew % finalize plot

set(gcf,'Name','Misorientation Axes Distribution');
mtexFig.drawNow('figSize',getMTEXpref('figSize'),varargin{:});

end

if nargout==0, clear h;end
9 changes: 6 additions & 3 deletions EBSDAnalysis/@misorientationAnalysis/plotAxisDistribution.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ function plotAxisDistribution(obj,varargin)
% S2Grid/plot savefigure Plotting Annotations_demo ColorCoding_demo PlotTypes_demo
% SphericalProjection_demo

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

% calc axis distribution
axes = calcAxisDistribution(obj,'SampleSize',10000,varargin{:});

% plot
plot(axes,'all','FundamentalRegion',varargin{:});

set(gcf,'tag','AxisDistribution');
setappdata(gcf,'CS',axes.CS);
set(gcf,'Name','Axis Distribution');
if isNew % finalize plot
set(gcf,'Name','Misorientation Axes Distribution');
mtexFig.drawNow('figSize',getMTEXpref('figSize'),varargin{:});
end
18 changes: 9 additions & 9 deletions EBSDAnalysis/phaseList.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
% ensure that there is at least one notIndexed phase
% by prepending it !! TODO
% this probably requires to specify phaseMap as an option
%if all(cellfun(@(x) isa(x,'symmetry'),pL.CSList))
% pL.CSList = [{'not indexed'},pL.CSList(:)];
% pL.phaseId = pL.phaseId + 1;
% if ismember(0,pL.phaseMap)
% pL.phaseMap = [-1;pL.phaseMap];
% else
% pL.phaseMap = [0;pL.phaseMap];
% end
%end
if all(cellfun(@(x) isa(x,'symmetry'),pL.CSList))
pL.CSList = [{'not indexed'},pL.CSList(:)];
pL.phaseId = pL.phaseId + 1;
if ismember(0,pL.phaseMap)
pL.phaseMap = [-1;pL.phaseMap];
else
pL.phaseMap = [0;pL.phaseMap];
end
end

% apply colors
colorOrder = getMTEXpref('EBSDColorNames');
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.12
RNAME = mtex-4.0.13
RDIR = ../releases
release:
rm -rf $(RDIR)/$(RNAME)*
Expand Down
19 changes: 12 additions & 7 deletions ODFAnalysis/@ODF/plotAxisDistribution.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function plotAxisDistribution(odf,varargin)
function h = plotAxisDistribution(odf,varargin)
% plot axis distribution
%
% Input
Expand All @@ -15,19 +15,24 @@ function plotAxisDistribution(odf,varargin)
% S2Grid/plot savefigure Plotting Annotations_demo ColorCoding_demo PlotTypes_demo
% SphericalProjection_demo

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

% plotting grid
sR = fundamentalSector(disjoint(odf.CS,odf.SS),'antipodal',varargin{:});
h = plotS2Grid(sR,'antipodal',varargin{:});

% plot
smooth(h,pos(calcAxisDistribution(odf,h,varargin{:})),varargin{:});
h = smooth(h,pos(calcAxisDistribution(odf,h,varargin{:})),varargin{:},'doNotDraw');

if isNew % finalize plot
setappdata(gcf,'CS',odf.CS);
name = inputname(1);
set(gcf,'Name',['Axis Distribution of ',name]);
mtexFig.drawNow('figSize',getMTEXpref('figSize'),varargin{:});
end

setappdata(gcf,'CS',odf.CS);
setappdata(gcf,'SS',odf.SS);
set(gcf,'tag','AxisDistribution');
if nargout == 0, clear h; end

name = inputname(1);
set(gcf,'Name',['Axis Distribution of ',name]);

function d = pos(d)

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

0 comments on commit 991b041

Please sign in to comment.