-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsweep_rmp.py
60 lines (53 loc) · 1.51 KB
/
sweep_rmp.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
import cells
import matplotlib.pyplot as plt
import pandas
import numpy as np
# cells.somaRule
# cells.tigerholmCableRule
# cells.choiSomaRule
# cells.mandgeSomaRule
soma = cells.createSoma(cells.tigerholmCableRule)
#ions = ['ca', 'cl', 'h', 'k', 'na']
ions = ['na', 'k']
rmps = np.linspace(-80,-40, 41)
data = {}
data_pas = {}
# note that
# ca: bkca, cadyn, skca3, trpm8
# na: cadyn, knatype
# are empty
for ion in ions:
data[ion] = {}
for mech in soma('soma').ions[ion]['mechs']:
data[ion][mech] = []
data['i_net'] = []
data['e_pas'] = []
data['rmp'] = rmps
for rmp in rmps:
rmpdata = soma.init_v(rmp, ions)['soma']
for mech in rmpdata:
try:
for ion in rmpdata[mech]:
if rmpdata[mech][ion]:
data[ion][mech].append(rmpdata[mech][ion])
except:
data[mech].append(rmpdata[mech])
data_pas[rmp] = rmpdata['e_pas']
for ion in ions:
plt.title(ion)
for mech in data[ion]:
if data[ion][mech]:
plt.plot(rmps, data[ion][mech], label=mech)
plt.legend()
plt.xlabel("membrane potential (mV)")
plt.ylabel("steady state current (mA/cm2)")
plt.show()
plt.title('e_pas')
plt.plot(rmps, data['e_pas'])
plt.xlabel("membrane potential (mV)")
plt.ylabel("e_pas (mV)")
plt.show()
[data['na'][mech] for mech in ['nattxsT', 'nav1p8T', 'nav1p'] ]
df_pas = pandas.DataFrame( [data['e_pas'], data['na']['h'], data['na']['nattxsT'], data['na']], columns = rmps)
df_pas.to_csv("e_pas.csv")
df_pas.to_dict()