pynn_brainscales.brainscales2.projections.PopulationView

class pynn_brainscales.brainscales2.projections.PopulationView(parent, selector, label=None)

Bases: pyNN.common.populations.BasePopulation

A view of a subset of neurons within a Population.

In most ways, Populations and PopulationViews have the same behaviour, i.e. they can be recorded, connected with Projections, etc. It should be noted that any changes to neurons in a PopulationView will be reflected in the parent Population and vice versa.

It is possible to have views of views.

Arguments:
selector:

a slice or numpy mask array. The mask array should either be a boolean array of the same size as the parent, or an integer array containing cell indices, i.e. if p.size == 5:

PopulationView(p, array([False, False, True, False, True]))
PopulationView(p, array([2,4]))
PopulationView(p, slice(2,5,2))

will all create the same view.

__init__(parent, selector, label=None)

Create a view of a subset of neurons within a parent Population or PopulationView.

Methods

__init__(parent, selector[, label])

Create a view of a subset of neurons within a parent Population or PopulationView.

describe([template, engine])

Returns a human-readable description of the population view.

id_to_index(id)

Given the ID(s) of cell(s) in the PopulationView, return its/their index/indices (order in the PopulationView).

index_from_parent_index(indices)

Given an index(indices) in the parent population, return the index(indices) within this view.

index_in_grandparent(indices)

Given an array of indices, return the indices in the parent population at the root of the tree.

Attributes

grandparent

Returns the parent Population at the root of the tree (since the immediate parent may itself be a PopulationView).

initial_values

positions

structure

The spatial structure of the parent Population.

describe(template='populationview_default.txt', engine='default')

Returns a human-readable description of the population view.

The output may be customized by specifying a different template togther with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

property grandparent

Returns the parent Population at the root of the tree (since the immediate parent may itself be a PopulationView).

The name “grandparent” is of course a little misleading, as it could be just the parent, or the great, great, great, …, grandparent.

id_to_index(id)

Given the ID(s) of cell(s) in the PopulationView, return its/their index/indices (order in the PopulationView).

>>> assert pv.id_to_index(pv[3]) == 3
index_from_parent_index(indices)

Given an index(indices) in the parent population, return the index(indices) within this view.

index_in_grandparent(indices)

Given an array of indices, return the indices in the parent population at the root of the tree.

property initial_values
property positions
property structure

The spatial structure of the parent Population.