{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {},
"id": "view-in-github"
},
"source": ["
>"]
}
],
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"a542bf9a96d2408cbf227058c4afbae1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "VBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [
"widget-interact"
],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "VBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "VBoxView",
"box_style": "",
"children": [
"IPY_MODEL_09386aaf16b741ab835855805045783b",
"IPY_MODEL_37bd7798e314412497f1be29af682e3d",
"IPY_MODEL_90b2b04d10014a9f941f4800ad1db1a5",
"IPY_MODEL_13b01a3e9d3e4f7c833d9a5d5f7a5698",
"IPY_MODEL_615442c45b5a429a8a51175ca1214fd3",
"IPY_MODEL_9e4ff8726fcd4604aae8f355a20bed5f",
"IPY_MODEL_6d8fc8a3a6824c53ab25a1f143201148"
],
"layout": "IPY_MODEL_dbdf6f669a8d410e825301f8e6f70938"
}
},
"09386aaf16b741ab835855805045783b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatSliderModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatSliderModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "FloatSliderView",
"continuous_update": false,
"description": "C membrane capacitance",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_c78c091db8c54771a262d51eced9e409",
"max": 2,
"min": 0.1,
"orientation": "horizontal",
"readout": true,
"readout_format": ".2f",
"step": 0.1,
"style": "IPY_MODEL_b9c94a36345d4ae7bf51b5c6a50a1e0b",
"value": 1
}
},
"37bd7798e314412497f1be29af682e3d": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatSliderModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatSliderModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "FloatSliderView",
"continuous_update": false,
"description": "gNa conductance",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_e18528ec2db1453e9c40cee532f324af",
"max": 5,
"min": 0,
"orientation": "horizontal",
"readout": true,
"readout_format": ".2f",
"step": 0.1,
"style": "IPY_MODEL_15de2b463a8c4f33aedc3a606fca842c",
"value": 2
}
},
"90b2b04d10014a9f941f4800ad1db1a5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatSliderModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatSliderModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "FloatSliderView",
"continuous_update": false,
"description": "gK conductance",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_5eecdd75e3754b69956fdc97e8230dea",
"max": 5,
"min": 0,
"orientation": "horizontal",
"readout": true,
"readout_format": ".2f",
"step": 0.1,
"style": "IPY_MODEL_afbd9a157ff643ddbfac9c76584d2ac2",
"value": 1.44
}
},
"13b01a3e9d3e4f7c833d9a5d5f7a5698": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatSliderModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatSliderModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "FloatSliderView",
"continuous_update": false,
"description": "gLeak conductance",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_96033c6e4b444ca8afa7e356438b9e38",
"max": 1,
"min": 0,
"orientation": "horizontal",
"readout": true,
"readout_format": ".2f",
"step": 0.1,
"style": "IPY_MODEL_250eb014735948b29a68f1a71e12d810",
"value": 0.2
}
},
"615442c45b5a429a8a51175ca1214fd3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatSliderModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatSliderModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "FloatSliderView",
"continuous_update": false,
"description": "Input current",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_e72beacddc4044bcad5d3c17099446d9",
"max": 10,
"min": 0,
"orientation": "horizontal",
"readout": true,
"readout_format": ".2f",
"step": 0.1,
"style": "IPY_MODEL_84be298d87ad4d6c98e0664100ac6efe",
"value": 2
}
},
"9e4ff8726fcd4604aae8f355a20bed5f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ButtonModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ButtonModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ButtonView",
"button_style": "",
"description": "Run Interact",
"disabled": false,
"icon": "",
"layout": "IPY_MODEL_1905987965f14253ad8591c7071ffc63",
"style": "IPY_MODEL_b348470bc7f341a999f3519462aefdb7",
"tooltip": ""
}
},
"6d8fc8a3a6824c53ab25a1f143201148": {
"model_module": "@jupyter-widgets/output",
"model_name": "OutputModel",
"model_module_version": "1.0.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/output",
"_model_module_version": "1.0.0",
"_model_name": "OutputModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/output",
"_view_module_version": "1.0.0",
"_view_name": "OutputView",
"layout": "IPY_MODEL_58382b34a7ac4c4d991d6e90d4391def",
"msg_id": "",
"outputs": []
}
},
"dbdf6f669a8d410e825301f8e6f70938": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c78c091db8c54771a262d51eced9e409": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b9c94a36345d4ae7bf51b5c6a50a1e0b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "SliderStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "SliderStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": "initial",
"handle_color": null
}
},
"e18528ec2db1453e9c40cee532f324af": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"15de2b463a8c4f33aedc3a606fca842c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "SliderStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "SliderStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": "initial",
"handle_color": null
}
},
"5eecdd75e3754b69956fdc97e8230dea": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"afbd9a157ff643ddbfac9c76584d2ac2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "SliderStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "SliderStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": "initial",
"handle_color": null
}
},
"96033c6e4b444ca8afa7e356438b9e38": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"250eb014735948b29a68f1a71e12d810": {
"model_module": "@jupyter-widgets/controls",
"model_name": "SliderStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "SliderStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": "initial",
"handle_color": null
}
},
"e72beacddc4044bcad5d3c17099446d9": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"84be298d87ad4d6c98e0664100ac6efe": {
"model_module": "@jupyter-widgets/controls",
"model_name": "SliderStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "SliderStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": "",
"handle_color": null
}
},
"1905987965f14253ad8591c7071ffc63": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b348470bc7f341a999f3519462aefdb7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ButtonStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ButtonStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"button_color": null,
"font_weight": ""
}
},
"58382b34a7ac4c4d991d6e90d4391def": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
}
}
}
},
"cells": [
{
"cell_type": "markdown",
"source": [
"\n",
"# Hodgkin-Huxley model\n",
"\n",
"In this section you will interact with the famous Hodgkin-Huxley (HH) Neuron Model.\n",
"This was a mathematical model of a neuron's membrane potential based on careful experiments that studied the electrical properties of a squid's giant axon, which is visible to the naked eye.\n",
"\n",
"\n",
"\n",
"\n",
" Image credit: National Institute of Health, USA\n",
"\n",
"\n",
"\n",
"The HH Model is more realistic than many commonly used models of neurons. and captures the rich dynamics of a neuron's membrane as a function of its transmembrane conductances.\n",
"\n"
],
"metadata": {
"id": "6plNGvLnt4EU"
}
},
{
"cell_type": "code",
"source": [
"!pip install interact --quiet\n",
"!pip install interactive --quiet"
],
"metadata": {
"id": "dK7zScO0yTTH",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "b5e23653-01d2-473c-87fa-27b5e6814364"
},
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Building wheel for interact (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Building wheel for interactive (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
]
}
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 227,
"referenced_widgets": [
"a542bf9a96d2408cbf227058c4afbae1",
"09386aaf16b741ab835855805045783b",
"37bd7798e314412497f1be29af682e3d",
"90b2b04d10014a9f941f4800ad1db1a5",
"13b01a3e9d3e4f7c833d9a5d5f7a5698",
"615442c45b5a429a8a51175ca1214fd3",
"9e4ff8726fcd4604aae8f355a20bed5f",
"6d8fc8a3a6824c53ab25a1f143201148",
"dbdf6f669a8d410e825301f8e6f70938",
"c78c091db8c54771a262d51eced9e409",
"b9c94a36345d4ae7bf51b5c6a50a1e0b",
"e18528ec2db1453e9c40cee532f324af",
"15de2b463a8c4f33aedc3a606fca842c",
"5eecdd75e3754b69956fdc97e8230dea",
"afbd9a157ff643ddbfac9c76584d2ac2",
"96033c6e4b444ca8afa7e356438b9e38",
"250eb014735948b29a68f1a71e12d810",
"e72beacddc4044bcad5d3c17099446d9",
"84be298d87ad4d6c98e0664100ac6efe",
"1905987965f14253ad8591c7071ffc63",
"b348470bc7f341a999f3519462aefdb7",
"58382b34a7ac4c4d991d6e90d4391def"
]
},
"id": "k-ve-uW4j3Q6",
"outputId": "d129c4d5-1f47-4995-a914-ea1e1931ded2"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"interactive(children=(FloatSlider(value=1.0, continuous_update=False, description='C membrane capacitance', ma…"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "a542bf9a96d2408cbf227058c4afbae1"
}
},
"metadata": {}
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {},
"execution_count": 7
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import ipywidgets as widgets\n",
"from ipywidgets import interact, interactive, fixed, interact_manual\n",
"from IPython.display import display\n",
"\n",
"def HH_model(C,Gna,Gk,Gleak,Iin):\n",
" dt = 0.5; # all time units in ms\n",
" t_end = 1000;\n",
" num_timepoints = t_end/dt;\n",
" time = int(num_timepoints);\n",
"\n",
"# C = 1; # (muF/cm^2)\n",
"# Gna = 2.0; # (2mS/cm^2)\n",
"# Gk = 1.44; # (1.44mS/cm^2)\n",
"# Gleak = 0.2; # (0.2mS/cm^2)\n",
"\n",
"\n",
" Ena = 50.0; # 50(mV)\n",
" Ek = -80.0; # -77(mV)\n",
" Eleak = -65.0; # -54(mV)\n",
"\n",
" kn = 15.0; # (mV)\n",
" km = 7.0; # (mV);\n",
" tau = 10.0; # (ms)\n",
" Vn = -45.0; # (mV)\n",
"\n",
" n = np.zeros((time,1)); # this is our gating parameter\n",
" V = Eleak*np.ones((time,1)); # this will store our membrane potential\n",
"# Iin = 2.0; # and this is an input current (muA/cm^2)\n",
"\n",
" x = np.arange(1, time, 1, dtype=int);\n",
"\n",
"\n",
" for t in x:\n",
" minf = 1/(1+np.exp((-40.0-V[t-1])/km));\n",
" ninf = 1/(1+np.exp((Vn-V[t-1])/kn));\n",
" h = 0.89 - 1.1*n[t-1];\n",
"\n",
" dvdt = (1/C)*(-Gna*minf**3*h*(V[t-1]-Ena) - Gk*n[t-1]**4*(V[t-1]-Ek) - Gleak*(V[t-1]-Eleak) + Iin);\n",
" dndt = (1/tau)*(ninf - n[t-1]);\n",
"\n",
" V[t] = V[t-1] + dvdt*dt;\n",
" n[t] = n[t-1] + dndt*dt;\n",
"\n",
" t = np.arange(0, t_end, 0.5, dtype=float);\n",
"\n",
"\n",
" plt.plot(t,V)\n",
" plt.ylabel('Voltage (mV)');\n",
" plt.xlabel('Time (ms)');\n",
" plt.ylim(-100,100);\n",
" plt.show\n",
"\n",
"\n",
"interact_manual(HH_model, C = widgets.FloatSlider(\n",
" value=1.0,\n",
" min=0.1,\n",
" max=2.0,\n",
" step=0.1,\n",
" continuous_update=False,\n",
" style = {'description_width': 'initial'},\n",
" description='C membrane capacitance'),\n",
" Gna = widgets.FloatSlider(\n",
" value=2.0,\n",
" min=0.0,\n",
" max=5.0,\n",
" step=0.1,\n",
" continuous_update=False,\n",
" style = {'description_width': 'initial'},\n",
" description='gNa conductance'),\n",
" Gk = widgets.FloatSlider(\n",
" value=1.44,\n",
" min=0.0,\n",
" max=5.0,\n",
" step=0.1,\n",
" continuous_update=False,\n",
" style = {'description_width': 'initial'},\n",
" description='gK conductance'),\n",
" Gleak = widgets.FloatSlider(\n",
" value=0.2,\n",
" min=0.0,\n",
" max=1.0,\n",
" step=0.1,\n",
" continuous_update=False,\n",
" style = {'description_width': 'initial'},\n",
" description='gLeak conductance'),\n",
" Iin = widgets.FloatSlider(\n",
" value=2.0,\n",
" min=0.0,\n",
" max=10.0,\n",
" step=0.1,\n",
" continuous_update=False,\n",
" description='Input current')\n",
")"
]
}
]
}