Skip to content
Snippets Groups Projects
Commit b71e88cb authored by Wolfgang Ludwig's avatar Wolfgang Ludwig
Browse files

Added an option for geometry fitting in gtMATCHGUI - using same number

of pairs per hkl family  (activate with p.match.equalize_hkls = true)

Signed-off-by: default avatarWolfgang Ludwig <wolfgang.ludwig@esrf.fr>
parent 1b920077
No related branches found
No related tags found
No related merge requests found
......@@ -71,12 +71,37 @@ if ~any(usepair)
return
end
% Crude option to equalize 'weight' between different hkl families
% if activated, we pick the same number of pairs for each family
if handles.fitting.equalize_hkls
tt = unique(handles.pairsfilt.thetatype(usepair));
for j = 1 : numel(tt)
ind_tt(:,j) = handles.pairsfilt.thetatype == tt(j);
ind_tt(:,j) = ind_tt(:,j) & usepair;
num_tt(j) = numel(find(ind_tt(:,j)));
end
min_num = min(num_tt);
for j=1: numel(tt)
ind = find(ind_tt(:,j));
last = ind(min_num);
ind_tt(last+1:end,j) = false;
end
usepair = any(ind_tt,2);
end
pairs.centAU = handles.pairsfilt.centAU(usepair);
pairs.centAV = handles.pairsfilt.centAV(usepair);
pairs.centBU = handles.pairsfilt.centBU(usepair);
pairs.centBV = handles.pairsfilt.centBV(usepair);
pairs.hkl = handles.pairsfilt.hkl(usepair,:);
% Show shortly the pairs to fit in the Eta plot
eta = handles.pairsfilt.eta(usepair);
theta = handles.pairsfilt.theta(usepair);
......
......@@ -306,6 +306,13 @@ handles.fitting.tolfun = 1e-10;
% Step size of finite differences to calculate derivatives
handles.fitting.derstep = 1e-7;
% Activate use of equal number of pairs for fitting
if (exist(parameters.match.equalize_hkls, 'var') || ...
isempty(parameters.match.equalize_hkls)
handles.fitting. equalize_hkls = false;
else
handles.fitting.equalize_hkls = parameters.match.equalize_hkls;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Define blank plot handles
......
......@@ -39,12 +39,12 @@ switch cryst.crystal_system
case 'tetragonal'
% alpha,beta,gamma = 90; lengthb = lengthc
if (lp == 1)
equalpars(1) = true;
if (lp == 3)
equalpars(3) = true;
fitpar = 3;
elseif any(lp==[1,2])
equalpars([1,2]) = true;
fitpar = 1;
elseif any(lp==[2,3])
equalpars([2,3]) = true;
fitpar = 2;
end
case 'trigonal'
......
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