File size: 5,973 Bytes
0558c72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "tags": []
   },
   "source": [
    "# Interactive Tutorial for the Hodgkin Huxley Model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This Jupyter notebook can be used to run simulations of a simple single neuron featuring ion channels which behave according to the Hodgkin Huxley model. \n",
    "\n",
    "The model relies on a basic equivalence between a biological membrane plus embedded ion channels, and an electrical circuit.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font size=\"5\">Execute the Hodgkin Huxley Model</font>\n",
    "\n",
    "**To execute the notebook and generate the interactive widget below, click the double arrow (&#9654;&#9654;) in the toolbar above**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c131ca61e49a441e95dff9c74a0b29f9",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(HBox(children=(HTMLMath(value='<b> Membrane Capacitance, \\\\(\\\\mu{F}/cm^2\\\\)</b>'),)), HBox(chil…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "3080e0df7a9645299d1e6f2f7992ef53",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# This is a Python code block which loads the interactive widget\n",
    "\n",
    "%matplotlib ipympl\n",
    "import ui_widget  # ui_widget.py contains the code for creating the widget\n",
    "ui_widget.launch_interactive_widget() # call the method to launch the widget"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font size=\"5\">Description of the plots</font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "1) The top-most plot, shows **current injected into the cell membrane, I<sub>inj</sub>**. The amplitude, duration and delay of the injected current pulse can be changed using the sliders.\n",
    "\n",
    "2) The second plot shows the **activation/inactivation variables** of the ion channels in the neuron: activation variable **m** and inactivation variable **h** for *Na*, and activation variable **n** for *K*. Activation variables increase as the cell becomes depolarised (**V<sub>m</sub>** increases) and the inactivation variable decreases. **m** responds to these changes quicker than **h** or **n**.\n",
    "\n",
    "3) The third (optional) plot shows the **conductance scaling factors** for Sodium (**m<sup>3</sup> * h**) and Potassium (**n<sup>4</sup>**). Note: these only ever have a value between 0 and 1. \n",
    "\n",
    "4) The fourth plot shows the **conductance densities** for Sodium (**g<sub>Na</sub> = gmax<sub>Na</sub> m<sup>3</sup> h**) and Potassium (**g<sub>K</sub> = gmax<sub>K</sub> n<sup>4</sup>**). Note, the leak conductance density value, **g<sub>L</sub>** is not voltage dependent, and so does not vary with time. The maximum conductance densities for the 3 conductances can be changed or set to zero.\n",
    "\n",
    "5) The fifth (optional) plot shows the **driving force** for the Sodium (**V<sub>m</sub> - E<sub>Na</sub>**) and Potassium (**V<sub>m</sub> - E<sub>K</sub>**) currents. Note, the important value here is how different these are from the zero line, i.e. the magnitude of the force driving ions in or out of the cell. \n",
    "\n",
    "6) The sixth plot shows the influx (negative y-axis) and outflux (positive y-axis) of **ionic currents** (**I<sub>Na</sub> = g<sub>Na</sub> (V<sub>m</sub> - E<sub>Na</sub>), I<sub>K</sub> = g<sub>K</sub> (V<sub>m</sub> - E<sub>K</sub>)** and **I<sub>L</sub> = g<sub>L</sub> (V<sub>m</sub> - E<sub>L</sub>)**) passing through each type of ion channel being modeled. The reversal potentials of each of these (**E<sub>X</sub>**) can be altered above. \n",
    "\n",
    "7) The bottom plot shows the **neural membrane potential activity, V<sub>m</sub>**. The spikes here are called \"action potentials\". This variable is governed by the expression: **dV<sub>m</sub>/dt = (I<sub>inj</sub> - I<sub>Na</sub> - I<sub>K</sub> - I<sub>L</sub>)/C<sub>m</sub>**\n",
    "\n",
    "\n",
    "![hh](../../Tutorial/_media/equivalentCircuit.png)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font size=\"5\">Notes</font>\n",
    "\n",
    ">**Note 1: Python source of the HH model<br />** The source of the HH model in Python as used in this notebook can be found [here](https://github.com/openworm/hodgkin_huxley_tutorial/blob/master/Tutorial/Source/HodgkinHuxley.py).\n",
    "\n",
    ">**Note 2: Sign of channel current $I_{Na}$, $I_{K}$ and $I_{L}$ are opposite to NeuroML tutorial<br />**\n",
    "The Python code is interested in the current coming through the channel (so positive if flowing \"out\" like K, negative if flowing \"in\", like Na), whereas for the NeuroML channels (more specifically the channel density element) is what's flowing into the cell (so positive for Na)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "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.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}