.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/EI_clustered_network/run_simulation_EI.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_EI_clustered_network_run_simulation_EI.py: PyNEST EI-clustered network: Run Simulation ----------------------------------------------- .. 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%2FEI_clustered_network%2Frun_simulation_EI.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 is an example script for running the EI-clustered model with two stimulations and generating a raster plot. .. GENERATED FROM PYTHON SOURCE LINES 28-57 .. code-block:: Python import matplotlib.pyplot as plt import network from helper import raster_plot from network_params import net_dict from sim_params import sim_dict from stimulus_params import stim_dict if __name__ == "__main__": # Creates object which creates the EI clustered network in NEST ei_network = network.ClusteredNetwork(sim_dict, net_dict, stim_dict) # Runs the simulation and returns the spiketimes # get simulation initializes the network in NEST # and runs the simulation # it returns a dict with the average rates, # the spiketimes and the used parameters result = ei_network.get_simulation() ax = raster_plot( result["spiketimes"], tlim=(0, sim_dict["simtime"]), colorgroups=[ ("k", 0, net_dict["N_E"]), ("darkred", net_dict["N_E"], net_dict["N_E"] + net_dict["N_I"]), ], ) plt.savefig("clustered_ei_raster.png") print(f"Firing rate of excitatory neurons: {result['e_rate']:6.2f} spikes/s") print(f"Firing rate of inhibitory neurons: {result['i_rate']:6.2f} spikes/s") .. _sphx_glr_download_auto_examples_EI_clustered_network_run_simulation_EI.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: run_simulation_EI.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: run_simulation_EI.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: run_simulation_EI.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_