-
Notifications
You must be signed in to change notification settings - Fork 0
/
two_area_network.py
64 lines (53 loc) · 1.72 KB
/
two_area_network.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
import numpy as np
import pickle
from classes.network_2areas import *
import matplotlib.pyplot as plt
'''define modelparameters and simulation functions'''
modelparams = dict(
seed = 2, #random seed connectivity
dt = .5, #integration time
tau_m2 = 20.,#ms
tau_th = 2.,#ms
T = 100, # period simulations [ms]
c = 0.1, # dilution
N = 10000, # number of neurons
N_th = 1000, # number of neurons
p = 10, # number of patterns
amp_ff = .65,#0.6,# strenght of the feedforward weights
std_low_dim = .65,#standard deviation of the low rank noise
std_priv = 0., # standard deviation private noise
#learning rule
amp_median = 3., # amplitude connectivity
bf = 1e8, # step function f and g
bg = 1e8, # step function f and g
qf = .65,# offset f
xf = 1.7, # threshold f
xg = 1.7, # threshold f
#amplitude ff and fb
w_ctx_ctx = 1,
w_th_ctx = 1,
w_ctx_th = .1,
indexes = 10000, # number of recorded neurons
slope_tf = 1.,
intercept_tf = 1.
)
def simulate_network(modelparams):
#CREATING TRANSFER FUNCTION
folder = 'data/'
param_tf = pickle.load(open(folder+'parametersHetero.p','rb'))
#CREATING CONNECTIVITY
conn = ConnectivityMatrices(param_tf, modelparams)
# #CREATING DYNAMICS
# indexes = range(modelparams['indexes'])#range(10000)
# np.random.seed()
dyn = NetworkDynamics(modelparams, conn)
# #SIMULATING NETWORK DYNAMICS
# dyn.neu_indexes = indexes
u_ctx0 = conn.patterns['ctx'][0]
u_th0 = conn.patterns['th'][0]
print(u_ctx0.shape, u_th0.shape)
dynamics = dyn.dynamics(u_ctx0, u_th0)
return dynamics
dyn = simulate_network(modelparams)
plt.plot(dyn['overlaps_ctx'])
plt.show()