Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinofsakh committed Nov 1, 2014
1 parent fb064fc commit 4374555
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
19 changes: 14 additions & 5 deletions func/OR/getVariants.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [v, ind] = getVariants(o, ORmat, CS)
function [v, ind] = getVariants(o, ORmat, CS, varargin)
% Get all crystallographic variant of transformation products.
% Array 'v' contain all variants. Variants groups by symmetry, first
% variants for one rotation.
Expand All @@ -21,9 +21,18 @@
% Set misorientation
ORr = rotation('matrix', ORmat);

% Some variants
v0 = o*CS*ORr;
v = orientation(v0,get(o,'CS'),get(o,'SS'));
ind = repmat(1:length(o),1,size(CS,1))'; % ???
if check_option(varargin, 'someVariants')
i = get_option(varargin, 'someVariants');
% Some variants
v00 = ORr*o;
v0 = inverse(rotation(CS(i)))*v00(:);
v = orientation(v0,get(o,'CS'),get(o,'SS'));
ind = ones(length(v),1);
else
% Some variants
v0 = o*CS*ORr;
v = orientation(v0,get(o,'CS'),get(o,'SS'));
ind = repmat(1:length(o),1,size(CS,1))'; % ???
end

end
3 changes: 3 additions & 0 deletions func/misc/exportData.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
str = exportEuler(data, style);
case 'matrix'
str = exportMatrix(data, style);
case 'ori'
eul = Euler(data);
str = exportEuler(eul/degree, style);
otherwise
error('Unknown type.')
end
Expand Down
38 changes: 31 additions & 7 deletions func/recon/findUniqueParent.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,14 @@
[op, opi] = getVariants(ori, ORmat, CS);
np = length(op);

% Prevent out of memory
if length(op) > getpref('ebsdam', 'maxProbParents')
fprintf('Too much probable parent\n'); return;
end


%% Calculation of probabilities of potential parents

% Angle between potential parents
% aaa = repmat(op, 1, np);
% bbb = repmat(reshape(op,1,np), np,1);
% ma = angle(aaa,bbb);
ma = angle(op\op);

ma = smartAngle(op);

% Check potential parents
% Pp - probability of parent
Expand Down Expand Up @@ -183,6 +178,35 @@
end


function ma = smartAngle(op)
% Prevent out of memory
if length(op) > getpref('ebsdam', 'maxProbParents')
fprintf('Too much probable parent\n');

ma = [];

n0 = getpref('ebsdam', 'maxProbParents');
n1 = length(op);
n = ceil(n1*n1/(n0*n0));
ni = ceil(n1/n);
is = 1;
ie = ni;
for i = 1:n
ind = is:ie;
mai = angle(op(ind)\op);
ma = [ma; mai]; %#ok<AGROW>
is = is + ni;
ie = ie + ni;
if (ie > n1)
ie = n1;
end
end
else
ma = angle(op\op);
end
end


function [bool, PR] = checkRatio(PS, PRmin, Pmin, vn, VNmin)
% Calculate the ratio of parent probabilities
%
Expand Down

0 comments on commit 4374555

Please sign in to comment.