-
Notifications
You must be signed in to change notification settings - Fork 1
/
getSCTLfits.m
40 lines (30 loc) · 1.59 KB
/
getSCTLfits.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function [ parameters_SCTL ] = getSCTLfits( Model,Data,n_starts)
iD = 1;
for iData = 1:length(Data)
parameters.name = arrayfun(@(x) ['phi_{' '}'],Model.exp{1}.ind_phi,'UniformOutput',false);
parameters.min = -5*ones(size(parameters.name));
parameters.max = -parameters.min;
parameters.number = length(parameters.max);
optionsMultistart = PestoOptions();
optionsMultistart.n_starts = n_starts;
optionsMultistart.comp_type = 'sequential';
optionsMultistart.mode = 'text';
optionsMultistart.obj_type = 'log-posterior';
if(isfield(Data{iData},'SCTL'))
if(~isfield(Data{iData}.SCTL,'T'))
Data{iData}.SCTL.T = zeros(0,1,size(Data{iData}.SCTL.Y,3));
end
tmp = arrayfun(@(x) any(~isnan(Data{iData}.SCTL.Y(:,:,x)),2),1:size(Data{iData}.SCTL.Y,3),'UniformOutput',false);
Data{iData}.SCTL.ind_y = [tmp{:}];
tmp = arrayfun(@(x) any(~isnan(Data{iData}.SCTL.T(:,:,x)),2),1:size(Data{iData}.SCTL.T,3),'UniformOutput',false);
Data{iData}.SCTL.ind_t = [tmp{:}];
for icl = 1:size(Data{iData}.SCTL.Y,3)
objective_function = @(phi) objective_phi_wrapper(phi,Model,Data,iData,icl);
parameters_SCTL{iD,icl} = getMultiStarts(parameters, objective_function, optionsMultistart);
% parameters_SCTL{iD,icl} = getParameterProfiles(parameters_SCTL{iD,icl}, objective_function, optionsMultistart);
% parameters_SCTL{iD,icl} = getParameterSamples(parameters_SCTL{iD,icl}, objective_function, optionsMultistart);
end
iD = iD+1;
end
end
end