.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/brunel_siegert_nest.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_brunel_siegert_nest.py: Mean-field theory for random balanced network --------------------------------------------- .. 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%2Fbrunel_siegert_nest.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 performs a mean-field analysis of the spiking network of excitatory and an inhibitory population of leaky-integrate-and-fire neurons simulated in ``brunel_delta_nest.py``. We refer to this spiking network of LIF neurons with 'SLIFN'. The self-consistent equation for the population-averaged firing rates (eq.27 in [1]_, [2]_) is solved by integrating a pseudo-time dynamics (eq.30 in [1]_). The latter constitutes a network of rate neurons, which is simulated here. The asymptotic rates, i.e., the fixed points of the dynamics (eq.30), are the prediction for the population and time-averaged from the spiking simulation. References ~~~~~~~~~~ .. [1] Hahne J, Dahmen D, Schuecker J, Frommer A, Bolten M, Helias M and Diesmann M. (2017). Integration of continuous-time dynamics in a spiking neural network simulator. Front. Neuroinform. 11:34. doi: 10.3389/fninf.2017.00034 .. [2] Schuecker J, Schmidt M, van Albada SJ, Diesmann M. and Helias, M. (2017). Fundamental activity constraints lead to specific interpretations of the connectome. PLOS Computational Biology 13(2): e1005179. https://doi.org/10.1371/journal.pcbi.1005179 .. GENERATED FROM PYTHON SOURCE LINES 53-59 .. code-block:: Python import nest import numpy nest.ResetKernel() .. GENERATED FROM PYTHON SOURCE LINES 60-61 Assigning the simulation parameters to variables. .. GENERATED FROM PYTHON SOURCE LINES 61-66 .. code-block:: Python dt = 0.1 # the resolution in ms simtime = 50.0 # Simulation time in ms .. GENERATED FROM PYTHON SOURCE LINES 67-68 Definition of the network parameters in the SLIFN .. GENERATED FROM PYTHON SOURCE LINES 68-73 .. code-block:: Python g = 5.0 # ratio inhibitory weight/excitatory weight eta = 2.0 # external rate relative to threshold rate epsilon = 0.1 # connection probability .. GENERATED FROM PYTHON SOURCE LINES 74-76 Definition of the number of neurons and connections in the SLIFN, needed for the connection strength in the Siegert neuron network .. GENERATED FROM PYTHON SOURCE LINES 76-84 .. code-block:: Python order = 2500 NE = 4 * order # number of excitatory neurons NI = 1 * order # number of inhibitory neurons CE = int(epsilon * NE) # number of excitatory synapses per neuron CI = int(epsilon * NI) # number of inhibitory synapses per neuron C_tot = int(CI + CE) # total number of synapses per neuron .. GENERATED FROM PYTHON SOURCE LINES 85-87 Initialization of the parameters of the Siegert neuron and the connection strength. The parameter are equivalent to the LIF-neurons in the SLIFN. .. GENERATED FROM PYTHON SOURCE LINES 87-110 .. code-block:: Python tauMem = 20.0 # time constant of membrane potential in ms theta = 20.0 # membrane threshold potential in mV neuron_params = { "tau_m": tauMem, "t_ref": 2.0, "theta": theta, "V_reset": 0.0, } J = 0.1 # postsynaptic amplitude in mV in the SLIFN J_ex = J # amplitude of excitatory postsynaptic potential J_in = -g * J_ex # amplitude of inhibitory postsynaptic potential # drift_factor in diffusion connections (see [1], eq. 28) for external # drive, excitatory and inhibitory neurons drift_factor_ext = tauMem * 1e-3 * J_ex drift_factor_ex = tauMem * 1e-3 * CE * J_ex drift_factor_in = tauMem * 1e-3 * CI * J_in # diffusion_factor for diffusion connections (see [1], eq. 29) diffusion_factor_ext = tauMem * 1e-3 * J_ex**2 diffusion_factor_ex = tauMem * 1e-3 * CE * J_ex**2 diffusion_factor_in = tauMem * 1e-3 * CI * J_in**2 .. GENERATED FROM PYTHON SOURCE LINES 111-112 External drive, this is equivalent to the drive in the SLIFN .. GENERATED FROM PYTHON SOURCE LINES 112-117 .. code-block:: Python nu_th = theta / (J * CE * tauMem) nu_ex = eta * nu_th p_rate = 1000.0 * nu_ex * CE .. GENERATED FROM PYTHON SOURCE LINES 118-122 Configuration of the simulation kernel by the previously defined time resolution used in the simulation. Setting ``print_time`` to `True` prints the already processed simulation time as well as its percentage of the total simulation time. .. GENERATED FROM PYTHON SOURCE LINES 122-129 .. code-block:: Python nest.resolution = dt nest.print_time = True nest.overwrite_files = True print("Building network") .. GENERATED FROM PYTHON SOURCE LINES 130-133 Creation of the nodes using ``Create``. One rate neuron represents the excitatory population of LIF-neurons in the SLIFN and one the inhibitory population assuming homogeneity of the populations. .. GENERATED FROM PYTHON SOURCE LINES 133-137 .. code-block:: Python siegert_ex = nest.Create("siegert_neuron", params=neuron_params) siegert_in = nest.Create("siegert_neuron", params=neuron_params) .. GENERATED FROM PYTHON SOURCE LINES 138-142 The Poisson drive in the SLIFN is replaced by a driving rate neuron, which does not receive input from other neurons. The activity of the rate neuron is controlled by setting ``mean`` to the rate of the corresponding poisson generator in the SLIFN. .. GENERATED FROM PYTHON SOURCE LINES 142-145 .. code-block:: Python siegert_drive = nest.Create("siegert_neuron", params={"mean": p_rate}) .. GENERATED FROM PYTHON SOURCE LINES 146-148 To record from the rate neurons a multimeter is created and the parameter ``record_from`` is set to `rate` as well as the recording interval to `dt` .. GENERATED FROM PYTHON SOURCE LINES 148-151 .. code-block:: Python multimeter = nest.Create("multimeter", params={"record_from": ["rate"], "interval": dt}) .. GENERATED FROM PYTHON SOURCE LINES 152-155 Connections between ``Siegert neurons`` are realized with the synapse model ``diffusion_connection``. These two parameters reflect the prefactors in front of the rate variable in eq. 27-29 in [1]. .. GENERATED FROM PYTHON SOURCE LINES 157-158 Connections originating from the driving neuron .. GENERATED FROM PYTHON SOURCE LINES 158-169 .. code-block:: Python syn_dict = { "drift_factor": drift_factor_ext, "diffusion_factor": diffusion_factor_ext, "synapse_model": "diffusion_connection", } nest.Connect(siegert_drive, siegert_ex + siegert_in, "all_to_all", syn_dict) nest.Connect(multimeter, siegert_ex + siegert_in) .. GENERATED FROM PYTHON SOURCE LINES 170-171 Connections originating from the excitatory neuron .. GENERATED FROM PYTHON SOURCE LINES 171-180 .. code-block:: Python syn_dict = { "drift_factor": drift_factor_ex, "diffusion_factor": diffusion_factor_ex, "synapse_model": "diffusion_connection", } nest.Connect(siegert_ex, siegert_ex + siegert_in, "all_to_all", syn_dict) .. GENERATED FROM PYTHON SOURCE LINES 181-182 Connections originating from the inhibitory neuron .. GENERATED FROM PYTHON SOURCE LINES 182-190 .. code-block:: Python syn_dict = { "drift_factor": drift_factor_in, "diffusion_factor": diffusion_factor_in, "synapse_model": "diffusion_connection", } nest.Connect(siegert_in, siegert_ex + siegert_in, "all_to_all", syn_dict) .. GENERATED FROM PYTHON SOURCE LINES 191-192 Simulate the network .. GENERATED FROM PYTHON SOURCE LINES 192-195 .. code-block:: Python nest.Simulate(simtime) .. GENERATED FROM PYTHON SOURCE LINES 196-200 Analyze the activity data. The asymptotic rate of the Siegert neuron corresponds to the population- and time-averaged activity in the SLIFN. For the symmetric network setup used here, the excitatory and inhibitory rates are identical. For comparison execute the example ``brunel_delta_nest.py``. .. GENERATED FROM PYTHON SOURCE LINES 200-207 .. code-block:: Python data = multimeter.events rates_ex = data["rate"][numpy.where(data["senders"] == siegert_ex.global_id)] rates_in = data["rate"][numpy.where(data["senders"] == siegert_in.global_id)] times = data["times"][numpy.where(data["senders"] == siegert_in.global_id)] print(f"Excitatory rate : {rates_ex[-1]:.2f} Hz") print(f"Inhibitory rate : {rates_in[-1]:.2f} Hz") .. _sphx_glr_download_auto_examples_brunel_siegert_nest.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: brunel_siegert_nest.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: brunel_siegert_nest.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_