-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetupGrimbertCangParameterScan.m
More file actions
68 lines (49 loc) · 1.65 KB
/
setupGrimbertCangParameterScan.m
File metadata and controls
68 lines (49 loc) · 1.65 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% This script sets up the parameter scan for the Grimbert and Cang
% model
runList = 'experiments/GrimbertCang-exploration/runList-%d.txt';
parentCFG = 'experiments/GrimbertCang-wt.txt';
outCFGmask = 'experiments/GrimbertCang-exploration/GrimbertCang-wt-%d.txt';
alphaRange = 0:0.2:1;
betaRange = 1;
thetaRange = 0.1:0.05:0.3;
rhoRange = 0.01:0.02:0.1;
simID = 1;
nJobs = 6;
for i = 1:nJobs
listName = sprintf(runList, i);
fidList(i) = fopen(listName,'w');
end
for iA = 1:numel(alphaRange)
for iB = 1:numel(betaRange)
for iT = 1:numel(thetaRange)
for iR = 1:numel(rhoRange)
fid = fopen(parentCFG,'r');
fName = sprintf(outCFGmask,simID);
fidOut = fopen(fName,'w');
str = fgets(fid);
while(str ~= -1)
% Copy the string to the output
fprintf(fidOut, str);
if(findstr(str,'simName'))
% Add ID to config file name
str = strrep(str,';',sprintf('-%d;', simID));
end
str = fgets(fid);
end
fclose(fid);
% Add extra parameters
fprintf(fidOut,'obj.info.params.alpha = %f;\n', alphaRange(iA));
fprintf(fidOut,'obj.info.params.beta = %f;\n', betaRange(iB));
fprintf(fidOut,'obj.info.params.theta = %f;\n', thetaRange(iT));
fprintf(fidOut,'obj.info.params.rho = %f;\n', rhoRange(iR));
fclose(fidOut);
jobID = mod(simID-1,nJobs)+1;
fprintf(fidList(jobID),'runGrimbertCang([],true,1,false,%s);\n',fName);
simID = simID + 1;
end
end
end
end
for i = 1:numel(fidList)
fclose(fidList(i));
end