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.

mat2coo(dense)

mat2csc(dense)

mat2csr(dense)

convert a dense matrix to (indices, indptr).

csr2csc(csr, post_num[, data])

Convert csr to csc.

csr2mat(csr, num_pre, num_post)

convert (indices, indptr) to a dense matrix.

csr2coo(csr)

coo2csr(coo, num_pre)

convert pre_ids, post_ids to (indices, indptr) when'jax_platform_name' = 'gpu'

coo2csc(coo, post_num[, data])

Convert csr to csc.

coo2mat(ij, num_pre, num_post)

convert (indices, indptr) to a dense matrix.

MAT_DTYPE

alias of jax.numpy.bool_

IDX_DTYPE

alias of jax.numpy.uint32

Connector()

Base Synaptic Connector Class.

TwoEndConnector()

Synaptic connector to build 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.

CSRConn(indices, inptr)

Connector built from the CSR sparse connection matrix.

SparseMatConn(csr_mat)

Connector built from the sparse connection matrix

Random Connections#

FixedProb(prob[, pre_ratio, include_self, ...])

Connect the post-synaptic neurons with fixed probability.

FixedPreNum(num[, include_self, ...])

Connect a fixed number pf pre-synaptic neurons for each post-synaptic neuron.

FixedPostNum(num[, include_self, ...])

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

FixedTotalNum(num[, seed])

Connect the synaptic neurons with fixed total number.

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

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

ProbDist([dist, prob, pre_ratio, seed, ...])

Connection with a maximum distance under a probability p.

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, periodic_boundary])

The nearest four neighbors connection method.

GridEight([include_self, periodic_boundary])

The nearest eight neighbors conn method.

GridN([N, include_self, periodic_boundary])

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 connection method.

grid_eight

The nearest eight neighbors conn method.