-
Notifications
You must be signed in to change notification settings - Fork 0
/
iv.py
57 lines (51 loc) · 1.54 KB
/
iv.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
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 7 16:17:15 2019
@author: daniel
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def sigmoid(x, x_offset, alpha, Mg, eta):
s = 1 / (1 + Mg*eta* np.exp(-alpha * (x - x_offset)) )
return s
Erev_AMPA = 0
Erev_NMDA = 15
Erev_GABA = -80
gAMPA = 0.0
gGABA = 0.4
gNMDA = 0.5
gKir = 0.0
Erev_K = -80
alpha = 0.08
eta = 0.25
Mg = 1.0
alphas = np.arange(0.054, 0.096, 0.004)
etas = np.exp([-3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2]) #np.arange(0.02, 0.4, 0.04)
#etas = np.exp(np.arange(-80, 80, 20))
v = np.arange(-100, 0,0.01)
#kinf = sigmoid(v, -102, -1/13, 1, 1)
sns.set(font_scale = 1.5)
sns.set_style("ticks")
fa = plt.figure()
ax_a = fa.add_subplot(111)
colors = sns.cubehelix_palette(len(alphas))
for a,c in zip(alphas, colors):
block = sigmoid(v, 0, a, Mg, eta)
i = gGABA*(v - Erev_GABA)+ gAMPA*(v- Erev_AMPA) + np.multiply(gNMDA*(v-Erev_NMDA), block) #+ gKir*kinf*(v - Erev_K)
ax_a.plot(v, i, color = c)
ax_a.plot(v, np.zeros(v.shape), '--', color = 'grey')
ax_a.set_xlabel('V (mV)')
ax_a.set_ylabel('I (pA)')
fe = plt.figure()
ax_e = fe.add_subplot(111)
alpha = 0.086
colors = sns.cubehelix_palette(len(etas), rot = -0.5)
for e,c in zip(etas, colors):
block = sigmoid(v, 0, alpha, Mg, e)
i = gGABA*(v - Erev_GABA)+ gAMPA*(v- Erev_AMPA) + np.multiply(gNMDA*(v-Erev_NMDA), block) #+ gKir*kinf*(v - Erev_K)
ax_e.plot(v, i, color = c)
ax_e.plot(v, np.zeros(v.shape), '--', color = 'grey')
ax_e.set_xlabel('V (mV)')
ax_e.set_ylabel('I (pA)')
plt.show()