TwoEndConnector#
- class brainpy.connect.TwoEndConnector(pre=None, post=None)[source]#
Synaptic connector to build connections between two neuron groups.
If users want to customize their Connector, there are two ways:
Implementing
build_conn(self)
function, which returns one of the connection datacsr
(CSR sparse data, a tuple of <post_ids, inptr>),coo
(COO sparse data, a tuple of <pre_ids, post_ids>), ormat
(a binary connection matrix). For instance,import brainpy as bp class MyConnector(bp.conn.TwoEndConnector): def build_conn(self): return dict(csr=, mat=, coo=)
Implementing functions
build_mat()
,build_csr()
, andbuild_coo()
. Users can provide all three functions, or one of them.import brainpy as bp class MyConnector(bp.conn.TwoEndConnector): def build_mat(self, ): return conn_matrix def build_csr(self, ): return post_ids, inptr def build_coo(self, ): return pre_ids, post_ids
- build_conn()[source]#
build connections with certain data type.
If users want to customize their connections, please provide one of the following functions:
build_mat()
: build a matrix binary connection matrix.build_csr()
: build a csr sparse connection data.build_coo()
: build a coo sparse connection data.build_conn()
: deprecated.
- build_coo()[source]#
Build a coo sparse connection data.
- Returns:
conn – A tuple denoting the
(pre_ids, post_ids)
.- Return type:
- build_csr()[source]#
Build a csr sparse connection data.
- Returns:
conn – A tuple denoting the
(indices, indptr)
.- Return type:
- build_mat()[source]#
Build a binary matrix connection data.
If users want to customize their connections, please provide one of the following functions:
build_mat()
: build a matrix binary connection matrix.build_csr()
: build a csr sparse connection data.build_coo()
: build a coo sparse connection data.build_conn()
: deprecated.
- Returns:
conn – A binary matrix with the shape
(num_pre, num_post)
.- Return type: