Changes for page Code description
Last modified by galluzziandrea on 2022/06/20 12:33
From version 19.1
edited by galluzziandrea
on 2022/01/27 17:12
on 2022/01/27 17:12
Change comment:
Uploaded new attachment "image-20220127171242-1.png", version {1}
To version 8.1
edited by galluzziandrea
on 2021/12/09 14:58
on 2021/12/09 14:58
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 6 removed)
Details
- Page properties
-
- Content
-
... ... @@ -323,212 +323,6 @@ 323 323 endbuild = time.time() 324 324 {{/code}} 325 325 326 -=== [[image:image-20220127165908-2.png||height="659"width="1149"]]===326 +=== Results === 327 327 328 -=== Connecting the network nodes: neuronal populations, Poisson processes and spike detectors === 329 - 330 -{{code language="python"}} 331 -#############################------------------------------------------------------------------------ 332 -print("Connecting ") 333 -#############################------------------------------------------------------------------------ 334 - 335 -startconnect = time.time() 336 -Connessioni=[] 337 -Medie=[] 338 - 339 -#create and define the connections between the populations of neurons and the poisson generators 340 -#and between the populations of neurons and the spike detectors with the parameters extracted from the.ini files 341 - 342 -for i in range(0,int(InfoBuild[0])): 343 - nest.Connect(NoisePop[i], NeuronPop[i], syn_spec={'synapse_model': 'static_synapse_hpc', 344 - 'delay': dt, 345 - 'weight': nest.math.redraw(nest.random.normal(mean=float(InfoConnectNoise[i+1][0]), 346 - std=(float(InfoConnectNoise[i+1][1])*float(InfoConnectNoise[i+1][0]))), 347 - min=0., max=float('Inf')) 348 - }) 349 - nest.Connect(NeuronPop[i][:int(InfoBuild[i+1][0])], DetectorPop[i], syn_spec={"weight": 1.0, "delay": dt}) 350 - 351 -#create and define the connections between the populations of neurons with the parameters extracted from the.ini files 352 - 353 -for i in range(0,len(InfoConnectPop[1:])): 354 - 355 - conn=nest.Connect(NeuronPop[int(InfoConnectPop[i+1][1])], NeuronPop[int(InfoConnectPop[i+1][0])], 356 - {'rule': 'pairwise_bernoulli', 357 - 'p':float(InfoConnectPop[i+1][2]) }, 358 - syn_spec={'synapse_model': 'static_synapse_hpc', 359 - 'delay':nest.math.redraw(nest.random.exponential(beta=float(1./(2.99573227355/(float(InfoConnectPop[i+1][4])-float(InfoConnectPop[i+1][3]))))), 360 - min= numpy.max([dt,float(1./float(InfoConnectPop[i+1][4]))]), 361 - max= float(1./(float(InfoConnectPop[i+1][3])-dt/2))), 362 - 363 - 'weight':nest.random.normal(mean=float(InfoConnectPop[i+1][6]), 364 - std=math.fabs(float(InfoConnectPop[i+1][6])*float(InfoConnectPop[i+1][7])))}) 365 - 366 - 367 -endconnect = time.time() 368 -{{/code}} 369 - 370 -=== === 371 - 372 -=== === 373 - 374 -=== === 375 - 376 -=== === 377 - 378 -=== === 379 - 380 -(% class="wikigeneratedid" %) 381 -=== [[image:image-20220127170722-1.png]] === 382 - 383 -=== Simulating: neuronal time evolution. === 384 - 385 -=== === 386 - 387 -{{code language="python"}} 388 - #############################------------------------------------------------------------------------ 389 - print("Simulating") 390 - #############################------------------------------------------------------------------------ 391 - ################################################################################################################################################################### 392 - if Salva: 393 - print("I m going to save the data") 394 - #x=str(iterazioni) 395 - f = open(FileName,"w") 396 - if len(InfoProtocol): 397 - print("I m going to split the simulation") 398 - tempo=0 399 - for contatore in range(0,len(InfoProtocol)): 400 - appoggio1=int((tempo+InfoProtocol[contatore][0])/1000.) 401 - appoggio2=int(tempo/1000.) 402 - appoggio3=tempo+InfoProtocol[contatore][0] 403 - if (appoggio1-appoggio2)>=1: 404 - T1=(1+appoggio2)*1000-tempo 405 - nest.Simulate(T1) 406 - #Save the Data!!!! 407 - ########################################################### 408 - Equilibri=[] 409 - for i in range(0,int(InfoBuild[0])): 410 - Equilibri.append([]) 411 - a=nest.GetStatus(DetectorPop[i])[0]["events"]["times"] 412 - if len(a)>0: 413 - Trange=(1000*int(numpy.min(a)/1000.),1000*int(numpy.min(a)/1000.)+1000) 414 - hist,Tbin=numpy.histogram(a,200,(Trange[0],Trange[1])) 415 - Equilibri[i]=hist*1000./(5.*int(InfoBuild[i+1][0])) 416 - else: 417 - Trange=(1000*int(tempo/1000.),1000*int(tempo/1000.)+1000) 418 - hist=numpy.zeros(200) 419 - Tbin=numpy.linspace(Trange[0],Trange[1],num=201) 420 - Equilibri[i]=hist 421 - nest.SetStatus(DetectorPop[i],{'n_events':0}) 422 - for j in range(0,len(hist)): 423 - f.write(str(Tbin[j])+" ") 424 - for i in range(0,int(InfoBuild[0])): 425 - f.write(str(Equilibri[i][j])+" ") 426 - f.write("\n ") 427 - ########################################################### 428 - tempo=tempo+T1 429 - for contatore2 in range(1,(appoggio1-appoggio2)): 430 - nest.Simulate(1000.) 431 - #Save the Data!!!! 432 - ########################################################### 433 - Equilibri=[] 434 - for i in range(0,int(InfoBuild[0])): 435 - Equilibri.append([]) 436 - a=nest.GetStatus(DetectorPop[i])[0]["events"]["times"] 437 - if len(a)>0: 438 - Trange=(1000*int(numpy.min(a)/1000.),1000*int(numpy.min(a)/1000.)+1000) 439 - hist,Tbin=numpy.histogram(a,200,(Trange[0],Trange[1])) 440 - Equilibri[i]=hist*1000./(5.*int(InfoBuild[i+1][0])) 441 - else: 442 - Trange=(1000*int(tempo/1000.),1000*int(tempo/1000.)+1000) 443 - hist=numpy.zeros(200) 444 - Tbin=numpy.linspace(Trange[0],Trange[1],num=201) 445 - Equilibri[i]=hist 446 - nest.SetStatus(DetectorPop[i],{'n_events':0}) 447 - for j in range(0,len(hist)): 448 - f.write(str(Tbin[j])+" ") 449 - for i in range(0,int(InfoBuild[0])): 450 - f.write(str(Equilibri[i][j])+" ") 451 - f.write("\n ") 452 - tempo=tempo+1000. 453 - T2=appoggio3-tempo 454 - nest.Simulate(T2); 455 - tempo=tempo+T2; 456 - else: 457 - nest.Simulate(InfoProtocol[contatore][0]) 458 - temp=InfoProtocol[contatore][0] 459 - tempo=tempo+temp 460 - if InfoProtocol[contatore][2]==4: 461 - nest.SetStatus(NoisePop[InfoProtocol[contatore][1]],params={"rate": float(InfoBuild[1+InfoProtocol[contatore][1]][2]*InfoProtocol[contatore][3])}) 462 - if InfoProtocol[contatore][2]==12: 463 - nest.SetStatus(NeuronPop[InfoProtocol[contatore][1]], params={"b": float(InfoProtocol[contatore][3])}) 464 - else: 465 - nest.Simulate(simtime) 466 - tempo=simtime 467 - if (simtime-tempo)>0.: 468 - nest.Simulate(simtime-tempo) 469 - 470 - 471 - endsimulate = time.time() 472 - f.close() 473 - else: 474 - if len(InfoProtocol): 475 - tempo=0 476 - for contatore in range(0,len(InfoProtocol)): 477 - nest.Simulate(InfoProtocol[contatore][0]) 478 - temp=InfoProtocol[contatore][0] 479 - tempo=tempo+temp 480 - if InfoProtocol[contatore][2]==4: 481 - nest.SetStatus(NoisePop[InfoProtocol[contatore][1]],params={"rate": float(InfoBuild[1+InfoProtocol[contatore][1]][2]*InfoProtocol[contatore][3])}) 482 - #print "Population:", InfoProtocol[contatore][1] ,";Parameter:", InfoProtocol[contatore][2] ,"; Value: ",InfoProtocol[contatore][3] 483 - if InfoProtocol[contatore][2]==12: 484 - nest.SetStatus(NeuronPop[InfoProtocol[contatore][1]], params={"b": float(InfoProtocol[contatore][3])}) 485 - #print "Population:", InfoProtocol[contatore][1] ,";Parameter:", InfoProtocol[contatore][2] ,"; Value: ",InfoProtocol[contatore][3] 486 - 487 - else: 488 - nest.Simulate(simtime) 489 - tempo=simtime 490 - if (simtime-tempo)>0.: 491 - nest.Simulate(simtime-tempo) 492 - endsimulate = time.time() 493 - 494 - 495 - ################################################################################################################################################################### 496 - 497 - #############################------------------------------------------------------------------------ 498 - #print some information from the simulation 499 - #############################------------------------------------------------------------------------ 500 - 501 - num_synapses = nest.GetDefaults('static_synapse_hpc')["num_connections"] 502 - build_time = endbuild - startbuild 503 - connect_time = endconnect - startconnect 504 - sim_time = endsimulate - endconnect 505 - 506 - N_neurons=0 507 - for i in range(0,int(InfoBuild[0])): 508 - N_neurons=N_neurons+int(InfoBuild[i+1][0]) 509 - 510 - print(" Network simulation (Python) neuron type:",InfoPerseo[0]) 511 - print("Number of neurons : {0}".format(N_neurons)) 512 - print("Number of synapses: {0}".format(num_synapses)) 513 - print("Building time : %.2f s" % build_time) 514 - print("Connecting time : %.2f s" % connect_time) 515 - print("Simulation time : %.2f s" % sim_time) 516 - 517 -Fine=time.time() 518 -print ("Total Simulation time : %.2f s" % (Fine-Inizio)) 519 -{{/code}} 520 - 521 -=== === 522 - 523 -=== [[image:image-20220127170155-2.png||height="682" width="1439"]] === 524 - 525 -=== Results: === 526 - 527 -the output of this simulationo is... 528 - 529 - 530 - 531 - 532 - 533 - 534 534 ==== ====
- 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
- Introduction (path and modules):
- Check where I am and place myself in the right folder:
- Import the modules necessary for the simulation:
- Define necessary classes to import the Initialization Files:
- Import the initialization files:
- Defining general and nest.kernel parameters
- Building the network: neuronal populations , Poisson processes and spike detectors
- Connecting the network nodes: neuronal populations, Poisson processes and spike detectors
- Simulating: neuronal time evolution.
- Results: