{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Graded Exercise 1: Quadratic integrate and fire" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "first name: ...\n", "\n", "last name: ...\n", "\n", "sciper: ...\n", "\n", "date: ...\n", "\n", "*Your teammate*\n", "\n", "first name of your teammate: ...\n", "\n", "last name of your teammate: ...\n", "\n", "sciper of your teammate: ...\n", "\n", "\n", "Note: You are allowed to discuss the concepts with your class mates. You are not allowed to share code. You have to understand every line of code you write in this notebook. We will ask you questions about your submission during a fraud detection session during the last week of the semester.\n", "\n", "\n", "** Submission **\n", "\n", "Rename this notebook to Ex1_FirstName_LastName_Sciper.ipynb and upload that single file on moodle before the deadline." ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## 1.1 Quadratic Integrate and Fire neuron [20 points]\n", "This exercise is not available online. All information is given here.\n", "\n", "1.1.1 Read the book chapter about the quadratic integrate and fire neuron\n", "https://neuronaldynamics.epfl.ch/online/Ch5.S3.html\n", "\n", "[0 point]\n", "\n", "1.1.2 Implement the quadratic integrate and fire neuron in Brian2:\n", "\n", "* Follow the [source]-link in the documentation to get the Python source code of the exponential integrate and fire neuron. https://lcn-neurodynex-exercises.readthedocs.io/en/latest/modules/neurodynex3.exponential_integrate_fire.html\n", "* Find the one function that implements the exponential LIF. Copy that function into this notebook. Rename the function, change it's parameters and modify the dynamics from the exponential to the quadratic equation (Equation 5.16 in the book).\n", "\n", "[6 points]\n", "\n", "1.1.3 Call your function: \n", "As above, inject a current into your neuron and plot the response.\n", "\n", "\n", "[2 points]\n", "\n", "1.1.4 Approximate the exponential model\n", "* The quadratic model has three parameters: a0, v_rest and vc (note that this v_rest is different from the v_rest of the exponential model). They can be chosen such that the quadratic model approximates the exponential model. Read the box \"Example: Approximating the exponential integrate-and-fire\" in chapter http://neuronaldynamics.epfl.ch/online/Ch5.S3.html and make sure you understand figure 5.8.\n", "* On paper, find the equations that express the parameters a0, v_rest and vc (in terms of the parameters of the exponential model) such that the two models are matched (in value, slope and curvature) at the rheobase threshold.\n", "* In code, compute the values of a0, v_rest and vc using the values provided in the exp_IF module.\n", "\n", "\n", "[4 points]\n", "\n", "1.1.5 Simulate the quadratic- and the exponential model\n", "* Inject the same current into an exponential- and into your (matched) quadratic model. Set the current duration to 1 second and the amplitude to I_Rh + 0.030 * b2.namp (I_Rh as computed in exercise 3.1). Simulate for 1 second and plot the voltage responses.\n", "\n", "\n", "** Link to the exercise 3.1 **\n", "\n", "\n", "\n", "[3 point]\n", "\n", "1.1.6 Discuss your observation\n", "\n", "\n", "[5 point]\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import neurodynex3.exponential_integrate_fire.exp_IF as exp_IF\n", "from neurodynex3.tools import plot_tools, input_factory\n", "import brian2 as b2\n", "\n", "# copy the simulation function here and modify it\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-18.18181818 m^-2 kg^-1 s^3 A\n", "123. mV\n", "-65. mV\n" ] } ], "source": [ "# 1.1.4 Approximate the exponential model (solve it on paper, use the final expressions here)\n", "\n", "A_0 = 1./ exp_IF.RHEOBASE_THRESHOLD_v_rh # replace this expression with the correct formula.\n", "print(A_0)\n", "V_rest = 123 * b2.mV # replace this expression with the correct formula.\n", "print(V_rest)\n", "V_C = exp_IF.V_REST + 0.*b2.mV # replace this expression with the correct formula.\n", "print(V_C)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# 1.1.5 Simulate the quadratic- and the exponential model\n", "\n", "# your code goes here. Use the parameters A_0 V_rest and V_C computed in 3.3.4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.1.6 Discuss your observation\n", "\n", "Explain your observations here. Qualitatively compare the voltage traces of the exponential- and the quadratic model. Is the number of spikes the same for the two models?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Ex. 2. AdEx: the Adaptive Exponential Integrate-and-Fire model\n", "\n", "Use function [`AdEx.simulate_AdEx_neuron()`](https://lcn-neurodynex-exercises.readthedocs.io/en/latest/modules/neurodynex3.adex_model.html) to run the model for different input currents and different parameters. Get started by running the following script:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import brian2 as b2\n", "from neurodynex3.adex_model import AdEx\n", "from neurodynex3.tools import plot_tools, input_factory\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2.1. Exercise: Adaptation and firing patterns [7 points]\n", "\n", "We have implemented an Exponential Integrate-and-Fire model with a single adaptation current\n", "$\\begin{split}\\left[\\begin{array}{ccll}\n", "{\\displaystyle \\tau_m \\frac{du}{dt}} &=& -(u-u_{rest}) + \\Delta_T exp(\\frac{u-\\vartheta_{rh}}{\\Delta_T}) - R w + R I(t) \\\\[.2cm]\n", "{\\displaystyle \\tau_w \\frac{dw}{dt}} &=& a (u-u_{rest}) -w + b \\tau_w \\sum_{t^{(f)}} \\delta (t - t^{(f)})\n", " \\\\[.2cm]\n", "\\end{array}\\right.\\end{split}$\n", "\n", "- When you simulate the model with the default parameters, it produces the voltage trace shown above. Describe that firing pattern. Use the terminology of Fig. 6.1 in [Chapter 6.1](https://neuronaldynamics.epfl.ch/online/Ch6.S1.html) [max 2 lines, 1 point]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Call the function `AdEx.simulate_AdEx_neuron()` with different parameters and try to create adapting, bursting and irregular firing patterns. Table 6.1 in Chapter 6.1 provides a starting point for your explorations. \n", "\n", "**Note:** If you want to set a parameter to 0, Brian still expects a unit. Therefore use `a=0*b2.nS` instead of `a=0`.\n", "\n", "If you do not specify any parameter, the following default values are used:\n", "\n", "`MEMBRANE_TIME_SCALE_tau_m = 5 * b2.ms`\n", "\n", "`MEMBRANE_RESISTANCE_R = 500*b2.Mohm`\n", "\n", "`V_REST = -70.0 * b2.mV`\n", "\n", "`V_RESET = -51.0 * b2.mV`\n", "\n", "`RHEOBASE_THRESHOLD_v_rh = -50.0 * b2.mV`\n", "\n", "`SHARPNESS_delta_T = 2.0 * b2.mV`\n", "\n", "`ADAPTATION_VOLTAGE_COUPLING_a = 0.5 * b2.nS`\n", "\n", "`ADAPTATION_TIME_CONSTANT_tau_w = 100.0 * b2.ms`\n", "\n", "`SPIKE_TRIGGERED_ADAPTATION_INCREMENT_b = 7.0 * b2.pA`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[2 points]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# adapting \n", "% matplotlib inline\n", "import brian2 as b2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[2 points]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# bursting firing pattern from book" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[2 points]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# irregular firing pattern" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2.2. Exercise: phase plane and nullclines [12 points]\n", "\n", "First, try to get some intuition on shape of nullclines by plotting or simply sketching them on a piece of paper and answering the following questions.\n", "Plot or sketch the u- and w- nullclines of the AdEx model (`I(t) = 0`)\n", "- What is the direction of the flow arrows on the u-nullcline ?\n", "- How do the nullclines change with respect to `a`?\n", "- What is the interpretation of parameter `b`?\n", "- How do flow arrows change as tau_w gets bigger?\n", "\n", "[max 10 lines, 4 points]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Take `a = 0`. Find a set of parameters such that, by changing `b` only, we can see two qualitatively different firing patterns. Simulate these two patterns and write their names." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[4 points]" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# First firing pattern (simulation [2 points] and pattern name [2 points])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[4 points]" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Second firing pattern (simulation [2 points] and pattern name [2 points])" ] } ], "metadata": { "@webio": { "lastCommId": null, "lastKernelId": null }, "anaconda-cloud": {}, "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.3" } }, "nbformat": 4, "nbformat_minor": 1 }