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