-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphase_diagrams.py
103 lines (85 loc) · 2.41 KB
/
phase_diagrams.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
# hr coupled duplicate to map x vs y
from imports import *
from HRneuron import *
# from "old_scripts/synapse" import *
# insert main code here :D
c = constants()
thiscurr = input("input current: ")
neuron1 = HRneuron(1)
neuron1.set_current(float(thiscurr))
c.set_current(float(thiscurr))
time_vec = np.arange(0, c.ms, c.scale)
current_vec = np.zeros(c.iterations) + c.I
# print(time_vec[20])
# print("hi")
# print(thiscurr)
# print(neuron1.current)
# forward euler time :D
for i in range(c.iterations):
neuron1.calculate_x(i)
neuron1.calculate_y(i)
neuron1.calculate_z(i)
# removing first data points in x and y
xshort = [0.0]*(len(neuron1.xarr)-2500)
yshort = [0.0]*(len(neuron1.yarr)-2500)
for i in range(2500, len(neuron1.xarr)):
xshort[i-2500] = neuron1.xarr[i]
yshort[i-2500] = neuron1.yarr[i]
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.title.set_text("x vs y")
ax1.set_xlabel("current")
ax1.set_ylabel("ion transport rate")
ax1.plot(xshort, yshort)
#ax1.scatter(xshort, yshort,s=10)
if (c.I < 1.2):
fig.suptitle("Quiescence")
elif (c.I < 1.4):
fig.suptitle("Spiking")
elif (c.I < 3.1):
fig.suptitle("Bursting")
elif (c.I < 3.2):
fig.suptitle("Aperiodic")
else:
fig.suptitle("Fast Spiking")
# plt.show()
plt.savefig("fastspiking.png", dpi=150)
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)
# ax1.plot(xshort, yshort)
# ax2.plot(neuron1.xarr, neuron1.yarr)
# ax3.plot(time_vec, neuron1.zarr)
# ax4.plot(time_vec, current_vec)
# ax1.title.set_text("x vs y without init spike")
# ax1.set_xlabel("current")
# ax1.set_ylabel("ion transport rate")
# ax2.title.set_text("x vs y full")
# ax2.set_xlabel("current")
# ax2.set_ylabel("ion transport rate")
# ax3.title.set_text("Adaptation Current")
# ax3.set_xlabel("time (ms)")
# ax3.set_ylabel("au")
# ax4.title.set_text("Injected Current")
# ax4.set_xlabel("time (ms)")
# ax4.set_ylabel("au")
# if (c.I < 1.2):
# fig.suptitle("Quiescence")
# elif (c.I < 1.4):
# fig.suptitle("Spiking")
# elif (c.I < 3.1):
# fig.suptitle("Bursting")
# elif (c.I < 3.2):
# fig.suptitle("Aperiodic")
# else:
# fig.suptitle("Fast Spiking")
# plt.subplots_adjust(left=0.1,
# bottom=0.1,
# right=0.9,
# top=0.9,
# wspace=0.4,
# hspace=0.4)
# plt.show()