Skip to content
Snippets Groups Projects
Commit 2ffddbab authored by Laura Nervo's avatar Laura Nervo
Browse files

Code formatting ... small changes


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent 448c3f27
No related branches found
No related tags found
No related merge requests found
......@@ -2,30 +2,30 @@ function grain = gtIndexFwdSimGrains(grain, parameters, fsimID)
% GTINDEXFWDSIMGRAINS Forward simulates the spot positions for all
% reflections in all grains.
%
% grain = gtIndexFwdSimGrains(grain, parameters, fsimID)
% ------------------------------------------------------
% It should be run after gtIndexAddInfo.
% grain = gtIndexFwdSimGrains(grain, [parameters], [fsimID])
% ----------------------------------------------------------
% It should be run after gtIndexAddInfo, like below:
%
% index = load('4_grains/phase_##/index.mat')
% grain = gtIndexAddInfo(index.grain, phaseid, parameters);
%
% INPUT
% grain = cell array containing grains as in index.mat
% parameters = parameters as in the parameters file
% fsimID = fsim id {1}
% grain = <cell> structure containing grain information
% parameters = <struct> parameters as in the parameters file
% fsimID = <double> forward simulation id - in case we want to forward simulate
% on more than one detector {1}
%
% OUTPUT
% grain.fsim = added field containing fwd simulation data:
% .cu = U coordinate of center
% .cv = U coordinate of center
% .cw = W (image no.) coordinate of center
% .eta = eta diffraction angle in degrees
% .sinth = sin(theta)
% .plref = plane normal in reference crystal (unstrained theoretical)
% .refind = linear index of reflection in grain
% .thetatype = thetatype
%tic
% grain.fsim = <struct> added field containing fwd simulation data:
% .cu = <double> U coordinate of center
% .cv = <double> U coordinate of center
% .cw = <double> W (image no.) coordinate of center
% .eta = <double> eta diffraction angle in degrees
% .sinth = <double> sin(theta)
% .plref = <double> plane normal in reference crystal (unstrained theoretical)
% .refind = <double> linear index of reflection in grain
% .thetatype = <double> thetatype
if ~exist('parameters','var') || isempty(parameters)
parameters = load('parameters.mat');
......@@ -42,6 +42,7 @@ end
if ~isfield(labgeo, 'detnorm')
labgeo.detnorm = cross(labgeo.detdiru, labgeo.detidirv);
end
samgeo = parameters.samgeo;
cryst = parameters.cryst(grain{1}.phaseid);
energy = parameters.acq.energy;
......@@ -158,25 +159,22 @@ parfor ii = 1:length(grain)
% measurement errors, do not correct for the image number
% to be mod(om,360)/omstep
grain{ii}.fsim(fsimID).cu = uv(1,keep);
grain{ii}.fsim(fsimID).cv = uv(2,keep);
grain{ii}.fsim(fsimID).cw = om(keep)/omstep;
grain{ii}.fsim(fsimID).com = om(keep);
grain{ii}.fsim(fsimID).eta = gtGeoEtaFromDiffVec(dveclab(:,keep)', labgeo)';
grain{ii}.fsim(fsimID).sinth = sinth4(keep);
grain{ii}.fsim(fsimID).plref = plref4(:,keep);
grain{ii}.fsim(fsimID).refind = refind4(:,keep);
grain{ii}.fsim(fsimID).cu = uv(1,keep);
grain{ii}.fsim(fsimID).cv = uv(2,keep);
grain{ii}.fsim(fsimID).cw = om(keep)/omstep;
grain{ii}.fsim(fsimID).com = om(keep);
grain{ii}.fsim(fsimID).eta = gtGeoEtaFromDiffVec(dveclab(:,keep)', labgeo)';
grain{ii}.fsim(fsimID).sinth = sinth4(keep);
grain{ii}.fsim(fsimID).plref = plref4(:,keep);
grain{ii}.fsim(fsimID).refind = refind4(:,keep);
grain{ii}.fsim(fsimID).thetatype = thtype4(keep);
%grain{ii}.fsim(fsimID).dveclab = reshape(dveclab,3,[],4);
%grain{ii}.fsim(fsimID).dvecsam = reshape(dvecsam,3,[],4);
grain{ii}.fsim(fsimID).dveclab = reshape(dveclab,3,[],4);
%grain{ii}.fsim(fsimID).dvecsam = reshape(dvecsam,3,[],4);
end
end % end parfor loop
%toc
end % of main function
function [row,col,val] = findArrayIntoArray(toBeFound,whereToFind)
% FINDARRAYINTOARRAY Finds array 'whereToFind' elements in array 'toBeFound'
% [ind,col,val] = findArrayIntoArray(toBeFound,whereToFind)
% [row,col,val] = findArrayIntoArray(toBeFound,whereToFind)
% ---------------------------------------------------------
% Inputs are transformed into columns. Uses find().
%
......
......@@ -37,7 +37,7 @@ gff = cell2mat(C);
rod = gff(:,4:6); % rx ry rz
cen = gff(:,1:3); % x y z
U = gff(:,7:15); % ... U11 U12 U13 U21 U22 U23 U31 U32 U33
U = gff(:,7:15); % ... U11 U12 U13 U21 U22 U23 U31 U32 U33
eps = gff(:,16:end); % ... eps11 eps22 eps33 eps23 eps13 eps12
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
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