-
Notifications
You must be signed in to change notification settings - Fork 0
/
grandi_bump.py
executable file
·165 lines (144 loc) · 5.02 KB
/
grandi_bump.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env python
import myokit
import matplotlib.pyplot as pl
from manual_APD import ap_duration
import numpy as np
## Investigating Grandi bump ##
## ------------------------- ##
m = myokit.load_model('grandi-2010.mmt')
cell_types = {'Endocardial': 0, 'Epicardial' : 1}
cell_type = 'Endocardial'
pcl = 1000
p = myokit.pacing.blocktrain(pcl, 0.5, offset=20, level=1.0, limit=0)
s = myokit.Simulation(m,p)
s.set_constant('type.epi', cell_types[cell_type])
s.set_tolerance(1*np.e**-8, 1*np.e**-8)
d = s.run(pcl)
pl.figure()
pl.subplot(3,2,1)
pl.plot(d['engine.time'],d['membrane.V'])
pl.title('AP')
pl.subplot(3,2,2)
pl.plot(d['engine.time'],d['ito.ito'])
pl.title('Ito')
pl.subplot(3,2,3)
pl.plot(d['engine.time'],d['ikr.I_kr'])
pl.title('IKr')
pl.subplot(3,2,4)
pl.plot(d['engine.time'],d['ik1.I_k1'])
pl.title('IK1')
pl.subplot(3,2,5)
pl.plot(d['engine.time'],d['ical.I_Ca_junc'])
pl.plot(d['engine.time'],d['ical.I_Ca_sl'])
pl.legend(['Junctional cleft facing', 'Subsarcolemmal space injecting'])
pl.title('ICal')
pl.subplot(3,2,6)
pl.plot(d['engine.time'],d['calcium.I_Ca_tot_junc'])
pl.plot(d['engine.time'],d['calcium.I_Ca_tot_sl'])
pl.legend(['Junctional cleft facing', 'Subsarcolemmal space injecting'])
pl.title('I Ca')
pl.suptitle('{} 1st beat, Grandi (2010)'.format(cell_type))
# Reset and run 200 beats at 1000ms
s.reset()
s.set_constant('type.epi', cell_types[cell_type])
s.set_tolerance(1*np.e**-8, 1*np.e**-8)
s.pre(pcl*199)
d = s.run(pcl)
pl.figure()
pl.subplot(3,2,1)
pl.plot(d['engine.time'],d['membrane.V'])
pl.title('AP')
pl.subplot(3,2,2)
pl.plot(d['engine.time'],d['ito.ito'])
pl.title('Ito')
pl.subplot(3,2,3)
pl.plot(d['engine.time'],d['ikr.I_kr'])
pl.title('IKr')
pl.subplot(3,2,4)
pl.plot(d['engine.time'],d['ik1.I_k1'])
pl.title('IK1')
pl.subplot(3,2,5)
pl.plot(d['engine.time'],d['ical.I_Ca_junc'])
pl.plot(d['engine.time'],d['ical.I_Ca_sl'])
pl.legend(['Junctional cleft facing', 'Subsarcolemmal space injecting'])
pl.title('ICal')
pl.subplot(3,2,6)
pl.plot(d['engine.time'],d['calcium.I_Ca_tot_junc'])
pl.plot(d['engine.time'],d['calcium.I_Ca_tot_sl'])
pl.legend(['Junctional cleft facing', 'Subsarcolemmal space injecting'])
pl.title('I Ca')
pl.suptitle('{} 200th beat Grandi (2010)'.format(cell_type))
# Reset and run 200 beats at 1000ms
s = myokit.Simulation(m,p)
s.set_constant('type.epi', cell_types[cell_type])
s.set_tolerance(1*np.e**-8, 1*np.e**-8)
pl.figure()
beats = [1,2,3,6,12,20,60,100,150,200]
time_beats_start = [(element -1)*10000 for element in beats]
beats_legend = [str(element)+'th AP' for element in beats]
beats_legend[0] = '1st AP'
beats_legend[1] = '2nd AP'
beats_legend[2] = '3rd AP'
#num_colours = len(beats)
#cm = pl.get_cmap('gist_rainbow')
#pl.set_color_cycle([cm(1.*i/num_colours) for i in range(num_colours)])
d = s.run(200*pcl,log_interval = 0.1, log = ['engine.time','membrane.V','calcium.I_Ca_tot_junc','calcium.I_Ca_tot_sl', 'ical.I_Ca_junc', 'ical.I_Ca_sl' ])
pl.subplot(1,5,1)
for beat in time_beats_start:
pl.plot(d['engine.time'][0:10000],d['membrane.V'][beat:beat+10000])
pl.title('Membrane potential, AP')
pl.subplot(1,5,2)
for beat in time_beats_start:
pl.plot(d['engine.time'][0:10000],d['ical.I_Ca_junc'][beat:beat+10000])
pl.title('ICal (junc)')
pl.subplot(1,5,3)
for beat in time_beats_start:
pl.plot(d['engine.time'][0:10000],d['ical.I_Ca_sl'][beat:beat+10000])
pl.title('ICal (sl)')
pl.subplot(1,5,4)
for beat in time_beats_start:
pl.plot(d['engine.time'][0:10000],d['calcium.I_Ca_tot_junc'][beat:beat+10000])
pl.title('I Ca (junc)')
pl.subplot(1,5,5)
for beat in time_beats_start:
pl.plot(d['engine.time'][0:10000],d['calcium.I_Ca_tot_sl'][beat:beat+10000])
pl.legend(beats_legend)
pl.title('I Ca (sl)')
pl.suptitle('Membrane potential and calcium channel currents at a certain beat in a cycle using the Grandi (2010) Model')
## Checking calcium channels at specific point across 500 APs
s.reset()
s = myokit.Simulation(m,p)
s.set_constant('type.epi', cell_types[cell_type])
s.set_tolerance(1*np.e**-8, 1*np.e**-8)
d = s.run(500*pcl, log_interval = 0.1, log = ['engine.time','calcium.I_Ca_tot_junc','calcium.I_Ca_tot_sl', 'ical.I_Ca_junc', 'ical.I_Ca_sl' ])
pl.figure()
point_time = d['engine.time'][650::10000]
point_AP = [element/1000 for element in point_time]
cajunc_time = d['calcium.I_Ca_tot_junc'][650::10000]
casl_time = d['calcium.I_Ca_tot_sl'][650::10000]
icaljunc_time = d['ical.I_Ca_junc'][650::10000]
icalsl_time = d['ical.I_Ca_sl'][650::10000]
pl.subplot(2,2,1)
pl.plot(point_AP,cajunc_time)
pl.xlabel('AP')
pl.ylabel('Channel Current (mV)')
pl.title('I Ca junc')
pl.subplot(2,2,2)
pl.plot(point_AP, casl_time)
pl.xlabel('Time (ms)')
pl.ylabel('Channel Current (mV)')
pl.title('I Ca Sl')
pl.suptitle('Ca current at 65ms into AP')
pl.subplot(2,2,3)
pl.plot(point_AP, icaljunc_time)
pl.xlabel('AP')
pl.ylabel('Channel Current (mV)')
pl.title('ICal junc')
pl.suptitle('Ca current at 65ms into AP')
pl.subplot(2,2,4)
pl.plot(point_AP, icalsl_time)
pl.xlabel('AP')
pl.ylabel('Channel Current (mV)')
pl.title('ICal Sl')
pl.suptitle('Ca current at 65ms into AP, with high precision solver')
pl.show()