brainpy.connect module#

This module provides methods to construct connectivity between neuron groups. You can access them through brainpy.connect.XXX.

Base Class#

set_default_dtype([mat_dtype, idx_dtype])

Set the default dtype.

csr2csc(csr, post_num[, data])

Convert csr to csc.

csr2mat(csr, num_pre, num_post)

convert (indices, indptr) to a dense matrix.

mat2csr(dense)

convert a dense matrix to (indices, indptr).

ij2csr(pre_ids, post_ids, num_pre)

convert pre_ids, post_ids to (indices, indptr).

MAT_DTYPE

alias of numpy.bool_

IDX_DTYPE

alias of numpy.uint32

Connector()

Base Synaptic Connector Class.

TwoEndConnector()

Synaptic connector to build synapse connections between two neuron groups.

OneEndConnector()

Synaptic connector to build synapse connections within a population of neurons.

CONN_MAT

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

PRE_IDS

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

POST_IDS

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

PRE2POST

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

POST2PRE

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

PRE2SYN

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

POST2SYN

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

SUPPORTED_SYN_STRUCTURE

Built-in mutable sequence.

Custom Connections#

MatConn(conn_mat)

Connector built from the dense connection matrix.

IJConn(i, j)

Connector built from the pre_ids and post_ids connections.

SparseMatConn(csr_mat)

Connector built from the sparse connection matrix

Random Connections#

FixedProb(prob[, include_self, seed])

Connect the post-synaptic neurons with fixed probability.

FixedPreNum(num[, include_self, seed])

Connect the pre-synaptic neurons with fixed number for each post-synaptic neuron.

FixedPostNum(num[, include_self, seed])

Connect the post-synaptic neurons with fixed number for each pre-synaptic neuron.

GaussianProb(sigma[, encoding_values, ...])

Builds a Gaussian connectivity pattern within a population of neurons, where the connection probability decay according to the gaussian function.

SmallWorld(num_neighbor, prob[, directed, ...])

Build a Watts–Strogatz small-world graph.

ScaleFreeBA(m[, directed, seed])

Build a random graph according to the Barabási–Albert preferential attachment model.

ScaleFreeBADual(m1, m2, p[, directed, seed])

Build a random graph according to the dual Barabási–Albert preferential attachment model.

PowerLaw(m, p[, directed, seed])

Holme and Kim algorithm for growing graphs with powerlaw degree distribution and approximate average clustering.

Regular Connections#

One2One()

Connect two neuron groups one by one.

All2All([include_self])

Connect each neuron in first group to all neurons in the post-synaptic neuron groups.

GridFour([include_self])

The nearest four neighbors conn method.

GridEight([include_self])

The nearest eight neighbors conn method.

GridN([N, include_self])

The nearest (2*N+1) * (2*N+1) neighbors conn method.

one2one

Connect two neuron groups one by one.

all2all

Connect each neuron in first group to all neurons in the post-synaptic neuron groups.

grid_four

The nearest four neighbors conn method.

grid_eight

The nearest eight neighbors conn method.