SpatialConnRule#

class brainpy.state.spatial.SpatialConnRule(p, mask=None, allow_autapses=True, _pre_pos=None, _post_pos=None)#

Spatially-resolved pairwise-Bernoulli rule: p(d) within an optional mask.

Each ordered (pre, post) pair is connected independently with probability mask(d) * p(d), where d is their Euclidean distance. Constructed unbound; Simulator.connect() binds sliced (n_pre, d) / (n_post, d) positions.

Parameters:
  • p (callable or float) – A distance kernel p(d) (e.g. gaussian()) or a constant probability.

  • mask (object, optional) – A mask with contains(pre_pos, post_pos) -> bool (n_pre, n_post) (hard cutoff).

  • allow_autapses (bool, optional) – Rule-level self-connection switch (ANDed with the connect-level flag).

with_coords(pre_pos, post_pos)[source]#

Return a bound clone carrying sliced (n_pre, d) / (n_post, d) positions.