Skip to content

Commit 10d25bb

Browse files
committed
add example of Fazli_2022_gj_coupled_bursting_pituitary_cells.py
1 parent 409761f commit 10d25bb

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
""""
5+
Implementation of the paper:
6+
7+
- Fazli, Mehran, and Richard Bertram. "Network Properties of Electrically
8+
Coupled Bursting Pituitary Cells." Frontiers in Endocrinology 13 (2022).
9+
"""
10+
11+
import brainpy as bp
12+
import brainpy.math as bm
13+
14+
15+
class PituitaryCell(bp.NeuGroup):
16+
def __init__(self, size, name=None):
17+
super(PituitaryCell, self).__init__(size, name=name)
18+
19+
# parameter values
20+
self.vn = -5
21+
self.kc = 0.12
22+
self.ff = 0.005
23+
self.vca = 60
24+
self.vk = -75
25+
self.vl = -50.0
26+
self.gk = 2.5
27+
self.cm = 5
28+
self.gbk = 1
29+
self.gca = 2.1
30+
self.gsk = 2
31+
self.vm = -20
32+
self.vb = -5
33+
self.sn = 10
34+
self.sm = 12
35+
self.sbk = 2
36+
self.taun = 30
37+
self.taubk = 5
38+
self.ks = 0.4
39+
self.alpha = 0.0015
40+
self.gl = 0.2
41+
42+
# variables
43+
self.V = bm.Variable(bm.random.random(self.num) * -90 + 20)
44+
self.n = bm.Variable(bm.random.random(self.num) / 2)
45+
self.b = bm.Variable(bm.random.random(self.num) / 2)
46+
self.c = bm.Variable(bm.random.random(self.num))
47+
self.input = bm.Variable(self.num)
48+
49+
# integrators
50+
self.integral = bp.odeint(bp.JointEq(self.dV, self.dn, self.dc, self.db), method='exp_euler')
51+
52+
def dn(self, n, t, V):
53+
ninf = 1 / (1 + bm.exp((self.vn - V) / self.sn))
54+
return (ninf - n) / self.taun
55+
56+
def db(self, b, t, V):
57+
bkinf = 1 / (1 + bm.exp((self.vb - V) / self.sbk))
58+
return (bkinf - b) / self.taubk
59+
60+
def dc(self, c, t, V):
61+
minf = 1 / (1 + bm.exp((self.vm - V) / self.sm))
62+
ica = self.gca * minf * (V - self.vca)
63+
return -self.ff * (self.alpha * ica + self.kc * c)
64+
65+
def dV(self, V, t, n, b, c):
66+
minf = 1 / (1 + bm.exp((self.vm - V) / self.sm))
67+
cinf = c ** 2 / (c ** 2 + self.ks * self.ks)
68+
ica = self.gca * minf * (V - self.vca)
69+
isk = self.gsk * cinf * (V - self.vk)
70+
ibk = self.gbk * b * (V - self.vk)
71+
ikdr = self.gk * n * (V - self.vk)
72+
il = self.gl * (V - self.vl)
73+
return -(ica + isk + ibk + ikdr + il + self.input) / self.cm
74+
75+
def update(self, tdi, x=None):
76+
V, n, c, b = self.integral(self.V.value, self.n.value, self.c.value, self.b.value, tdi.t, tdi.dt)
77+
self.V.value = V
78+
self.n.value = n
79+
self.c.value = c
80+
self.b.value = b
81+
82+
def clear_input(self):
83+
self.input.value = bm.zeros_like(self.input)
84+
85+
86+
class PituitaryNetwork(bp.Network):
87+
def __init__(self, num, gc):
88+
super(PituitaryNetwork, self).__init__()
89+
90+
self.N = PituitaryCell(num)
91+
self.gj = bp.synapses.GapJunction(self.N, self.N, bp.conn.All2All(include_self=False), g_max=gc)
92+
93+
94+
if __name__ == '__main__':
95+
net = PituitaryNetwork(2, 0.002)
96+
runner = bp.DSRunner(net, monitors={'V': net.N.V}, dt=0.5)
97+
runner.run(10 * 1e3)
98+
99+
fig, gs = bp.visualize.get_figure(1, 1, 6, 10)
100+
fig.add_subplot(gs[0, 0])
101+
bp.visualize.line_plot(runner.mon.ts, runner.mon.V, plot_ids=(0, 1), show=True)

0 commit comments

Comments
 (0)