-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_input.py
66 lines (55 loc) · 2.48 KB
/
build_input.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
import numpy as np
import sys
#from bmtk.utils.reports.spike_trains import PoissonSpikeGenerator
from spike_trains_original import PoissonSpikeGenerator
scale=1
def lognorm_fr_list(n,m,s):
mean = np.log(m) - 0.5 * np.log((s/m)**2+1)
std = np.sqrt(np.log((s/m)**2 + 1))
return [np.random.lognormal(mean,std) for i in range(n)]
def build_poisson_input(population,node_ids,mean,std,output_h5,t_sim=15000):
print('Building input for ' + population + "[" + str(len(node_ids)) + " cells at " + str(mean) + "(" + str(std) + ") Hz] -> " + output_h5)
psg = PoissonSpikeGenerator(population=population)
psg.add(node_ids=node_ids,
firing_rate=lognorm_fr_list(len(node_ids),mean,std),
times=(0.0, t_sim/1000.0))
psg.to_sonata(output_h5)
def build_input(t_sim, numPN_A = 569, numPN_C=231, numPV = 93, numSOM=51, numCR=56, numVPSI=100, scale=1):
# VPSI
build_poisson_input(population='vpsi_inh',
node_ids=range(int((numVPSI)*scale)),
mean=3,std=1,
output_h5='vpsi_inh_spikes_nonrhythmic.h5',
t_sim=t_sim)
# THALAMUS
build_poisson_input(population='thalamus_pyr',
node_ids=range(int((numPN_A+numPN_C)*scale)),
mean=2,std=1,
output_h5='thalamus_pyr_spikes.h5',
t_sim=t_sim)
# THALAMUS
build_poisson_input(population='thalamus_pv',
node_ids=range(int((numPV)*scale)),
mean=4,std=1,
output_h5='thalamus_pv_spikes.h5',
t_sim=t_sim)
if numSOM:
build_poisson_input(population='thalamus_som',
node_ids=range(int((numSOM)*scale)),
mean=2,std=1,
output_h5='thalamus_som_spikes.h5',
t_sim=t_sim)
if numCR:
build_poisson_input(population='thalamus_cr',
node_ids=range(int((numCR)*scale)),
mean=2,std=1,
output_h5='thalamus_cr_spikes.h5',
t_sim=t_sim)
print("Done")
if __name__ == '__main__':
if 'feng_homogenous' in sys.argv:
build_input(15000, numPN_A = 640, numPN_C=260, numPV = 100, numSOM=0, numCR=0,scale=1, vpsi=False, som=False, cr=False)
if 'homogenous' in sys.argv:
build_input(15000, scale=1)
else:
build_input(15000, scale=27)