Indexing class

(Shortest import: from brian2.groups.group import Indexing)

class brian2.groups.group.Indexing(group, default_index='_idx')[source]

Bases: object

Object responsible for calculating flat index arrays from arbitrary group- specific indices. Stores strong references to the necessary variables so that basic indexing (i.e. slicing, integer arrays/values, ...) works even when the respective Group no longer exists. Note that this object does not handle string indexing.

Methods

__call__([item, index_var]) Return flat indices to index into state variables from arbitrary group specific indices.

Details

__call__(item=None, index_var=None)[source]

Return flat indices to index into state variables from arbitrary group specific indices. In the default implementation, raises an error for multidimensional indices and transforms slices into arrays.

Parameters:

item : slice, array, int

The indices to translate.

Returns:

indices : numpy.ndarray

The flat indices corresponding to the indices given in item.

See also

SynapticIndexing