-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchanging_ba_0.py
116 lines (76 loc) · 2.44 KB
/
changing_ba_0.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import nest
import numpy
import pylab
nest.SetKernelStatus({"local_num_threads":8})
Current_increase = []
Current_decrease = []
time_increase = ""
time_decrease = ""
dict_params = {"V_peak" : 0.0
, "V_reset" : -70.0
, "t_ref" : 2.0
, "g_L" : 30.0
, "C_m" : 281.0
, "E_ex" : 0.0
, "E_in" : -85.0
, "E_L" : -70.0
, "Delta_T" : 2.0
, "tau_w" : 100.0
, "a" : 0.0
, "b" : 0.0
, "V_th" : -55.0
, "tau_syn_ex" : 0.2
, "tau_syn_in" : 2.0
, "I_e" : 200.0
, "w": 0.0}
I_e_rate_list_increase = ""
I_e_rate_list_decrease = ""
#weight_list = numpy.arange(0,110, 0.2)
for i in range(0,110, 10):
neurons = nest.Create("aeif_cond_exp", 100)
nest.SetStatus(neurons, params=dict_params)
noise = nest.Create("poisson_generator")
nest.SetStatus(noise, {"rate": 100.0})
nest.SetStatus(neurons, {"b": float(i)})
nest.Connect(noise, neurons)
for neuron in neurons:
nest.SetStatus([neuron], {"V_m": dict_params["E_L"]+(dict_params["V_th"]-dict_params["E_L"])*numpy.random.rand()})
spike_detector = nest.Create("spike_detector")
for n in neurons:
nest.Connect([n], spike_detector)
K = 10
d = 1.0
J = 70.0
conn_dict = {"rule": "fixed_indegree", "indegree": K}
syn_dict = {"delay": d, "weight": J}
nest.Connect(neurons, neurons, conn_dict, syn_dict)
Time_number = 0.0
for I in range(0,510,10):
Time_number += 100.0
Current_increase.append(I)
nest.SetStatus(neurons, params={"I_e": float(I)})
nest.Simulate(100.0)
nest.ResumeSimulation()
dSD_inc = nest.GetStatus(spike_detector, keys='events')[0]
evs_inc = dSD_inc["senders"]
ts_inc = dSD_inc["times"]
time_increase += str(ts_inc[0]) + ", "
for neuron in neurons:
nest.SetStatus([neuron], {"V_m": dict_params["E_L"]+(dict_params["V_th"]-dict_params["E_L"])*numpy.random.rand()})
for I in range(500,-10,-10):
Current_decrease.append(I)
nest.SetStatus(neurons, params={"I_e": float(I)})
nest.Simulate(100.0)
nest.ResumeSimulation()
dSD_dec = nest.GetStatus(spike_detector, keys='events')[0]
evs_dec = dSD_dec["senders"]
ts_dec = dSD_dec["times"]
time_decrease += str(ts_dec[-1]) + ", "
nest.ResetNetwork()
nest.ResetKernel()
open_file = open("b_adaptation_increase.txt", "w")
open_file.write(time_increase)
open_file.close()
open_file = open("b_adaptation_decrease.txt", "w")
open_file.write(time_decrease)
open_file.close()