Attention: The EBRAINS drive will be unavailable for most of the weekend starting the 25th October. Although the Lab is availble while the Drive is down, files that are stored in the Drive will not be loaded and you will be unable to save documents directly on the Lab.


Changes for page Code description

Last modified by galluzziandrea on 2022/06/20 12:33

From version 8.1
edited by galluzziandrea
on 2021/12/09 14:58
Change comment: There is no comment for this version
To version 6.1
edited by galluzziandrea
on 2021/12/09 14:47
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -36,7 +36,8 @@
36 36  
37 37  === Define necessary classes to import the Initialization Files: ===
38 38  
39 -{{code language="python" title=" "}}
39 +{{code language="python" width="90%" title="
40 +120%"}}
40 40  class ImportIniLIFCA():
41 41   #initialize the information to look for in perseo.ini
42 42   inf=["NeuronType", #still fixed value
... ... @@ -235,94 +235,9 @@
235 235  # [.....],[],...]
236 236  {{/code}}
237 237  
238 -=== Defining general and nest.kernel parameters ===
239 239  
240 -{{code language="python"}}
241 -#############################------------------------------------------------------------------------
242 -#Clean the Network
243 -#############################------------------------------------------------------------------------
244 -nest.ResetKernel()
245 245  
246 -#############################------------------------------------------------------------------------
247 -#insert the introductory parameters of the simulation
248 -#############################------------------------------------------------------------------------
249 249  
250 -
251 -dt = 0.1 # the resolution in ms
252 -StartMisure=0. # start time of measurements
253 -simtime = int(float(InfoPerseo[3])) # Simulation time in ms (200 s)
254 -if simtime<=StartMisure: # If the simulation time is less than StartMisure, it is increased by StartMisure
255 - simtime=simtime+StartMisure
256 -start=0.0 # start time of poissonian processes
257 -origin=0.0 # temporal origin
258 -
259 -#############################------------------------------------------------------------------------
260 -# Kernel parameters
261 -#############################------------------------------------------------------------------------
262 -LNT=multiprocessing.cpu_count();
263 -nest.SetKernelStatus({"local_num_threads": LNT})
264 -nest.SetKernelStatus({"resolution": dt, "print_time": True,
265 - "overwrite_files": True})
266 -
267 -#############################------------------------------------------------------------------------
268 -#"randomize" the seeds of the random generators
269 -#############################------------------------------------------------------------------------
270 -
271 -#msd = int(math.fabs(time.process_time()*1000))
272 -#N_vp = nest.GetKernelStatus(['total_num_virtual_procs'])[0]
273 -#pyrngs = [numpy.random.RandomState(s) for s in range(msd, msd+N_vp)]
274 -#nest.SetKernelStatus({"grng_seed" : msd+N_vp})
275 -#nest.SetKernelStatus({"rng_seeds" : list(range(msd+N_vp+1, msd+2*N_vp+1))})
276 -{{/code}}
277 -
278 -=== Building the network: neuronal populations , Poisson processes and spike detectors ===
279 -
280 -{{code language="python"}}
281 -#############################------------------------------------------------------------------------
282 -print("Building network")
283 -#############################------------------------------------------------------------------------
284 -
285 -startbuild = time.time() #initialize the calculation of the time used to simulate
286 -
287 -NeuronPop=[]
288 -NoisePop=[]
289 -DetectorPop=[]
290 -
291 -#define and initialize the populations of neurons with the parameters extracted from the.ini files
292 -for i in range(1,int(InfoBuild[0])+1):
293 - if int(InfoBuild[i][7])==0:
294 - app=float(InfoBuild[i][5])
295 - else:
296 - app=0.
297 - app2= nest.Create("aeif_psc_exp", int(InfoBuild[i][0]),params={"C_m": 1.0,
298 - "g_L": 1.0/float(InfoBuild[i][3]),
299 - "t_ref": float(InfoBuild[i][6]),
300 - "E_L": 0.0,
301 - "V_reset": float(InfoBuild[i][5]),
302 - "V_m": app,
303 - "V_th": float(InfoBuild[i][4]),
304 - "Delta_T": 0.,
305 - "tau_syn_ex": 1.0,
306 - "tau_syn_in": 1.0,
307 - "a": 0.0,
308 - "b": float(InfoBuild[i][10]),
309 - "tau_w": float(InfoBuild[i][9]),
310 - "V_peak":float(InfoBuild[i][4])+10.0})
311 - NeuronPop.append(app2)
312 -
313 -#define and initialize the poisson generators and the spike detectors with the parameters extracted from the.ini files
314 -
315 -for i in range(1,int(InfoBuild[0])+1):
316 - app3= nest.Create("poisson_generator",params={"rate": float(InfoBuild[i][1]*InfoBuild[i][2]),
317 - 'origin':0.,
318 - 'start':start})
319 - NoisePop.append(app3)
320 - app4 = nest.Create("spike_recorder",params={ "start":StartMisure})
321 - DetectorPop.append(app4)
322 -
323 -endbuild = time.time()
324 -{{/code}}
325 -
326 326  === Results ===
327 327  
328 328  ==== ====