.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/gif_population.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_gif_population.py: Population of GIF neuron model with oscillatory behavior -------------------------------------------------------- .. 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%2Fgif_population.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 script simulates a population of generalized integrate-and-fire (GIF) model neurons driven by noise from a group of Poisson generators. Due to spike-frequency adaptation, the GIF neurons tend to show oscillatory behavior on the time scale comparable with the time constant of adaptation elements (stc and sfa). Population dynamics are visualized by raster plot and as average firing rate. See [1]_ and [2]_ for details. References ~~~~~~~~~~ .. [1] Schwalger T, Degert M, Gerstner W (2017). Towards a theory of cortical columns: From spiking neurons to interacting neural populations of finite size. PLoS Comput Biol. https://doi.org/10.1371/journal.pcbi.1005507 .. [2] Mensi S, Naud R, Pozzorini C, Avermann M, Petersen CC and Gerstner W (2012). Parameter extraction and classification of three cortical neuron types reveals two distinct adaptation mechanisms. Journal of Neurophysiology. 107(6), pp.1756-1775. .. GENERATED FROM PYTHON SOURCE LINES 51-52 Import all necessary modules for simulation and plotting. .. GENERATED FROM PYTHON SOURCE LINES 52-59 .. code-block:: Python import matplotlib.pyplot as plt import nest import nest.raster_plot nest.ResetKernel() .. GENERATED FROM PYTHON SOURCE LINES 60-61 Assigning the simulation parameters to variables. .. GENERATED FROM PYTHON SOURCE LINES 61-65 .. code-block:: Python dt = 0.1 simtime = 2000.0 .. GENERATED FROM PYTHON SOURCE LINES 66-68 Definition of neural parameters for the GIF model. These parameters are extracted by fitting the model to experimental data [2]_. .. GENERATED FROM PYTHON SOURCE LINES 68-86 .. code-block:: Python neuron_params = { "C_m": 83.1, "g_L": 3.7, "E_L": -67.0, "Delta_V": 1.4, "V_T_star": -39.6, "t_ref": 4.0, "V_reset": -36.7, "lambda_0": 1.0, "q_stc": [56.7, -6.9], "tau_stc": [57.8, 218.2], "q_sfa": [11.7, 1.8], "tau_sfa": [53.8, 640.0], "tau_syn_ex": 10.0, } .. GENERATED FROM PYTHON SOURCE LINES 87-88 Definition of the parameters for the population of GIF neurons. .. GENERATED FROM PYTHON SOURCE LINES 88-93 .. code-block:: Python N_ex = 100 # size of the population p_ex = 0.3 # connection probability inside the population w_ex = 30.0 # synaptic weights inside the population (pA) .. GENERATED FROM PYTHON SOURCE LINES 94-96 Definition of the parameters for the Poisson group and its connection with GIF neurons population. .. GENERATED FROM PYTHON SOURCE LINES 96-101 .. code-block:: Python N_noise = 50 # size of Poisson group rate_noise = 10.0 # firing rate of Poisson neurons (Hz) w_noise = 20.0 # synaptic weights from Poisson to population neurons (pA) .. GENERATED FROM PYTHON SOURCE LINES 102-104 Configuration of the simulation kernel with the previously defined time resolution. .. GENERATED FROM PYTHON SOURCE LINES 104-107 .. code-block:: Python nest.resolution = dt .. GENERATED FROM PYTHON SOURCE LINES 108-110 Building a population of GIF neurons, a group of Poisson neurons and a spike recorder device for capturing spike times of the population. .. GENERATED FROM PYTHON SOURCE LINES 110-117 .. code-block:: Python population = nest.Create("gif_psc_exp", N_ex, params=neuron_params) noise = nest.Create("poisson_generator", N_noise, params={"rate": rate_noise}) spike_det = nest.Create("spike_recorder") .. GENERATED FROM PYTHON SOURCE LINES 118-121 Build connections inside the population of GIF neurons population, between Poisson group and the population, and also connecting spike recorder to the population. .. GENERATED FROM PYTHON SOURCE LINES 121-128 .. code-block:: Python nest.Connect(population, population, {"rule": "pairwise_bernoulli", "p": p_ex}, syn_spec={"weight": w_ex}) nest.Connect(noise, population, "all_to_all", syn_spec={"weight": w_noise}) nest.Connect(population, spike_det) .. GENERATED FROM PYTHON SOURCE LINES 129-130 Simulation of the network. .. GENERATED FROM PYTHON SOURCE LINES 130-133 .. code-block:: Python nest.Simulate(simtime) .. GENERATED FROM PYTHON SOURCE LINES 134-136 Plotting the results of simulation including raster plot and histogram of population activity. .. GENERATED FROM PYTHON SOURCE LINES 136-140 .. code-block:: Python nest.raster_plot.from_device(spike_det, hist=True) plt.title("Population dynamics") plt.show() .. _sphx_glr_download_auto_examples_gif_population.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: gif_population.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: gif_population.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_