-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameters.py
200 lines (165 loc) · 4.25 KB
/
parameters.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/usr/bin/env python3
# List of parameters to be inferred
import numpy as np
from priors import prior_parameters
# Just IKr model
ikr = [
'ikr.g',
'ikr.p1', 'ikr.p2', 'ikr.p3', 'ikr.p4',
'ikr.p5', 'ikr.p6', 'ikr.p7', 'ikr.p8',
]
p = np.asarray(prior_parameters['25.0'])
p[1:] = p[1:] * 1e-3 # in mV, ms
ikr_names = [r'$g_{Kr}$',
r'$p_1$', r'$p_2$', r'$p_3$', r'$p_4$',
r'$p_5$', r'$p_6$', r'$p_7$', r'$p_8$',]
# Ideal voltage clamp model
idealvc = list(ikr)
idealvc_typical_values = np.copy(p)
idealvc_names = list(ikr_names)
# Realistic voltage clamp model
fullvc = ikr + [
'membrane.cm',
'voltageclamp.rseries',
'voltageclamp.cprs_eff',
'voltageclamp.voffset_eff'
]
fullvc_typical_values = np.append(idealvc_typical_values, [
15.0, # pF
8.0e-3, # GOhm
4.0 * 0.5, # pF
-5.0, # mV
])
fullvc_best_values = np.append(idealvc_typical_values, [
10.0, # pF
5.0e-3, # GOhm
4.0 * 0.1, # pF
5.0, # mV
])
fullvc_names = idealvc_names + [
r'$C_m$',
r'$R_{series}$',
r'$C^{\dagger}_{prs}$',
r'$V^{\dagger}_{off}$'
]
fullvc_fix = ['voltageclamp.cm_est', 'voltageclamp.rseries_est']
fullvc_fix_typical_values = [
0.9 * 10.0, # pF
0.9 * 5.0e-3, # GOhm
#12.0, # pF
#14.0e-3, # GOhm
]
# Realistic voltage clamp model (full)
full2vc = ikr + [
'membrane.cm',
'voltageclamp.rseries',
'voltageclamp.cprs',
'voltageclamp.voffset_eff'
]
full2vc_typical_values = np.append(idealvc_typical_values, [
15.0, # pF
8.0e-3, # GOhm
4.0, # pF
-5.0, # mV
])
full2vc_best_values = np.append(idealvc_typical_values, [
10.0, # pF
5.0e-3, # GOhm
4.0, # pF
5.0, # mV
])
full2vc_names = idealvc_names + [
r'$C_m$',
r'$R_{series}$',
r'$C_{prs}$',
r'$V^{\dagger}_{off}$'
]
full2vc_fix = ['voltageclamp.cm_est',
'voltageclamp.rseries_est',
'voltageclamp.cprs_est',]
full2vc_fix_typical_values = [
0.9 * 10.0, # pF
0.9 * 5.0e-3, # GOhm
0.9 * 4, # pF
]
# Simplified voltage clamp model
simvc = ikr + [
'voltageclamp.rseries',
'voltageclamp.voffset_eff'
]
simvc_typical_values = np.append(idealvc_typical_values, [
8.0e-3, # GOhm
-5.0, # mV
])
simvc_best_values = np.append(idealvc_typical_values, [
5.0e-3, # GOhm
5.0, # mV
])
simvc_names = idealvc_names + [
r'$R_{series}$',
r'$V^{\dagger}_{off}$'
]
simvc_fix = ['voltageclamp.cm_est', 'voltageclamp.rseries_est']
simvc_fix_typical_values = [
10.0, # pF
0.9 * 5.0e-3, # GOhm
]
def get_qc(path, filename, cell):
# path: path to files
# filename: e.g. herg25oc1
# cell: e.g. A01
#
# return: rseal, cm, rseries (in GOhm, pF, GOhm)
path2cellid = path + '/' + filename + '-staircaseramp-cell_id.txt'
path2cellrseal = path + '/' + filename + '-staircaseramp-Rseal_before.txt'
path2cellcm = path + '/' + filename + '-staircaseramp-Cm_before.txt'
path2cellrseries = path + '/' + filename + \
'-staircaseramp-Rseries_before.txt'
with open(path2cellid, 'r') as f:
cellid = f.read().splitlines()
idx = cellid.index(cell)
rseal = np.loadtxt(path2cellrseal)[idx] * 1e-9 # GOhm
cm = np.loadtxt(path2cellcm)[idx] * 1e12 # pF
rseries = np.loadtxt(path2cellrseries)[idx] * 1e-9 # GOhm
return rseal, cm, rseries
''' # Leak model 3
leak = ['inlleak.A1',
'inlleak.B1',
'inlleak.gd',
'inlleak.Ed',
'inlleak.gt',
'inlleak.tauta',
'inlleak.tautb',
'inlleak.Et']
leak_typical_values = [
2e-2, # for no cell recording
2e-7,
2e-3, # TODO
2e-8, # TODO
0.5e-1, # pA/mV/mV
200., # ms
2., # ms/mV
5.0, # mV
]
''' # Leak model 4
leak = ['inlleak.A1a',
'inlleak.A1b',
'inlleak.B1a',
'inlleak.B1b',
'inlleak.gt',
'inlleak.tauta',
'inlleak.tautb',
'inlleak.Et']
leak_typical_values = [
2e-2, # for no cell recording
2e-7,
2e-3,
2e-8,
0.5e-1, # pA/mV/mV
200., # ms
2., # ms/mV
5.0, # mV
]
#'''
# Realistic voltage clamp model with leak model
fullvc_wLeak = fullvc + leak