-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecreasing_heat_map_I_e_Je.py
executable file
·77 lines (48 loc) · 1.8 KB
/
decreasing_heat_map_I_e_Je.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
import nest
import numpy as np
import simplejson
from sys import argv
nest.SetKernelStatus({"local_num_threads": 8})
neuron_population = 1000
simulation_time = 1000.0
I_e = 0.0
mean_rate_Je = []
mean_rate_list = []
dict_parameters_exc = {"E_L": -70.0, "C_m": 250.0, "tau_m": 20.0, "t_ref": 2.0, "V_th": -55.0, "V_reset": -70.0, "tau_syn": 2.0, "I_e": I_e}
epop = nest.Create("iaf_neuron", neuron_population)
nest.SetStatus(epop, params=dict_parameters_exc)
Ke_list = []
I_e_list = []
multimeter_times = []
multimeter_V_m = []
for neuron in epop:
nest.SetStatus([neuron], {"V_m": dict_parameters_exc["E_L"]+(dict_parameters_exc["V_th"]-dict_parameters_exc["E_L"])*np.random.rand()})
Ke = 20
d = 1.0
Je = float(argv[1])
conn_dict_ex = {"rule": "fixed_indegree", "indegree": Ke}
syn_dict_ex = {"delay": d, "weight": Je}
nest.Connect(epop, epop, conn_dict_ex, syn_dict_ex)
spikedetector_exc = nest.Create("spike_detector", params={"withgid": True, "withtime": True})
for neuron_exc in epop:
nest.Connect([neuron_exc], spikedetector_exc)
length = np.float64(0.0)
for i in range(500,0,-10):
I_e = float(i)
nest.SetStatus(epop, params={"I_e": I_e})
nest.Simulate(simulation_time)
dSD = nest.GetStatus(spikedetector_exc, keys='events')[0]
evs = dSD["senders"]
ts = dSD["times"]
total = np.subtract(float(len(evs)), length)
length = np.add(length, total)
mean_rate = np.divide(total, np.multiply(neuron_population, simulation_time))
mean_rate_Je.append(mean_rate)
nest.ResumeSimulation()
open_file = open("decreasing_heat_map_values_I_e_Je.json", "r")
mean_rate_list = simplejson.load(open_file)
mean_rate_list.append(mean_rate_Je)
open_file.close()
open_file = open("decreasing_heat_map_values_I_e_Je.json", "w")
simplejson.dump(mean_rate_list, open_file)
open_file.close()