forked from benoit-girard/sBCBG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocalScript.py
244 lines (216 loc) · 7.38 KB
/
LocalScript.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#!/usr/bin/python
# -*- coding: utf-8 -*-
#import shlex
# import subprocess
import os
import time
#from SangoScript import recParamExplo, testedParametersIntervals
execTime = time.localtime()
timeString = str(execTime[0])+'_'+str(execTime[1])+'_'+str(execTime[2])+'_'+str(execTime[3])+':'+str(execTime[4])
print 'Time:', timeString
# job for one parameterization test:
#-----------------------------------------
def launchOneParameterizedRun(i):
print "Ready to launch job",i
IDstring = timeString+'_%05d' %(i)
print 'Create subdirectory:',IDstring
os.system('mkdir '+IDstring)
os.system('cp LGneurons.py '+IDstring+'/')
os.system('cp testFullBG.py '+IDstring+'/')
os.system('cp testChannelBG.py '+IDstring+'/')
os.system('cp plot_tools.py '+IDstring+'/')
os.system('cp solutions_simple_unique.csv '+IDstring+'/')
os.system('cp __init__.py '+IDstring+'/')
os.chdir(IDstring)
os.system('mkdir log')
os.system('ls -l')
# creation of the modelParams.py file that will correspond to the run at hand
mltstr = '''#!/apps/free/python/2.7.10/bin/python
# defines the value of the parameters that will be used by testFullbG.py
# generated by sangoScript.py
interactive = False
params = {'nbcpu': %s,
'nbCh' : %d,
'LG14modelID': %2d,
'whichTest': '%s', # which test was used to generate the log
'nbMSN': %f,
'nbFSI': %f,
'nbSTN': %f,
'nbGPe': %f,
'nbGPi': %f,
'nbCSN': %f,
'nbPTN': %f,
'nbCMPf': %f,
'GMSN': %4.2f,
'GFSI': %4.2f,
'GSTN': %4.2f,
'GGPe': %4.2f,
'GGPi': %4.2f,
'IeGPe': %3.1f,
'IeGPi': %3.1f,
'inDegCSNMSN': 100.,
'inDegPTNMSN': 1.,
'inDegCMPfMSN': 1.,
'inDegFSIMSN': 30., # according to Humphries et al. 2010, 30-150 FSIs->MSN
'inDegMSNMSN': 70., # according to Koos et al. 2004, cited by Humphries et al., 2010, on avg 3 synpase per MSN-MSN connection
'inDegSTNMSN': 0.001,
'inDegGPeMSN': 0.002,
'inDegCSNFSI': 50.,
'inDegPTNFSI': 1.,
'inDegSTNFSI': 2.,
'inDegGPeFSI': 25.,
'inDegCMPfFSI': 9.,
'inDegFSIFSI': 15., # according to Humphries et al., 2010, 13-63 FSIs->FSI
'inDegPTNSTN': 25.,
'inDegCMPfSTN': 9.,
'inDegGPeSTN': 25.,
'inDegCMPfGPe': 9.,
'inDegSTNGPe': 8.,
'inDegMSNGPe':2644.,
'inDegGPeGPe': 25.,
'inDegMSNGPi':2644.,
'inDegSTNGPi': 8.,
'inDegGPeGPi': 23.,
'inDegCMPfGPi': 9.,
}
''' %(testedParameters['nbcpu'],testedParameters['nbch'],testedParameters['lg14modelid'],testedParameters['whichTest'],testedParameters['nbmsn'],testedParameters['nbfsi'],testedParameters['nbstn'],testedParameters['nbgpe'],testedParameters['nbgpi'],testedParameters['nbcsn'],testedParameters['nbptn'],testedParameters['nbcmpf'],testedParameters['gmsn'],testedParameters['gfsi'],testedParameters['gstn'],testedParameters['ggpe'],testedParameters['ggpi'],testedParameters['iegpe'],testedParameters['iegpi'])
# comment :
"""params = {'nbCh': %d,
'LG14modelID': %2d,
'whichTest': '%s', # which test was used to generate the log
'nbMSN': 2644.,
'nbFSI': 53.,
'nbSTN': 8.,
'nbGPe': 25.,
'nbGPi': 14.,
'nbCSN': %5.f,
'nbPTN': %4.f,
'nbCMPf': 9.,
'GMSN': %4.2f,
'GFSI': %4.2f,
'GSTN': %4.2f,
'GGPe': %4.2f,
'GGPi': %4.2f,
'IeGPe': %3.1f,
'IeGPi': %3.1f,
'inDegCSNMSN': 100.,
'inDegPTNMSN': 1.,
'inDegCMPfMSN': 1.,
'inDegFSIMSN': 30., # according to Humphries et al. 2010, 30-150 FSIs->MSN
'inDegMSNMSN': 70., # according to Koos et al. 2004, cited by Humphries et al., 2010, on avg 3 synpase per MSN-MSN connection
'inDegSTNMSN': 0.,
'inDegGPeMSN': 0.,
'inDegCSNFSI': 50.,
'inDegPTNFSI': 1.,
'inDegSTNFSI': 2.,
'inDegGPeFSI': 25.,
'inDegCMPfFSI': 9.,
'inDegFSIFSI': 15., # according to Humphries et al., 2010, 13-63 FSIs->FSI
'inDegPTNSTN': 25.,
'inDegCMPfSTN': 9.,
'inDegGPeSTN': 25.,
'inDegCMPfGPe': 9.,
'inDegSTNGPe': 8.,
'inDegMSNGPe':2644.,
'inDegGPeGPe': 25.,
'inDegMSNGPi':2644.,
'inDegSTNGPi': 8.,
'inDegGPeGPi': 23.,
'inDegCMPfGPi': 9.,
}
''' %(nbch,lg14modelid,whichtest,nbcsn,nbptn,gmsn,gfsi,gstn,ggpe,ggpi,iegpe,iegpi)
"""
print 'Write modelParams.py'
paramsFile = open('modelParams.py','w')
paramsFile.writelines(mltstr)
paramsFile.close()
# execute the script file
#command = 'python testFullBG.py'
command = 'python '+whichtest+'.py'
os.system(command)
os.chdir('..')
#===============================
'''
for iegpi in [10.,11.,12.]:
launchOneParameterizedRun(i)
i+=1
'''
i = 0
# which LG14 parameterization to use?
lg14modelid = 2
# which test will be carried out?
whichtest = 'testFullBG' # can be testFullBG, testChannelBG
nbch = 1
# with which additional parameters?
nbcsn = 3000.
nbptn = 100.
'''
gmsn=3.
gfsi=1.
gstn=1.4
ggpe=1.
ggpi=1.
iegpe=15.
iegpi=11.
'''
gmsn=4.
gfsi=1.
gstn=1.4
ggpe=1.
ggpi=1.
iegpe=11.
iegpi=12.
# To get the multi tests with Ie and the gains for GPe and GPi trying multiple values
# params in SangoScript but in Local
# with which additional parameters?
testedParameters={'durationH': '04',
'durationMin': '00',
'nbcpu': '8',
'whichTest': 'testFullBG',
'nbch': 1,
'lg14modelid': 2,
'nbmsn':2644.,
'nbfsi': 53.,
'nbstn': 8.,
'nbgpe': 25.,
'nbgpi': 14.,
'nbcsn':3000.,
'nbptn': 100.,
'nbcmpf': 9.,
'gmsn': 4.,
'gfsi': 1.,
'gstn': 1.4,
'ggpe': 1.,
'ggpi': 1.,
'iegpe': 11.,
'iegpi': 11.,
}
testedParametersIntervals = {}
testedParametersIntervals['gmsn']=[2.,3.,4.]
testedParametersIntervals['gfsi']=[1., 1.1, 1.2]
testedParametersIntervals['gstn']=[1., 1.1, 1.2,1.3,1.4]
testedParametersIntervals['ggpe']=[1., 1.1, 1.2]
testedParametersIntervals['ggpi']=[1., 1.1, 1.2]
testedParametersIntervals['iegpe']=[11.,12.,13.]
testedParametersIntervals['iegpi']=[10.,11.,12.]
def recParamExplo(pdict):
if len(pdict)>0:
paramK = pdict.keys()[0]
calldict = pdict.copy()
del calldict[paramK]
for v in pdict[paramK]:
testedParameters[paramK]=v
recParamExplo(calldict)
else:
global i
launchOneParameterizedRun(i)
#print i,"->",testedParameters
i+= 1
recParamExplo(testedParametersIntervals)
'''
# To test specified params
#nbcsn=12000.
#nbptn=400.
launchOneParameterizedRun(i)
i+=1
'''