This version of the documentation is NOT an official release. You are looking at ‘latest’, which is in active and ongoing development. You can change versions on the bottom left of the screen.

Connect two populations with convergent projection and rectangular mask, visualize connections from source perspective

Create two populations of iaf_psc_alpha neurons on a 30x30 grid

BCCN Tutorial @ CNS*09 Hans Ekkehard Plesser, UMB

import nest
import matplotlib.pyplot as plt
import numpy as np


pos = nest.spatial.grid(shape=[30, 30], extent=[3., 3.], edge_wrap=True)

create and connect two populations

a = nest.Create('iaf_psc_alpha', positions=pos)
b = nest.Create('iaf_psc_alpha', positions=pos)

cdict = {'rule': 'pairwise_bernoulli',
         'p': 0.5,
         'use_on_source': True,
         'mask': {'rectangular': {'lower_left': [-0.2, -0.5],
                                  'upper_right': [0.2, 0.5]}}}

nest.Connect(a, b,
             syn_spec={'weight': nest.random.uniform(0.5, 2.)})

first, clear existing figure, get current figure

fig = plt.gcf()

# plot targets of two source neurons into same figure, with mask
for src_index in [30 * 15 + 15, 0]:
    # obtain node id for center
    src = a[src_index:src_index + 1]
    nest.PlotTargets(src, b, mask=cdict['mask'], 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.axis([-2.0, 2.0, -2.0, 2.0])
plt.axes().set_aspect('equal', 'box')
plt.title('Connection targets')


# plt.savefig('conncon_targets.pdf')

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery