Spatial networks: Showcase of PlotTargets, PlotSources, GetTargetNodes, GetSourceNodesΒΆ

Run this example as a Jupyter notebook:

See our guide for more information and troubleshooting.

Anno Christopher Kurth, INM-6

import nest
from matplotlib import pyplot as plt

# create a spatial population
s_nodes = nest.Create("iaf_psc_alpha", positions=nest.spatial.grid(shape=[11, 11], extent=[11.0, 11.0]))
# connectivity specifications with a mask
conndict = {
    "rule": "pairwise_bernoulli",
    "p": 1.0,
    "mask": {"rectangular": {"lower_left": [-1.0, -1.0], "upper_right": [1.0, 1.0]}, "anchor": [3.0, 3.0]},

# get center element
center_neuron = nest.FindCenterElement(s_nodes)

# connect population s_nodes with itself according to the given
# specifications
nest.Connect(s_nodes, s_nodes, conndict)

# Plot target neurons of center neuron
fig = nest.PlotLayer(s_nodes, nodesize=80, nodecolor="coral")
nest.PlotTargets(center_neuron, s_nodes, fig=fig)
plt.title("Target neurons of center neuron")

# Plot source neurons of center neuron
fig = nest.PlotLayer(s_nodes, nodesize=80, nodecolor="coral")
nest.PlotSources(s_nodes, center_neuron, fig=fig)
plt.title("Source neurons of center neuron")

print("Target neurons of center neuron")
print(nest.GetTargetNodes(center_neuron, s_nodes))

print("Source neurons of center neuron")
print(nest.GetSourceNodes(s_nodes, center_neuron))

print("Positions of target neurons of center neuron")
print(nest.GetTargetPositions(center_neuron, s_nodes))

print("Positions of source neurons of center neuron")
print(nest.GetSourcePositions(s_nodes, center_neuron))

Gallery generated by Sphinx-Gallery