AxonalProjection#
- class braintools.conn.AxonalProjection(topographic_map=None, connection_prob=0.05, arborization_sigma=None, target_compartments=None, weight=None, delay=None, allow_self_connections=False, **kwargs)#
Axonal projection onto dendritic compartments.
Every presynaptic axon contacts every postsynaptic neuron independently with a pair-specific probability, and each resulting synapse is placed on one dendritic compartment drawn uniformly from
target_compartments.The pair probability is built from up to two spatial terms (positions are needed for either):
topographic_map(pre_xy, post_xy), if given, replaces the uniformconnection_prob;arborization_sigma, if given, multiplies the probability by a Gaussian fall-offexp(-d**2 / (2 * arborization_sigma**2))of the distancedbetween the two neurons, confining the axon’s arbor to a local field.
Without positions every pair uses
connection_prob.- Parameters:
topographic_map (
Callable|None) – Function(pre_xy, post_xy) -> probability. It receives one row of each position array as plain numbers in the unit ofpre_positionsand must return a value in[0, 1].connection_prob (
float) – Probability for every pair when notopographic_mapis given.arborization_sigma (
float|Quantity|None) – Width of the Gaussian arborization field. A plain number is interpreted in the unit ofpre_positions.None(default) applies no fall-off.target_compartments (
List[int] |None) – Postsynaptic dendritic compartments to target. Each connection is randomly assigned one of these. Default[BASAL_DENDRITE, APICAL_DENDRITE].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. DefaultFalse.
Notes
With a spatial term (
topographic_maporarborization_sigma) the pair probabilities are evaluated in chunks of presynaptic rows of bounded size, and the random draws are the same as in version 0.3.topographic_mapstays a scalar function of one pre and one post position; within each chunk it is called once per pair of distinct positions and the values are shared by neurons at equal positions, so repeated positions cost no extra calls. It is still a Python call per distinct pair, so its cost grows withpre_size * post_sizewhen all positions differ.Generation runs on the host with NumPy and cannot be traced by
jax.jit,jax.vmaporjax.grad.Changed in version 0.4.0: Without
topographic_mapandarborization_sigmathe pairs are sampled with a binomial edge count and distinct pairs, so the edges for a givenseeddiffer from 0.3 (same distribution).topographic_mapis called once per pair of distinct positions instead of once per neuron pair.Examples
>>> import brainunit as u >>> import numpy as np >>> from braintools.conn import AxonalProjection >>> def retinotopic_map(source_pos, target_pos): ... return 0.5 * np.exp(-np.sum((source_pos - target_pos) ** 2) / (2 * 50.0 ** 2)) >>> >>> positions = np.random.RandomState(0).uniform(0, 300, (40, 2)) * u.um >>> topographic = AxonalProjection(topographic_map=retinotopic_map, seed=0) >>> result = topographic(pre_size=40, post_size=40, ... pre_positions=positions, post_positions=positions) >>> result.n_connections 88 >>> local_arbor = AxonalProjection(connection_prob=0.3, arborization_sigma=80 * u.um, seed=0) >>> result = local_arbor(pre_size=40, post_size=40, ... pre_positions=positions, post_positions=positions) >>> result.n_connections 114