SynapticPlacement

SynapticPlacement#

class braintools.conn.SynapticPlacement(connection_prob=0.2, compartment_preferences=None, weight=None, delay=None, allow_self_connections=False, **kwargs)#

Synapse placement by compartment preference.

Separates whether two neurons connect from where the synapse lands. Every presynaptic axon contacts every postsynaptic neuron independently with probability connection_prob (one synapse per connected pair), and each synapse is then placed on a postsynaptic compartment drawn with probability proportional to compartment_preferences.

Preferences express placement rules directly, for example {BASAL_DENDRITE: 1.0} for proximal-only input, {APICAL_DENDRITE: 1.0} for distal-only input, or {SOMA: 0.2, BASAL_DENDRITE: 0.5, APICAL_DENDRITE: 0.3} for a mixture.

Parameters:
  • connection_prob (float) – Probability that a presynaptic neuron makes a synapse onto a given postsynaptic neuron. Default 0.2.

  • compartment_preferences (Dict[int, float] | None) – Mapping from target compartment (SOMA, BASAL_DENDRITE, APICAL_DENDRITE, AXON) to a non-negative relative preference. Preferences are normalized to sum to one. Default {BASAL_DENDRITE: 0.6, APICAL_DENDRITE: 0.4}.

  • weight (Initialization | float | int | ndarray | Array | Quantity | None) – Weight initialization.

  • delay (Initialization | float | int | ndarray | Array | Quantity | None) – Delay initialization.

  • allow_self_connections (bool) – Whether a neuron may connect to itself. Default False.

Notes

Generation runs on the host with NumPy and cannot be traced by jax.jit, jax.vmap or jax.grad.

Changed in version 0.4.0: Connected pairs are sampled by drawing a binomial edge count and then that many distinct pairs, without a dense pre_size x post_size matrix, so time and memory grow with the number of edges. The edges for a given seed differ from 0.3 (same distribution).

Examples

>>> from braintools.conn import SynapticPlacement, APICAL_DENDRITE, BASAL_DENDRITE
>>> distal_input = SynapticPlacement(
...     connection_prob=0.1,
...     compartment_preferences={APICAL_DENDRITE: 0.8, BASAL_DENDRITE: 0.2},
...     seed=0,
... )
>>> result = distal_input(pre_size=100, post_size=100)
>>> result.n_connections
993
generate(pre_size, post_size, pre_positions=None, post_positions=None, **kwargs)[source]#

Generate synapse placements.

Return type:

ConnectionResult