FixedProb#

class brainpy.connect.FixedProb(prob, pre_ratio=1.0, include_self=True, allow_multi_conn=False, seed=None, **kwargs)[source]#

Connect the post-synaptic neurons with fixed probability.

Parameters:
  • prob (float) – The conn probability.

  • pre_ratio (float) – The ratio of pre-synaptic neurons to connect.

  • include_self (bool) – Whether create (i, i) conn?

  • allow_multi_conn (bool) –

    Allow one pre-synaptic neuron connects to multiple post-synaptic neurons?

    New in version 2.2.3.2.

  • seed (optional, int) – Seed the random generator.

build_coo()[source]#

Build a coo sparse connection data.

Returns:

conn – A tuple denoting the (pre_ids, post_ids).

Return type:

tuple

build_csr()[source]#

Build a csr sparse connection data.

Returns:

conn – A tuple denoting the (indices, indptr).

Return type:

tuple

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:

Array