Warning:  Due to planned infrastructure maintenance, the EBRAINS Wiki and EBRAINS Support system will be unavailable for up to three days starting Monday, 14 July. During this period, both services will be inaccessible, and any emails sent to the support address will not be received.

Attention: We are currently experiencing some issues with the EBRAINS Drive. Please bear with us as we fix this issue. We apologise for any inconvenience caused.


Changes for page Code description

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

From version 28.1
edited by mattia
on 2022/01/28 13:39
Change comment: There is no comment for this version
To version 8.1
edited by galluzziandrea
on 2021/12/09 14:58
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.mattia
1 +XWiki.galluzziandrea
Content
... ... @@ -235,8 +235,6 @@
235 235  # [.....],[],...]
236 236  {{/code}}
237 237  
238 -=== [[image:image-20220127173048-1.png||height="508" width="948"]] ===
239 -
240 240  === Defining general and nest.kernel parameters ===
241 241  
242 242  {{code language="python"}}
... ... @@ -325,207 +325,6 @@
325 325  endbuild = time.time()
326 326  {{/code}}
327 327  
328 -=== [[image:image-20220127165908-2.png||height="659" width="1149"]] ===
326 +=== Results ===
329 329  
330 -=== Connecting the network nodes: neuronal populations, Poisson processes and spike detectors ===
331 -
332 -{{code language="python"}}
333 -#############################------------------------------------------------------------------------
334 -print("Connecting ")
335 -#############################------------------------------------------------------------------------
336 -
337 -startconnect = time.time()
338 -Connessioni=[]
339 -Medie=[]
340 -
341 -#create and define the connections between the populations of neurons and the poisson generators
342 -#and between the populations of neurons and the spike detectors with the parameters extracted from the.ini files
343 -
344 -for i in range(0,int(InfoBuild[0])):
345 - nest.Connect(NoisePop[i], NeuronPop[i], syn_spec={'synapse_model': 'static_synapse_hpc',
346 - 'delay': dt,
347 - 'weight': nest.math.redraw(nest.random.normal(mean=float(InfoConnectNoise[i+1][0]),
348 - std=(float(InfoConnectNoise[i+1][1])*float(InfoConnectNoise[i+1][0]))),
349 - min=0., max=float('Inf'))
350 - })
351 - nest.Connect(NeuronPop[i][:int(InfoBuild[i+1][0])], DetectorPop[i], syn_spec={"weight": 1.0, "delay": dt})
352 -
353 -#create and define the connections between the populations of neurons with the parameters extracted from the.ini files
354 -
355 -for i in range(0,len(InfoConnectPop[1:])):
356 -
357 - conn=nest.Connect(NeuronPop[int(InfoConnectPop[i+1][1])], NeuronPop[int(InfoConnectPop[i+1][0])],
358 - {'rule': 'pairwise_bernoulli',
359 - 'p':float(InfoConnectPop[i+1][2]) },
360 - syn_spec={'synapse_model': 'static_synapse_hpc',
361 - 'delay':nest.math.redraw(nest.random.exponential(beta=float(1./(2.99573227355/(float(InfoConnectPop[i+1][4])-float(InfoConnectPop[i+1][3]))))),
362 - min= numpy.max([dt,float(1./float(InfoConnectPop[i+1][4]))]),
363 - max= float(1./(float(InfoConnectPop[i+1][3])-dt/2))),
364 -
365 - 'weight':nest.random.normal(mean=float(InfoConnectPop[i+1][6]),
366 - std=math.fabs(float(InfoConnectPop[i+1][6])*float(InfoConnectPop[i+1][7])))})
367 -
368 -
369 -endconnect = time.time()
370 -{{/code}}
371 -
372 -=== ===
373 -
374 -=== ===
375 -
376 -=== [[image:image-20220127170722-1.png]] ===
377 -
378 -=== Simulating: neuronal time evolution. ===
379 -
380 -=== ===
381 -
382 -{{code language="python"}}
383 - #############################------------------------------------------------------------------------
384 - print("Simulating")
385 - #############################------------------------------------------------------------------------
386 - ###################################################################################################################################################################
387 - if Salva:
388 - print("I m going to save the data")
389 - #x=str(iterazioni)
390 - f = open(FileName,"w")
391 - if len(InfoProtocol):
392 - print("I m going to split the simulation")
393 - tempo=0
394 - for contatore in range(0,len(InfoProtocol)):
395 - appoggio1=int((tempo+InfoProtocol[contatore][0])/1000.)
396 - appoggio2=int(tempo/1000.)
397 - appoggio3=tempo+InfoProtocol[contatore][0]
398 - if (appoggio1-appoggio2)>=1:
399 - T1=(1+appoggio2)*1000-tempo
400 - nest.Simulate(T1)
401 - #Save the Data!!!!
402 - ###########################################################
403 - Equilibri=[]
404 - for i in range(0,int(InfoBuild[0])):
405 - Equilibri.append([])
406 - a=nest.GetStatus(DetectorPop[i])[0]["events"]["times"]
407 - if len(a)>0:
408 - Trange=(1000*int(numpy.min(a)/1000.),1000*int(numpy.min(a)/1000.)+1000)
409 - hist,Tbin=numpy.histogram(a,200,(Trange[0],Trange[1]))
410 - Equilibri[i]=hist*1000./(5.*int(InfoBuild[i+1][0]))
411 - else:
412 - Trange=(1000*int(tempo/1000.),1000*int(tempo/1000.)+1000)
413 - hist=numpy.zeros(200)
414 - Tbin=numpy.linspace(Trange[0],Trange[1],num=201)
415 - Equilibri[i]=hist
416 - nest.SetStatus(DetectorPop[i],{'n_events':0})
417 - for j in range(0,len(hist)):
418 - f.write(str(Tbin[j])+" ")
419 - for i in range(0,int(InfoBuild[0])):
420 - f.write(str(Equilibri[i][j])+" ")
421 - f.write("\n ")
422 - ###########################################################
423 - tempo=tempo+T1
424 - for contatore2 in range(1,(appoggio1-appoggio2)):
425 - nest.Simulate(1000.)
426 - #Save the Data!!!!
427 - ###########################################################
428 - Equilibri=[]
429 - for i in range(0,int(InfoBuild[0])):
430 - Equilibri.append([])
431 - a=nest.GetStatus(DetectorPop[i])[0]["events"]["times"]
432 - if len(a)>0:
433 - Trange=(1000*int(numpy.min(a)/1000.),1000*int(numpy.min(a)/1000.)+1000)
434 - hist,Tbin=numpy.histogram(a,200,(Trange[0],Trange[1]))
435 - Equilibri[i]=hist*1000./(5.*int(InfoBuild[i+1][0]))
436 - else:
437 - Trange=(1000*int(tempo/1000.),1000*int(tempo/1000.)+1000)
438 - hist=numpy.zeros(200)
439 - Tbin=numpy.linspace(Trange[0],Trange[1],num=201)
440 - Equilibri[i]=hist
441 - nest.SetStatus(DetectorPop[i],{'n_events':0})
442 - for j in range(0,len(hist)):
443 - f.write(str(Tbin[j])+" ")
444 - for i in range(0,int(InfoBuild[0])):
445 - f.write(str(Equilibri[i][j])+" ")
446 - f.write("\n ")
447 - tempo=tempo+1000.
448 - T2=appoggio3-tempo
449 - nest.Simulate(T2);
450 - tempo=tempo+T2;
451 - else:
452 - nest.Simulate(InfoProtocol[contatore][0])
453 - temp=InfoProtocol[contatore][0]
454 - tempo=tempo+temp
455 - if InfoProtocol[contatore][2]==4:
456 - nest.SetStatus(NoisePop[InfoProtocol[contatore][1]],params={"rate": float(InfoBuild[1+InfoProtocol[contatore][1]][2]*InfoProtocol[contatore][3])})
457 - if InfoProtocol[contatore][2]==12:
458 - nest.SetStatus(NeuronPop[InfoProtocol[contatore][1]], params={"b": float(InfoProtocol[contatore][3])})
459 - else:
460 - nest.Simulate(simtime)
461 - tempo=simtime
462 - if (simtime-tempo)>0.:
463 - nest.Simulate(simtime-tempo)
464 -
465 -
466 - endsimulate = time.time()
467 - f.close()
468 - else:
469 - if len(InfoProtocol):
470 - tempo=0
471 - for contatore in range(0,len(InfoProtocol)):
472 - nest.Simulate(InfoProtocol[contatore][0])
473 - temp=InfoProtocol[contatore][0]
474 - tempo=tempo+temp
475 - if InfoProtocol[contatore][2]==4:
476 - nest.SetStatus(NoisePop[InfoProtocol[contatore][1]],params={"rate": float(InfoBuild[1+InfoProtocol[contatore][1]][2]*InfoProtocol[contatore][3])})
477 - #print "Population:", InfoProtocol[contatore][1] ,";Parameter:", InfoProtocol[contatore][2] ,"; Value: ",InfoProtocol[contatore][3]
478 - if InfoProtocol[contatore][2]==12:
479 - nest.SetStatus(NeuronPop[InfoProtocol[contatore][1]], params={"b": float(InfoProtocol[contatore][3])})
480 - #print "Population:", InfoProtocol[contatore][1] ,";Parameter:", InfoProtocol[contatore][2] ,"; Value: ",InfoProtocol[contatore][3]
481 -
482 - else:
483 - nest.Simulate(simtime)
484 - tempo=simtime
485 - if (simtime-tempo)>0.:
486 - nest.Simulate(simtime-tempo)
487 - endsimulate = time.time()
488 -
489 -
490 - ###################################################################################################################################################################
491 -
492 - #############################------------------------------------------------------------------------
493 - #print some information from the simulation
494 - #############################------------------------------------------------------------------------
495 -
496 - num_synapses = nest.GetDefaults('static_synapse_hpc')["num_connections"]
497 - build_time = endbuild - startbuild
498 - connect_time = endconnect - startconnect
499 - sim_time = endsimulate - endconnect
500 -
501 - N_neurons=0
502 - for i in range(0,int(InfoBuild[0])):
503 - N_neurons=N_neurons+int(InfoBuild[i+1][0])
504 -
505 - print(" Network simulation (Python) neuron type:",InfoPerseo[0])
506 - print("Number of neurons : {0}".format(N_neurons))
507 - print("Number of synapses: {0}".format(num_synapses))
508 - print("Building time : %.2f s" % build_time)
509 - print("Connecting time : %.2f s" % connect_time)
510 - print("Simulation time : %.2f s" % sim_time)
511 -
512 -Fine=time.time()
513 -print ("Total Simulation time : %.2f s" % (Fine-Inizio))
514 -{{/code}}
515 -
516 -=== ===
517 -
518 -=== ===
519 -
520 -=== [[image:image-20220127171242-1.png]] ===
521 -
522 -=== Results: ===
523 -
524 -[[the output of this simulation is...>>https://drive.ebrains.eu/smart-link/215f8213-17e3-468b-b573-e6eaf49d315e/]]
525 -
526 -
527 -
528 -
529 -
530 -
531 531  ==== ====
CorticalField_t=80_DeepSpontPlanar.mp4
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -3.4 MB
Content
image-20220127165822-1.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -237.6 KB
Content
image-20220127165908-2.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -106.6 KB
Content
image-20220127170104-1.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -149.6 KB
Content
image-20220127170155-2.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -280.0 KB
Content
image-20220127170722-1.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -220.5 KB
Content
image-20220127171242-1.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -301.3 KB
Content
image-20220127173048-1.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.galluzziandrea
Size
... ... @@ -1,1 +1,0 @@
1 -71.5 KB
Content