-
Notifications
You must be signed in to change notification settings - Fork 4
/
with_correlated_ext_drive.py
executable file
·102 lines (84 loc) · 4.19 KB
/
with_correlated_ext_drive.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import sys, pathlib
sys.path.append(str(pathlib.Path(__file__).resolve().parents[1]))
import numpy as np
import matplotlib.pylab as plt
import main as ntwk
################################################################
## ------ Construct populations with their equations -------- ##
## ------------- with recurrent connections ----------------- ##
################################################################
Model = {
## ---------------------------------------------------------------------------------
### Initialisation by default parameters
## UNIT SYSTEM is : ms, mV, pF, nS, pA, Hz (arbitrary and unconsistent, so see code)
## ---------------------------------------------------------------------------------
# numbers of neurons in population
'N_Exc':4000, 'N_Inh':1000, 'N_AffExc':500,
# synaptic weights
'Q_Exc_Exc':1., 'Q_Exc_Inh':1.,
'Q_AffExc_Exc':3., 'Q_AffExc_Inh':3.,
'Q_Inh_Exc':10., 'Q_Inh_Inh':10.,
# synaptic time constants
'Tse':5., 'Tsi':5.,
# synaptic reversal potentials
'Ee':0., 'Ei': -80.,
# connectivity parameters
'p_Exc_Exc':0.02, 'p_Exc_Inh':0.02,
'p_Inh_Exc':0.02, 'p_Inh_Inh':0.02,
'p_AffExc_Exc':0.1, 'p_AffExc_Inh':0.1,
# simulation parameters
'dt':0.1, 'tstop': 100., 'SEED':3, # low by default, see later
## ---------------------------------------------------------------------------------
# === cellular properties (based on AdExp), population by population ===
# --> Excitatory population (Exc, recurrent excitation)
'Exc_Gl':10., 'Exc_Cm':200.,'Exc_Trefrac':3.,
'Exc_El':-60., 'Exc_Vthre':-50., 'Exc_Vreset':-60., 'Exc_deltaV':0.,
'Exc_a':0., 'Exc_b': 0., 'Exc_tauw':1e9,
# --> Inhibitory population (Inh, recurrent inhibition)
'Inh_Gl':10., 'Inh_Cm':200.,'Inh_Trefrac':3.,
'Inh_El':-60., 'Inh_Vthre':-53., 'Inh_Vreset':-60., 'Inh_deltaV':0.,
'Inh_a':0., 'Inh_b': 0., 'Inh_tauw':1e9,
}
if sys.argv[-1]=='plot':
# ######################
# ## ----- Plot ----- ##
# ######################
## load file
data = ntwk.load_dict_from_hdf5('with_correl_drive_data.h5')
# ## plot
fig, _ = ntwk.raster_and_Vm_plot(data, smooth_population_activity=10.)
plt.show()
else:
NTWK = ntwk.build_populations(Model, ['Exc', 'Inh'],
AFFERENT_POPULATIONS=['AffExc'],
with_raster=True, with_Vm=4,
# with_synaptic_currents=True,
# with_synaptic_conductances=True,
verbose=True)
ntwk.build_up_recurrent_connections(NTWK, SEED=5, verbose=True)
#######################################
########### AFFERENT INPUTS ###########
#######################################
print('-------------------------------------------------------')
print('BROKEN SCRIPT, NEED TO UPDATE WRT TO NEW ntwk_stim')
print('-------------------------------------------------------')
faff = 1.
t_array = ntwk.arange(int(Model['tstop']/Model['dt']))*Model['dt']
# # # afferent excitation onto cortical excitation and inhibition
for i, tpop in enumerate(['Exc', 'Inh']): # both on excitation and inhibition
ntwk.construct_feedforward_input_correlated(NTWK, tpop, 'AffExc',
t_array, faff+0.*t_array,
# with_presynaptic_spikes=True,
verbose=True,
SEED=int(37*faff+i)%37)
################################################################
## --------------- Initial Condition ------------------------ ##
################################################################
ntwk.initialize_to_rest(NTWK)
#####################
## ----- Run ----- ##
#####################
network_sim = ntwk.collect_and_run(NTWK, verbose=True)
ntwk.write_as_hdf5(NTWK, filename='with_correl_drive_data.h5')
print('Results of the simulation are stored as:', 'with_correl_drive_data.h5')
print('--> Run \"python with_correl_drive.py plot\" to plot the results')