-
Notifications
You must be signed in to change notification settings - Fork 15
/
paramGenerator.py
46 lines (36 loc) · 1006 Bytes
/
paramGenerator.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
'''
© Author: Saunak Saha
Iowa State University
'''
import sys
import numpy as np
#accepting command-line arguments
variable = sys.argv[1]
start_val = float(sys.argv[2])
end_val = float(sys.argv[3])
step_val = float(sys.argv[4])
#reading values fromm default file
f = open('parameters_default.txt',"r")
lines = f.readlines()
params = []
for x in lines:
params.append(x.split())
f.close()
params = np.array(params)
#fixing variable in question
varIndex=90
for m in range (0,23):
if(variable==params[m,0]):
varIndex=m
break
#generating new files with range of values as required
params2 = params
values = np.arange(start_val, end_val+step_val , step_val)
i=0
for n in values:
params2[varIndex,2]=n
np.savetxt('parameters_'+variable+'_'+str(i)+'.txt', params2, fmt='%s')
i+=1
#calculating number of simulations required
simNumber = (end_val - start_val)/step_val+1
print("Put simNumber as: "+str(simNumber));