Commit e74dd2ce authored by Antonio Politi's avatar Antonio Politi
Browse files

modify indexomh of boundary

parent 9ac08059
......@@ -2,13 +2,15 @@ classdef dyeFcsmodel < absFcsmodel
% DYEFCSMODEL class to fit auto correlation function coming from dye measurement
% a one component model specific for dye like blinking can be fitted
% There are specific fitting workflows implemented.
% fit is performed by
properties (Access = public)
% these are the default parameters for a dye
par = struct('N', 10, 'thetaT', 0.2, 'tauT', 7, 'f1', 1, 'tauD1', 20, 'alpha1', 1, 'tauD2', 5000, 'alpha2', 1, 'kappa', 5.5);
lb = struct('N', 0.0001, 'thetaT', 0.001,'tauT', 0.1, 'f1', 1, 'tauD1', 1, 'alpha1', 0.5, 'tauD2', 500, 'alpha2', 0.5, 'kappa', 1);
lb = struct('N', 0.0001, 'thetaT', 0.001,'tauT', 0.1, 'f1', 0, 'tauD1', 1, 'alpha1', 0.5, 'tauD2', 500, 'alpha2', 0.5, 'kappa', 1);
hb = struct('N', 10000, 'thetaT', 1, 'tauT', 15, 'f1', 1, 'tauD1', 50000,'alpha1', 1.2, 'tauD2', 500000, 'alpha2', 2, 'kappa', 20);
diffCoeff = [464, 521]; %Alexe488 at 37 degrees, Alexe568 at 37 degrees Malte Wachsmuth SPIM FCS measurement
diffCoeff = [464, 521]; %Alexe488 at 37 degrees, Alexe568 at 37 degrees Malte Wachsmuth SPIM FCS measurement
tauBoundary = [2, 10000]; %boundary of where to fit the data in us
model = 1;
end
methods
......@@ -48,6 +50,9 @@ classdef dyeFcsmodel < absFcsmodel
% GCOMP returns ACF for dye like blinking
% par - struct of parameter values
% tau - time points to evaluate function
if ~isstruct(par)
par = MO.parvecToparstruct(par);
end
triplet = (1 - par.thetaT + par.thetaT*exp(-tau/par.tauT))/(1-par.thetaT);
comp1 = ((1+(tau/par.tauD1).^par.alpha1).^-1).*((1+1/par.kappa^2*(tau/par.tauD1).^par.alpha1).^-0.5);
comp2 = ((1+(tau/par.tauD2).^par.alpha2).^-1).*((1+1/par.kappa^2*(tau/par.tauD2).^par.alpha2).^-0.5);
......@@ -93,7 +98,6 @@ classdef dyeFcsmodel < absFcsmodel
% INPUT:
% data - correlation data [tau, corr]
% kappa - kappa value will be kept fixed. Typically at 5 (this is more stable than allowing for verying thetaT and kappa simultaneously)
% weight - 1, used weighted Chi2; 0, use unweighted Chi2
% OUTPUT:
% outPar - 'N', 'tauD1', 'thetaT', 'tauT'
% norm - norm at optimum
......@@ -107,15 +111,16 @@ classdef dyeFcsmodel < absFcsmodel
%find initial value for tauD1 and N repeat 5 times
for itry = 1:MO.maxfittry
[N, tauD1, tauD2] = MO.initialGuess(data, 2, 10000);
[parf{itry}, normT(itry)] = MO.fitmodel([N, tauD1], {'N', 'tauD1'}, pari, data, 2, 10000);
[N, tauD1, tauD2] = MO.initialGuess(data, MO.tauBoundary);
[parf{itry}, normT(itry)] = MO.fitmodel([N, tauD1], {'N', 'tauD1'}, pari, data, MO.tauBoundary);
end
[val, pos] = min(normT);
parf1 = parf{pos};
%fit thetaT and tauT for a fixed kappa
for itry = 1:MO.maxfittry
[parf{itry}, normT(itry)] = MO.fitmodel([parf1.N, parf1.tauD1, pari.thetaT+(1-2*rand)*pari.thetaT/8, pari.tauT+(1-2*rand)*pari.tauT/8], {'N', 'tauD1', 'thetaT', 'tauT'}, parf1, data, 2, 10000);
[parf{itry}, normT(itry)] = MO.fitmodel([parf1.N, parf1.tauD1, pari.thetaT+(1-2*rand)*pari.thetaT/8, ...
pari.tauT+(1-2*rand)*pari.tauT/8], {'N', 'tauD1', 'thetaT', 'tauT'}, parf1, data, MO.tauBoundary);
end
[val, pos] = min(normT);
parf2 = parf{pos};
......@@ -158,12 +163,12 @@ classdef dyeFcsmodel < absFcsmodel
clear('parf')
for itry = 1:MO.maxfittry
[N, tauD1, tauD2] = MO.initialGuess(data, 2, 10000);
[parf{itry}, normT(itry)] = MO.fitmodel([N, tauD1], {'N', 'tauD1'}, pari, data, 2, 10000);
[parf{itry}, normT(itry)] = MO.fitmodel([N, tauD1], {'N', 'tauD1'}, pari, data, MO.tauBoundary);
end
[val, pos] = min(normT);
parf1 = parf{pos};
[parf, norm(i,1)] = MO.fitmodel([parf1.N, parf1.tauD1], {'N', 'tauD1'}, parf1, data, 2, 10000);
[parf, norm(i,1)] = MO.fitmodel([parf1.N, parf1.tauD1], {'N', 'tauD1'}, parf1, data, MO.tauBoundary);
outPar(i,:) = struct2array(parf);
end
end
......@@ -178,18 +183,21 @@ classdef dyeFcsmodel < absFcsmodel
% norm - norm of fit
for i = 1:length(kappaVal)
pari = MO.par;
pari.kappa = kappaVal(i);
%display(sprintf('Run fit for kappa %.1f ',kappaVal(i)));
% get initial guess for N and tauD1
for itry = 1:MO.maxfittry
[N, tauD1, tauD2] = MO.initialGuess(data, 2, 10000);
[parf{itry}, normT(itry)] = MO.fitmodel([N, tauD1], {'N', 'tauD1'}, pari, data, 2, 10000);
[N, tauD1, tauD2] = MO.initialGuess(data, MO.tauBoundary);
[parf{itry}, normT(itry)] = MO.fitmodel([N, tauD1], {'N', 'tauD1'}, pari, data, MO.tauBoundary);
end
[val, pos] = min(normT);
parf1 = parf{pos};
%fit N, tauD1 and thetaT using initial guess of N and tauD1, tauR remains fixed for all measurements
for itry = 1:MO.maxfittry
[parf{itry}, normT(itry)] = MO.fitmodel([parf1.N, parf1.tauD1, pari.thetaT+(1-2*rand)*pari.thetaT/10 ], {'N', 'tauD1', 'thetaT'}, parf1, data, 2, 10000);
[parf{itry}, normT(itry)] = MO.fitmodel([parf1.N, parf1.tauD1, pari.thetaT+(1-2*rand)*pari.thetaT/10 ], ...
{'N', 'tauD1', 'thetaT'}, parf1, data, MO.tauBoundary);
end
[val, pos] = min(normT);
parf2 = parf{pos};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment