.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/spatial/gaussex.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_spatial_gaussex.py: Spatial networks: Gaussian probabilistic kernel ----------------------------------------------- .. 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%2Fspatial%2Fgaussex.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. ---- Create two populations on a 30x30 grid and connect them using a Gaussian probabilistic kernel BCCN Tutorial @ CNS*09 Hans Ekkehard Plesser, UMB .. GENERATED FROM PYTHON SOURCE LINES 30-37 .. code-block:: Python import matplotlib.pyplot as plt import nest import numpy as np nest.ResetKernel() .. GENERATED FROM PYTHON SOURCE LINES 38-39 create two test layers .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: Python pos = nest.spatial.grid(shape=[30, 30], extent=[3.0, 3.0]) .. GENERATED FROM PYTHON SOURCE LINES 42-43 create and connect two populations .. GENERATED FROM PYTHON SOURCE LINES 43-54 .. code-block:: Python a = nest.Create("iaf_psc_alpha", positions=pos) b = nest.Create("iaf_psc_alpha", positions=pos) cdict = { "rule": "pairwise_bernoulli", "p": nest.spatial_distributions.gaussian(nest.spatial.distance, std=0.5), "mask": {"circular": {"radius": 3.0}}, } nest.Connect(a, b, cdict) .. GENERATED FROM PYTHON SOURCE LINES 55-59 plot targets of neurons in different grid locations plot targets of two source neurons into same figure, with mask use different colors .. GENERATED FROM PYTHON SOURCE LINES 59-88 .. code-block:: Python for src_index, color, cmap in [(30 * 15 + 15, "blue", "Blues"), (0, "green", "Greens")]: # obtain node id for center src = a[src_index : src_index + 1] fig = plt.figure() nest.PlotTargets( src, b, mask=cdict["mask"], probability_parameter=cdict["p"], src_color=color, tgt_color=color, mask_color=color, probability_cmap=cmap, src_size=100, fig=fig, ) # beautify plt.axes().set_xticks(np.arange(-1.5, 1.55, 0.5)) plt.axes().set_yticks(np.arange(-1.5, 1.55, 0.5)) plt.grid(True) plt.axis([-2.0, 2.0, -2.0, 2.0]) plt.axes().set_aspect("equal", "box") plt.title("Connection targets, Gaussian kernel") plt.show() # plt.savefig('gaussex.pdf') .. _sphx_glr_download_auto_examples_spatial_gaussex.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: gaussex.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: gaussex.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_