diff --git a/3_pairmatchingGUI/gtMatchFitParameters.m b/3_pairmatchingGUI/gtMatchFitParameters.m index 94c8b50c0d545c2769533011b02fecf0ebbb6ab7..ec759db73796cd06114c376947673c58c4b63463 100644 --- a/3_pairmatchingGUI/gtMatchFitParameters.m +++ b/3_pairmatchingGUI/gtMatchFitParameters.m @@ -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); diff --git a/3_pairmatchingGUI/gtMatchInitialize.m b/3_pairmatchingGUI/gtMatchInitialize.m index dc76d0a1050f751b54cdbb5f3b740100137517ae..c665102c86f215ef2dab78c653421e96a520ffdb 100644 --- a/3_pairmatchingGUI/gtMatchInitialize.m +++ b/3_pairmatchingGUI/gtMatchInitialize.m @@ -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 diff --git a/3_pairmatchingGUI/gtMatchLatticeParDependencies.m b/3_pairmatchingGUI/gtMatchLatticeParDependencies.m index 3809b623df6eb924d3b84ff9c5e96ec4e51ff161..9395b905694509c25a89caa22de448b9629f2c7a 100644 --- a/3_pairmatchingGUI/gtMatchLatticeParDependencies.m +++ b/3_pairmatchingGUI/gtMatchLatticeParDependencies.m @@ -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'