Diff of /tasks_within/generate.py [000000] .. [5d1c0a]

Switch to unified view

a b/tasks_within/generate.py
1
'''Training script generator for subject-specific classification.
2
'''
3
with open('script.sh.template', 'r') as f:
4
    sh_template = f.read()
5
with open('train.pbs.template', 'r') as f:
6
    pbs_template = f.read()
7
8
command_template = 'python train_within.py $datapath $outpath -start {0} -end {1} -gpu {2} > $logpath/stdout.f{2}.out &'
9
10
commands = []
11
for i in range(8):
12
    start = i * 7 + 1
13
    end = min(i * 7 + 8, 55)
14
    commands.append(command_template.format(start, end, i))
15
16
commands.append('wait')
17
content = sh_template + '\n'.join(commands)
18
with open('script.' + str(0) + '.sh', 'w') as f:
19
    f.write(content)
20
content = pbs_template.format(0)
21
with open('train.' + str(0) + '.pbs', 'w') as f:
22
    f.write(content)