.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/brette_gerstner_fig_2c.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_brette_gerstner_fig_2c.py: Testing the adapting exponential integrate and fire model in NEST (Brette and Gerstner Fig 2C) ---------------------------------------------------------------------------------------------- .. only:: html ---- Run this example as a Jupyter notebook: .. card:: :width: 25% :margin: 2 :text-align: center :link: https://lab.ebrains.eu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fnest%2Fnest-simulator-examples&urlpath=lab%2Ftree%2Fnest-simulator-examples%2Fnotebooks%2Fnotebooks%2Fbrette_gerstner_fig_2c.ipynb&branch=main :link-alt: JupyterHub service .. image:: https://nest-simulator.org/TryItOnEBRAINS.png .. grid:: 1 1 1 1 :padding: 0 0 2 0 .. grid-item:: :class: sd-text-muted :margin: 0 0 3 0 :padding: 0 0 3 0 :columns: 4 See :ref:`our guide ` for more information and troubleshooting. ---- This example tests the adaptive integrate and fire model (AdEx) according to Brette and Gerstner [1]_ reproduces Figure 2C of the paper. Note that Brette and Gerstner give the value for `b` in `nA`. To be consistent with the other parameters in the equations, `b` must be converted to `pA` (pico Ampere). References ~~~~~~~~~~ .. [1] Brette R and Gerstner W (2005). Adaptive exponential integrate-and-fire model as an effective description of neuronal activity J. Neurophysiology. https://doi.org/10.1152/jn.00686.2005 .. GENERATED FROM PYTHON SOURCE LINES 39-47 .. code-block:: Python import matplotlib.pyplot as plt import nest import nest.voltage_trace nest.ResetKernel() .. GENERATED FROM PYTHON SOURCE LINES 48-50 First we make sure that the resolution of the simulation is 0.1 ms. This is important, since the slop of the action potential is very steep. .. GENERATED FROM PYTHON SOURCE LINES 50-54 .. code-block:: Python nest.resolution = 0.1 neuron = nest.Create("aeif_cond_alpha") .. GENERATED FROM PYTHON SOURCE LINES 55-57 `a` and `b` are parameters of the adex model. Their values come from the publication. .. GENERATED FROM PYTHON SOURCE LINES 57-60 .. code-block:: Python neuron.set(a=4.0, b=80.5) .. GENERATED FROM PYTHON SOURCE LINES 61-63 Next we define the stimulus protocol. There are two DC generators, producing stimulus currents during two time-intervals. .. GENERATED FROM PYTHON SOURCE LINES 63-67 .. code-block:: Python dc = nest.Create("dc_generator", 2) dc.set(amplitude=[500.0, 800.0], start=[0.0, 500.0], stop=[200.0, 1000.0]) .. GENERATED FROM PYTHON SOURCE LINES 68-69 We connect the DC generators. .. GENERATED FROM PYTHON SOURCE LINES 69-72 .. code-block:: Python nest.Connect(dc, neuron, "all_to_all") .. GENERATED FROM PYTHON SOURCE LINES 73-75 And add a ``voltmeter`` to sample the membrane potentials from the neuron in intervals of 0.1 ms. .. GENERATED FROM PYTHON SOURCE LINES 75-79 .. code-block:: Python voltmeter = nest.Create("voltmeter", params={"interval": 0.1}) nest.Connect(voltmeter, neuron) .. GENERATED FROM PYTHON SOURCE LINES 80-82 Finally, we simulate for 1000 ms and plot a voltage trace to produce the figure. .. GENERATED FROM PYTHON SOURCE LINES 82-88 .. code-block:: Python nest.Simulate(1000.0) nest.voltage_trace.from_device(voltmeter) plt.axis([0, 1000, -80, -20]) plt.show() .. _sphx_glr_download_auto_examples_brette_gerstner_fig_2c.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: brette_gerstner_fig_2c.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: brette_gerstner_fig_2c.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_