{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# *(Fazli and Richard, 2022)*: Electrically Coupled Bursting Pituitary Cells\n", "\n", "[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/brainpy/examples/blob/main/gj_nets/Fazli_2022_gj_coupled_bursting_pituitary_cells.ipynb)\n", "[![Open in Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://github.com/brainpy/examples/blob/main/gj_nets/Fazli_2022_gj_coupled_bursting_pituitary_cells.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Implementation of the paper:\n", "\n", "- Fazli, Mehran, and Richard Bertram. \"Network Properties of Electrically\n", " Coupled Bursting Pituitary Cells.\" Frontiers in Endocrinology 13 (2022)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2023-07-22T04:09:52.961801800Z", "start_time": "2023-07-22T04:09:52.272292700Z" } }, "outputs": [], "source": [ "import brainpy as bp\n", "import brainpy.math as bm" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2023-07-22T04:09:52.977769300Z", "start_time": "2023-07-22T04:09:52.961801800Z" }, "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'2.4.3'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bp.__version__" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2023-07-22T04:09:53.012596400Z", "start_time": "2023-07-22T04:09:52.977769300Z" } }, "outputs": [], "source": [ "class PituitaryCell(bp.dyn.NeuDyn):\n", " def __init__(self, size, name=None):\n", " super(PituitaryCell, self).__init__(size, name=name)\n", "\n", " # parameter values\n", " self.vn = -5\n", " self.kc = 0.12\n", " self.ff = 0.005\n", " self.vca = 60\n", " self.vk = -75\n", " self.vl = -50.0\n", " self.gk = 2.5\n", " self.cm = 5\n", " self.gbk = 1\n", " self.gca = 2.1\n", " self.gsk = 2\n", " self.vm = -20\n", " self.vb = -5\n", " self.sn = 10\n", " self.sm = 12\n", " self.sbk = 2\n", " self.taun = 30\n", " self.taubk = 5\n", " self.ks = 0.4\n", " self.alpha = 0.0015\n", " self.gl = 0.2\n", "\n", " # variables\n", " self.V = bm.Variable(bm.random.random(self.num) * -90 + 20)\n", " self.n = bm.Variable(bm.random.random(self.num) / 2)\n", " self.b = bm.Variable(bm.random.random(self.num) / 2)\n", " self.c = bm.Variable(bm.random.random(self.num))\n", " self.input = bm.Variable(self.num)\n", "\n", " # integrators\n", " self.integral = bp.odeint(bp.JointEq(self.dV, self.dn, self.dc, self.db), method='exp_euler')\n", "\n", " def dn(self, n, t, V):\n", " ninf = 1 / (1 + bm.exp((self.vn - V) / self.sn))\n", " return (ninf - n) / self.taun\n", "\n", " def db(self, b, t, V):\n", " bkinf = 1 / (1 + bm.exp((self.vb - V) / self.sbk))\n", " return (bkinf - b) / self.taubk\n", "\n", " def dc(self, c, t, V):\n", " minf = 1 / (1 + bm.exp((self.vm - V) / self.sm))\n", " ica = self.gca * minf * (V - self.vca)\n", " return -self.ff * (self.alpha * ica + self.kc * c)\n", "\n", " def dV(self, V, t, n, b, c):\n", " minf = 1 / (1 + bm.exp((self.vm - V) / self.sm))\n", " cinf = c ** 2 / (c ** 2 + self.ks * self.ks)\n", " ica = self.gca * minf * (V - self.vca)\n", " isk = self.gsk * cinf * (V - self.vk)\n", " ibk = self.gbk * b * (V - self.vk)\n", " ikdr = self.gk * n * (V - self.vk)\n", " il = self.gl * (V - self.vl)\n", " return -(ica + isk + ibk + ikdr + il + self.input) / self.cm\n", "\n", " def update(self, x=None):\n", " V, n, c, b = self.integral(self.V.value, self.n.value, self.c.value, self.b.value,\n", " bp.share['t'], bp.share['dt'])\n", " self.V.value = V\n", " self.n.value = n\n", " self.c.value = c\n", " self.b.value = b\n", "\n", " def clear_input(self):\n", " self.input.value = bm.zeros_like(self.input)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2023-07-22T04:09:53.012596400Z", "start_time": "2023-07-22T04:09:52.996924Z" } }, "outputs": [], "source": [ "class PituitaryNetwork(bp.DynSysGroup):\n", " def __init__(self, num, gc):\n", " super(PituitaryNetwork, self).__init__()\n", "\n", " self.N = PituitaryCell(num)\n", " self.gj = bp.synapses.GapJunction(self.N, self.N, bp.conn.All2All(include_self=False), g_max=gc)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2023-07-22T04:09:53.834379300Z", "start_time": "2023-07-22T04:09:53.012596400Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3b9df210737249c0ba68b711a3281557", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/20000 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "net = PituitaryNetwork(2, 0.002)\n", "runner = bp.DSRunner(net, monitors={'V': net.N.V}, dt=0.5)\n", "runner.run(10 * 1e3)\n", "\n", "fig, gs = bp.visualize.get_figure(1, 1, 6, 10)\n", "fig.add_subplot(gs[0, 0])\n", "bp.visualize.line_plot(runner.mon.ts, runner.mon.V, plot_ids=(0, 1), show=True)" ] } ], "metadata": { "kernelspec": { "display_name": "brainpy", "language": "python", "name": "brainpy" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 1 }