Skip to content

Commit

Permalink
HH Lecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Kramer committed Sep 18, 2024
1 parent 6704a4c commit fe434b3
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 20 deletions.
Binary file modified .DS_Store
Binary file not shown.
22 changes: 11 additions & 11 deletions HH.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,11 @@
"metadata": {},
"source": [
"```{pyodide-python}\n",
"plt.show()\n",
"plt.figure()\n",
"plt.plot(t,V,'k') #Plot the voltage,\n",
"plt.xlim([42, 56]) #... focused on a single spike,\n",
"plt.ylabel('V [mV]'); #... with y-axis labeled.\n",
"plt.ylabel('V [mV]') #... with y-axis labeled.\n",
"plt.show()\n",
"```"
]
},
Expand All @@ -391,12 +392,11 @@
"source": [
"```{pyodide-python}\n",
"gNa0 = 120\n",
"gNa = gNa0*m**3*h Sodium conductance\n",
"# gNa = ??? #Sodium conductance\n",
"gK0 = 36\n",
"gK = gK0*n**4 Potassium conductance\n",
"# gK = ??? #Potassium conductance\n",
"gL0 = 0.3\n",
"gL = gL0*np.ones(np.shape(gK)) Leak conductance\n",
"plt.show()\n",
"# gL = ??? #Leak conductance\n",
"```"
]
},
Expand All @@ -421,13 +421,14 @@
"metadata": {},
"source": [
"```{pyodide-python}\n",
"plt.figure()\n",
"plt.plot(t,gNa,'m', label='gNa')#... and plot the sodium conductance,\n",
"plt.plot(t,gK, 'g', label='gK') #... and plot the potassium conductance,\n",
"plt.plot(t,gL, 'k', label='gL') #... and plot the leak conductance.\n",
"plt.xlim([42, 56]) #... focused on a single spike,\n",
"plt.xlabel('Time [ms]') #... label the x-axis.\n",
"plt.ylabel('mS/cm^2') #... and label the y-axis.\n",
"plt.legend(); #... make a legend.\n",
"plt.legend() #... make a legend.\n",
"plt.show()\n",
"```"
]
Expand Down Expand Up @@ -531,11 +532,10 @@
"source": [
"# Challenges\n",
"\n",
"1. Explain each line of the Python code that simulates the HH model.\n",
"2. Describe the dynamics of the gates and ions during an action potential in the HH model.\n",
"1. Describe the dynamics during an action potential in the HH model. How does the voltage change? How do the gates open and close? How do the ions flow?\n",
"5. Determine how the firing rate of the HH model varies with input current I. Plot the firing rate versus I (i.e., plot the “f-I curve”).\n",
"6. How do the dynamics change as you increases / decrease the potassium conductance?\n",
"7. How do the dynamics change as you increases / decrease the sodium conductance?"
"6. How does the firing rate of the HH model change as you increase the potassium conductance? Provide a \"simulation\" explanation and a \"physical\" explanation.\n",
"7. How does the firing rate of the HH model change as you increase sodium conductance? Provide a \"simulation\" explanation and a \"physical\" explanation."
]
}
],
Expand Down
Binary file added Slides/HH_Lecture_1.pdf
Binary file not shown.
9 changes: 4 additions & 5 deletions docs/HH.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
}

