forked from keithw/datagrump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-range.py
executable file
·47 lines (35 loc) · 1.06 KB
/
run-range.py
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
#!/usr/bin/python
import sys
import os
import itertools
import subprocess
experiment_values = []
TOTAL_PARAMS = 4
# Generate the ranges for each set of 3 inputs
i = 1
while i < len(sys.argv):
start = float(sys.argv[i])
step = float(sys.argv[i+1])
end = float(sys.argv[i+2])
values = []
j = start
while j <= end:
values.append(j)
j += step
if len(values) < 1:
values.append(start)
experiment_values.append(values)
i += 3
# We now have a list of lists. Each sublist is the range of values for that parameter.
# Generate the combinations of values for that make up the experimental conditions
combos = list(itertools.product(*experiment_values))
for combo in combos:
combo = list(combo)
print "Running trial with", combo
while len(combo) < TOTAL_PARAMS:
combo.append(0)
os.environ['ALPHA'] = str(combo[0])
os.environ['BETA'] = str(combo[1])
os.environ['GAMMA'] = str(combo[2])
os.environ['DELTA'] = str(combo[3])
subprocess.call("./run-trial.py pquimby", shell=True)