target_nodes#
- class brainpy.state.spatial.target_nodes(sim, source, target)[source]#
Realized target indices of each source node (NEST
GetTargetNodes).Reads the built network’s adjacency back out (via
get_connections()) and groups the realized target indices by source node.- Parameters:
sim (
Simulator) – The simulator holding the realized connections.source (
NodeView) – A single-segment source view; targets are grouped per node in this view’s order.target (
NodeView) – The candidate-target population view.
- Returns:
One entry per source node (in
sourceorder): the sorted unique population-local target indices that node connects to.- Return type:
listofnumpy.ndarray
See also
target_positionsthe same query returning target coordinates.
Examples
>>> from brainpy import state as bp >>> import brainunit as u >>> sim = bp.Simulator(dt=0.1 * u.ms) >>> pop = sim.create(bp.iaf_psc_alpha, positions=bp.spatial.grid([3, 1], extent=[3.0, 1.0])) >>> _ = sim.connect(pop, pop, ... rule=bp.spatial.spatial_pairwise_bernoulli(p=1.0, mask=bp.spatial.circular(1.2)), ... weight=1.0 * u.pA, delay=1.0 * u.ms) >>> [t.tolist() for t in bp.spatial.target_nodes(sim, pop, pop)] [[0, 1], [0, 1, 2], [1, 2]]