Skip to content
Snippets Groups Projects
Commit b1015398 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

gtFedPredictOmegaMultiple: made output consistent with gtFedPredictOmega

parent 1d613a13
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,7 @@ function [om, plrot, plsigned, rot, omind] = gtFedPredictOmegaMultiple(...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Quadratic equation for omega angles
%%% Quadratic equation for omega angles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nn = size(pl,2);
......@@ -86,55 +86,53 @@ end
D = A.^2 + B.^2 ;
if ~isempty(omind)
if (~isempty(omind))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Single omega index
%%% Single omega index
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if length(omind)==1
omind = omind(1,ones(1,nn));
if (length(omind) == 1)
omind = omind(1, ones(1, nn));
end
ssp = ((omind==1) | (omind==2));
ssp = ((omind == 1) | (omind == 2));
ss = ssp - ~ssp;
ss3 = ss([1 1 1],:);
ss3 = ss([1 1 1], :);
CC = C + ss.*sinth;
DD = D - CC.^2;
CC = C + ss .* sinth;
DD = D - CC .^ 2;
E = sqrt(DD);
ok = DD > 0;
ssp = ((omind==2) | (omind==3));
ssp = ((omind == 1) | (omind == 3));
ss = ssp - ~ssp;
ss = ss.*ok;
om = 2*atand((-B + ss.*E) ./ (CC - A));
ss = ss .* ok;
om = 2*atand((-B + ss .* E) ./ (CC - A));
om(~ok) = NaN;
% Limit range
om = mod(om,360);
om = mod(om, 360);
% ROTATION MATRICES AND PLANE NORMALS IN LAB
% Get rotation matrix and multpily the input plane normals to get
% them in the diffracting position
rot = gtMathsRotationTensor(om, rotcomp);
% expand for multiplication
plt = reshape(pl,1,[]);
plt = plt([1 1 1],:);
plrot = reshape(rot,3,[]).*plt;
plrot = plrot(:,1:3:end) + plrot(:,2:3:end) + plrot(:,3:3:end);
plrot = reshape(plrot,3,[]);
plrot = ss3.*plrot;
plsigned = ss3.*pl;
plt = reshape(pl, 1, 3, []);
plt = plt([1 1 1], :, :);
plrot = rot .* plt;
plrot = sum(plrot, 2);
plrot = reshape(plrot, 3, []);
plrot = ss3 .* plrot;
plsigned = ss3 .* pl;
else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% All four omega indices
%%% All four omega indices
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
om = NaN(4,nn);
......@@ -146,8 +144,8 @@ else
ok = DD > 0;
E = sqrt(DD(ok));
om(1, ok) = 2*atand((-B(ok)-E)./(CC(ok)-A(ok)));
om(2, ok) = 2*atand((-B(ok)+E)./(CC(ok)-A(ok)));
om(1, ok) = 2*atand((-B(ok)+E)./(CC(ok)-A(ok)));
om(2, ok) = 2*atand((-B(ok)-E)./(CC(ok)-A(ok)));
% Diffraction condition 2
% Pl_rot and beamdir dotproduct equals +sin(th)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment