-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpoincare_data_gen.py
122 lines (93 loc) · 3.39 KB
/
poincare_data_gen.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
117
118
119
120
121
122
from imports import *
from HRneuronseg import *
from synapseseg import *
from HRneuron import *
neuron1 = HRneuron(1)
neuron2 = HRneuronseg(2)
synapse = synapseseg([neuron1])
average_y1 = []
average_y2 = []
average_y3 = []
time_vec = np.arange(0, c.ms, c.scale)
a = []
"""
for j in range(400):
neuron1.set_current(j * 0.01 + 1)
print(neuron1.current)
# neuron2.set_current(j * 0.1 + 1)
# neuron3.set_conductance(j * 0.1)
# print(neuron1.g)
for i in range(c.iterations):
neuron1.calculate_x(i)
neuron1.calculate_y(i)
neuron1.calculate_z(i)
x_y1 = neuron1.xarr[np.where(np.logical_and(neuron1.yarr < -2.4999, neuron1.yarr > -2.5001))]
temp_vec = np.zeros(len(x_y1))
temp_vec = temp_vec + j * 0.01 + 1
plt.scatter(temp_vec, x_y1, s=0.05, color="black")
a.append(x_y1)
# average_y3.append(neuron3.yarr)
# plt.figure()
# plt.plot(time_vec, neuron1.xarr)
# plt.show()
print(float(j/400))
"""
neuron1.set_current(3.15)
print(neuron1.current)
for i in range(c.iterations):
neuron1.calculate_x(i)
neuron1.calculate_y(i)
neuron1.calculate_z(i)
temp = np.zeros(c.iterations)
temp -= 2.5
plt.plot(neuron1.xarr[100000:], neuron1.yarr[100000:],
linewidth=0.5, color="black")
# plt.plot(temp[100000:], linewidth=0.5, color=c.l_blue)
plt.axhline(y=-2.5, linewidth=0.5, color=c.l_blue, label="y = -2.5")
# plt.plot(temp_vec, average_y2, linewidth=0.5, color="green", label = "neuron 2")
# plt.plot(temp_vec, average_y3, linewidth=0.5, color="blue", label = "neuron 2")
# plt.legend()
plt.legend()
plt.title("Phase Portrait of I = 3.15 (Poincare section at y = −2.5)")
# plt.title("Bifurcation of Membrane Potential (Poincare section at y = −2.5)")
plt.ylabel("conductance")
plt.xlabel("membrane potential")
plt.savefig("x_vs_conductance", dpi=300)
print("HI")
plt.show()
# fig = plt.figure()
# ax1 = fig.add_subplot(221)
# ax2 = fig.add_subplot(222)
# ax3 = fig.add_subplot(223)
# ax4 = fig.add_subplot(224)
# fig.suptitle("HR Neuron 2 inhibited by Neuron 1, conductance = " + str(c.g))
# # Y GRAPHS
# ax1.plot(neuron1.time_vec, neuron1.xarr, linewidth=0.5, color="red")
# ax2.plot(neuron1.time_vec, neuron2.xarr, linewidth=0.5, color="green")
# ax3.plot(temp_vec, average_y1, linewidth=0.5, color="red")
# ax3.plot(temp_vec, average_y2, linewidth=0.5, color="green")
# ax3.plot(temp_vec, average_y3, linewidth=0.5, color="blue")
# ax4.plot(neuron1.time_vec, neuron3.xarr, linewidth=0.5, color="blue")
# ax1.title.set_text("Neuron 1 (I = " + str(neuron1.current) + " ), x0 = " + str(neuron1.xR))
# ax1.set_xlabel("time (ms)")
# ax1.set_ylabel("au")
# ax2.title.set_text("Neuron 2 (I = " + str(neuron2.current) + " ), x0 = " + str(neuron2.xR))
# ax2.set_xlabel("time (ms)")
# ax2.set_ylabel("au")
# ax2.title.set_text("Ion Transport Rate vs Coupling Force")
# ax2.set_xlabel("coupling force")
# ax2.set_ylabel("y")
# ax4.title.set_text("Neuron 3 (I = " + str(neuron3.current) + " ), x0 = " + str(neuron3.xR))
# ax4.set_xlabel("time (ms)")
# ax4.set_ylabel("au")
# # ax4.title.set_text("Neuron 3 (I = " + str(neuron3.current) + " ), x0 = " + str(neuron3.xR))
# # ax4.set_xlabel("time (ms)")
# # ax4.set_ylabel("au")
# plt.subplots_adjust(left=0.1,
# bottom=0.1,
# right=0.9,
# top=0.9,
# wspace=0.4,
# hspace=0.4)
# # plt.savefig("coupled_phase_fast_spiking.png", dpi=300)
# plt.show()