// Store cell data
globalThis.qpyodideCellDetails = [{"id":1,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"import numpy as np\nimport matplotlib.pyplot as plt"},{"id":2,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"import requests\nurl = \"https://raw.githubusercontent.com/Mark-Kramer/BU-MA665-MA666/master/HH_functions.py\"\nresponse = requests.get(url)\nexec(response.text)"},{"id":3,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"I0 = 0"},{"id":4,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"T0 = 100"},{"id":5,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"[V,m,h,n,t]=HH(I0,T0)"},{"id":6,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"I0 = 10"},{"id":7,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"[V,m,h,n,t] = HH(I0,T0)"},{"id":8,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"plt.figure()\nplt.plot(t,V,'k')\nplt.xlim([42, 56])\nplt.ylabel('V [mV]')\nplt.show()"},{"id":9,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"plt.figure()\nplt.plot(t,m,'r', label='m')\nplt.xlim([42, 56]);\nplt.show()"},{"id":10,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"plt.figure()\nplt.plot(t,m,'r', label='m')\nplt.plot(t,h,'b', label='h')\nplt.plot(t,n,'g', label='n')\nplt.xlim([42, 56])\nplt.xlabel('Time [ms]');\nplt.legend();\nplt.show()"},{"id":11,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"plt.figure()\nax1 = plt.subplot(211); # Define axis for 1st subplot,\nax2 = plt.subplot(212, sharex=ax1); # ... and link axis of 2nd subplot to the 1st.\nax1.plot(t,V,'k') # Plot the voltage in the first subplot,\nplt.xlim([42, 56]);\nax2.plot(t,m,'r', label='m') # ... and the gating variables in the other subplot.\nax2.plot(t,h,'b', label='h')\nax2.plot(t,n,'g', label='n')\nplt.xlabel('Time [ms]')\nplt.legend()\nplt.show()"},{"id":12,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"plt.show()\nplt.plot(t,V,'k') #Plot the voltage,\nplt.xlim([42, 56]) #... focused on a single spike,\nplt.ylabel('V [mV]'); #... with y-axis labeled."},{"id":13,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"gNa0 = 120\ngNa = gNa0*m**3*h Sodium conductance\ngK0 = 36\ngK = gK0*n**4 Potassium conductance\ngL0 = 0.3\ngL = gL0*np.ones(np.shape(gK)) Leak conductance\nplt.show()"},{"id":14,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"plt.plot(t,gNa,'m', label='gNa')#... and plot the sodium conductance,\nplt.plot(t,gK, 'g', label='gK') #... and plot the potassium conductance,\nplt.plot(t,gL, 'k', label='gL') #... and plot the leak conductance.\nplt.xlim([42, 56]) #... focused on a single spike,\nplt.xlabel('Time [ms]') #... label the x-axis.\nplt.ylabel('mS/cm^2') #... and label the y-axis.\nplt.legend(); #... make a legend.\nplt.show()"},{"id":15,"options":{"fig-cap":"","read-only":"false","label":"","results":"markup","warning":"true","out-width":"700px","autorun":"","output":"true","context":"interactive","comment":"","out-height":"","dpi":72,"message":"true","fig-width":7,"classes":"","fig-height":5},"code":"gNa0 = 120\nENa = 115\n# INa = ??? Sodium current.\ngK0 = 36\nEK =-12\n# IK = ??? Potassium current.\ngL0 = 0.3\nEL = 10.6;\n# IL = ??? Leak current.\n\nplt.figure()\nplt.plot(t,INa,'m', label='INa') #... and plot the sodium current,\nplt.plot(t,IK, 'g', label='IK') #... and plot the potassium current,\nplt.plot(t,IL, 'k', label='IL') #... and plot the leak current.\nplt.xlim([42, 56]) #... focus on a single spike,\nplt.xlabel('Time [ms]') #... label the x-axis.\nplt.ylabel('mA/cm^2') #... and label the y-axis.\nplt.legend() #... make a legend.\nplt.show()"}];
globalThis.qpyodideCellDetails = [{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"import numpy as np\nimport matplotlib.pyplot as plt","id":1},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"import requests\nurl = \"https://raw.githubusercontent.com/Mark-Kramer/BU-MA665-MA666/master/HH_functions.py\"\nresponse = requests.get(url)\nexec(response.text)","id":2},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"I0 = 0","id":3},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"T0 = 100","id":4},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"[V,m,h,n,t]=HH(I0,T0)","id":5},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"I0 = 10","id":6},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"[V,m,h,n,t] = HH(I0,T0)","id":7},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"plt.figure()\nplt.plot(t,V,'k')\nplt.xlim([42, 56])\nplt.ylabel('V [mV]')\nplt.show()","id":8},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"plt.figure()\nplt.plot(t,m,'r', label='m')\nplt.xlim([42, 56]);\nplt.show()","id":9},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"plt.figure()\nplt.plot(t,m,'r', label='m')\nplt.plot(t,h,'b', label='h')\nplt.plot(t,n,'g', label='n')\nplt.xlim([42, 56])\nplt.xlabel('Time [ms]');\nplt.legend();\nplt.show()","id":10},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"plt.figure()\nax1 = plt.subplot(211); # Define axis for 1st subplot,\nax2 = plt.subplot(212, sharex=ax1); # ... and link axis of 2nd subplot to the 1st.\nax1.plot(t,V,'k') # Plot the voltage in the first subplot,\nplt.xlim([42, 56]);\nax2.plot(t,m,'r', label='m') # ... and the gating variables in the other subplot.\nax2.plot(t,h,'b', label='h')\nax2.plot(t,n,'g', label='n')\nplt.xlabel('Time [ms]')\nplt.legend()\nplt.show()","id":11},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"plt.figure()\nplt.plot(t,V,'k') #Plot the voltage,\nplt.xlim([42, 56]) #... focused on a single spike,\nplt.ylabel('V [mV]') #... with y-axis labeled.\nplt.show()","id":12},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"gNa0 = 120\n# gNa = ??? #Sodium conductance\ngK0 = 36\n# gK = ??? #Potassium conductance\ngL0 = 0.3\n# gL = ??? #Leak conductance","id":13},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"plt.figure()\nplt.plot(t,gNa,'m', label='gNa')#... and plot the sodium conductance,\nplt.plot(t,gK, 'g', label='gK') #... and plot the potassium conductance,\nplt.plot(t,gL, 'k', label='gL') #... and plot the leak conductance.\nplt.xlim([42, 56]) #... focused on a single spike,\nplt.xlabel('Time [ms]') #... label the x-axis.\nplt.ylabel('mS/cm^2') #... and label the y-axis.\nplt.legend() #... make a legend.\nplt.show()","id":14},{"options":{"warning":"true","output":"true","fig-height":5,"context":"interactive","results":"markup","message":"true","fig-cap":"","out-height":"","label":"","out-width":"700px","autorun":"","classes":"","fig-width":7,"read-only":"false","dpi":72,"comment":""},"code":"gNa0 = 120\nENa = 115\n# INa = ??? Sodium current.\ngK0 = 36\nEK =-12\n# IK = ??? Potassium current.\ngL0 = 0.3\nEL = 10.6;\n# IL = ??? Leak current.\n\nplt.figure()\nplt.plot(t,INa,'m', label='INa') #... and plot the sodium current,\nplt.plot(t,IK, 'g', label='IK') #... and plot the potassium current,\nplt.plot(t,IL, 'k', label='IL') #... and plot the leak current.\nplt.xlim([42, 56]) #... focus on a single spike,\nplt.xlabel('Time [ms]') #... label the x-axis.\nplt.ylabel('mA/cm^2') #... and label the y-axis.\nplt.legend() #... make a legend.\nplt.show()","id":15}];


</script>
Expand Down Expand Up @@ -740,11 +740,10 @@ <h1 data-number="6"><span class="header-section-number">6</span> Discussion</h1>
<section id="challenges" class="level1" data-number="7">
<h1 data-number="7"><span class="header-section-number">7</span> Challenges</h1>
<ol type="1">
<li>Explain each line of the Python code that simulates the HH model.</li>
<li>Describe the dynamics of the gates and ions during an action potential in the HH model.</li>
<li>Describe the dynamics during an action potential in the HH model. How does the voltage change? How do the gates open and close? How do the ions flow?</li>
<li>Determine how the firing rate of the HH model varies with input current I. Plot the firing rate versus I (i.e., plot the “f-I curve”).</li>
<li>How do the dynamics change as you increases / decrease the potassium conductance?</li>
<li>How do the dynamics change as you increases / decrease the sodium conductance?</li>
<li>How does the firing rate of the HH model change as you increase the potassium conductance? Provide a “simulation” explanation and a “physical” explanation.</li>
<li>How does the firing rate of the HH model change as you increase sodium conductance? Provide a “simulation” explanation and a “physical” explanation.</li>
</ol>


Expand Down
Loading

0 comments on commit fe434b3

Please sign in to comment.