-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathexperiment_gen.m
More file actions
executable file
·47 lines (38 loc) · 1.49 KB
/
experiment_gen.m
File metadata and controls
executable file
·47 lines (38 loc) · 1.49 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
function experiment_gen(exp_path, orig_hl_tpl_path, hl_basis, orig_tpl_path, n, p)
mkdir(exp_path);
tpl_name = 'tpl';
tpl_path = [exp_path, '\\', tpl_name, '.tpl'];
copyfile(orig_tpl_path, tpl_path);
% FIXME: shouldn't need this additional template. This is workaround
% for readfchk bug.
hl_tpl_name = 'hl_tpl';
hl_tpl_path = [exp_path, '\\', hl_tpl_name, '.tpl'];
copyfile(orig_hl_tpl_path, hl_tpl_path);
% Generate high-level model with fixed basis set
frag_cfg = Fragment.defaultConfig();
frag_cfg.template = hl_tpl_name;
frag_cfg.basisSet = hl_basis;
frag_cfg.par = [1.0 1.0 1.0 1.0 1.0];
frag = Fragment(exp_path, frag_cfg);
save([exp_path, '\\', 'frag.mat'], 'frag');
% Generate low-level model with custom basis sets
for i=1:p
fraghat_cfg = Fragment.defaultConfig();
fraghat_cfg.template = tpl_name;
fraghat_cfg.basisSet = 'GEN';
r = normrnd(1.0, 0.02, 1,3);
fraghat_cfg.par = [r(1) r(2) r(2) r(3) r(3)];
fraghats{i} = Fragment(exp_path, fraghat_cfg);
end
save([exp_path, '\\', 'fraghats.mat'], 'fraghats');
% Generate environments and pair up adjacent ones
env(1,2*n) = Environment;
for i = 1:2*n
env(1,i) = Environment.newCube([6,6,6],3);
end
env_pairs = cell(n, 1);
for i = 1:n
env_pairs{i} = {env(2*i - 1), env(2*i)};
end
save([exp_path, '\\', 'env_pairs.mat'], 'env_pairs');
end