.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/BrodyHopfield.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_BrodyHopfield.py: Spike synchronization through subthreshold oscillation ------------------------------------------------------ .. 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%2FBrodyHopfield.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 reproduces the spike synchronization behavior of integrate-and-fire neurons in response to a subthreshold oscillation. This phenomenon is shown in Fig. 1 of [1]_ Neurons receive a weak 35 Hz oscillation, a gaussian noise current and an increasing DC. The time-locking capability is shown to depend on the input current given. The result is then plotted using matplotlib. All parameters are taken from the above paper. References ~~~~~~~~~~ .. [1] Brody CD and Hopfield JJ (2003). Simple networks for spike-timing-based computation, with application to olfactory processing. Neuron 37, 843-852. .. GENERATED FROM PYTHON SOURCE LINES 46-47 First, we import all necessary modules for simulation, analysis, and plotting. .. GENERATED FROM PYTHON SOURCE LINES 47-52 .. code-block:: Python import matplotlib.pyplot as plt import nest import nest.raster_plot .. GENERATED FROM PYTHON SOURCE LINES 53-54 Second, the simulation parameters are assigned to variables. .. GENERATED FROM PYTHON SOURCE LINES 54-74 .. code-block:: Python N = 1000 # number of neurons bias_begin = 140.0 # minimal value for the bias current injection [pA] bias_end = 200.0 # maximal value for the bias current injection [pA] T = 600 # simulation time (ms) # parameters for the alternating-current generator driveparams = {"amplitude": 50.0, "frequency": 35.0} # parameters for the noise generator noiseparams = {"mean": 0.0, "std": 200.0} neuronparams = { "tau_m": 20.0, # membrane time constant "V_th": 20.0, # threshold potential "E_L": 10.0, # membrane resting potential "t_ref": 2.0, # refractory period "V_reset": 0.0, # reset potential "C_m": 200.0, # membrane capacitance "V_m": 0.0, } # initial membrane potential .. GENERATED FROM PYTHON SOURCE LINES 75-77 Third, the nodes are created using ``Create``. We store the returned handles in variables for later reference. .. GENERATED FROM PYTHON SOURCE LINES 77-83 .. code-block:: Python neurons = nest.Create("iaf_psc_alpha", N) sr = nest.Create("spike_recorder") noise = nest.Create("noise_generator") drive = nest.Create("ac_generator") .. GENERATED FROM PYTHON SOURCE LINES 84-85 Set the parameters specified above for the generators using ``set``. .. GENERATED FROM PYTHON SOURCE LINES 85-89 .. code-block:: Python drive.set(driveparams) noise.set(noiseparams) .. GENERATED FROM PYTHON SOURCE LINES 90-93 Set the parameters specified above for the neurons. Neurons get an internal current. The first neuron additionally receives the current with amplitude ``bias_begin``, the last neuron with amplitude ``bias_end``. .. GENERATED FROM PYTHON SOURCE LINES 93-97 .. code-block:: Python neurons.set(neuronparams) neurons.I_e = [(n * (bias_end - bias_begin) / N + bias_begin) for n in range(1, len(neurons) + 1)] .. GENERATED FROM PYTHON SOURCE LINES 98-100 Connect alternating current and noise generators as well as spike_recorders to neurons .. GENERATED FROM PYTHON SOURCE LINES 100-105 .. code-block:: Python nest.Connect(drive, neurons) nest.Connect(noise, neurons) nest.Connect(neurons, sr) .. GENERATED FROM PYTHON SOURCE LINES 106-107 Simulate the network for time ``T``. .. GENERATED FROM PYTHON SOURCE LINES 107-110 .. code-block:: Python nest.Simulate(T) .. GENERATED FROM PYTHON SOURCE LINES 111-112 Plot the raster plot of the neuronal spiking activity. .. GENERATED FROM PYTHON SOURCE LINES 112-115 .. code-block:: Python nest.raster_plot.from_device(sr, hist=True) plt.show() .. _sphx_glr_download_auto_examples_BrodyHopfield.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: BrodyHopfield.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: BrodyHopfield.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_