.. 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 Click :ref:`here ` 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) ---------------------------------------------------------------------------------------------- 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:: default import nest import nest.voltage_trace import matplotlib.pyplot as plt 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:: default 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:: default 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:: default 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:: default 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:: default 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:: default nest.Simulate(1000.0) nest.voltage_trace.from_device(voltmeter) plt.axis([0, 1000, -80, -20]) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _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-python :download:`Download Python source code: brette_gerstner_fig_2c.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: brette_gerstner_fig_2c.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_