Exponential#
- class braintools.conn.Exponential(distance_profile, weight=None, delay=None, **kwargs)#
Exponential distance-dependent connectivity for spatially organized neural networks.
This specialized connectivity class creates connections where the probability follows an exponential decay as a function of distance between neurons. This pattern is characteristic of many biological neural systems where connection probability drops off smoothly with distance, such as in hippocampal networks and certain cortical projections.
The connection probability follows:
\[P(d) = \exp\left(-\frac{d}{\lambda}\right) \quad \text{for } d \leq d_{\text{max}}\]where:
\(d\) is the distance between neurons
\(\lambda\) is the spatial scale (decay length constant)
\(d_{\text{max}}\) is the maximum connection distance
- Parameters:
distance_profile (
ExponentialProfile) –An exponential distance profile that defines the spatial connection probability decay. Must be an instance of
braintools.init.ExponentialProfilewith:scale: Characteristic decay length (λ) - larger values create longer-range connectionsmax_distance: Maximum distance for connections (optional)normalize: Whether to normalize to unit maximum (optional)
weight (
Initialization|float|int|ndarray|Array|Quantity|None) –Initializer for synaptic weights. Supports:
Constant values (e.g.,
2.0 * u.nS)Stochastic initializers (e.g.,
Normal,Uniform,LogNormal)Distance-dependent weight distributions
Nonefor unweighted connections
delay (
Initialization|float|int|ndarray|Array|Quantity|None) –Initializer for synaptic transmission delays. Supports:
Constant values (e.g.,
1.5 * u.ms)Stochastic delay distributions
Distance-proportional delays
Nonefor connections without explicit delays
**kwargs –
Additional arguments passed to
DistanceDependent, such as:seed: Random seed for reproducible connection patterns
- Returns:
Connection result containing pre/post indices, weights, delays, and metadata about the exponential connectivity pattern.
- Return type:
- Raises:
TypeError – If
distance_profileis not an instance ofExponentialProfile.ValueError – If neuron positions are not provided when generating connections.
Notes
The
scaleparameter (λ) determines how quickly connection probability decays:At distance λ, probability is reduced to ~37% (1/e) of the maximum
Smaller scale values create more localized connectivity
Larger scale values allow longer-range connections
Exponential decay is generally slower than Gaussian decay at intermediate distances but faster at very short distances, making it suitable for modeling projections with moderate spatial extent
Setting
max_distanceimproves computational efficiency by limiting the maximum connection rangeUnlike Gaussian profiles, exponential profiles have no inflection point and decay monotonically
Connection generation is stochastic and requires a fixed seed for reproducibility
See also
GaussianGaussian distance-dependent connectivity
DistanceDependentGeneral distance-dependent connectivity base class
braintools.init.ExponentialProfileExponential distance profile implementation
Examples
Basic exponential connectivity:
>>> import brainunit as u >>> import numpy as np >>> from braintools.conn import Exponential >>> from braintools.init import ExponentialProfile, Constant >>> >>> # Create random 2D positions >>> positions = np.random.uniform(0, 1000, (300, 2)) * u.um >>> >>> # Exponential connectivity with scale=150um >>> conn = Exponential( ... distance_profile=ExponentialProfile( ... scale=150 * u.um, ... max_distance=500 * u.um ... ), ... weight=Constant(1.5 * u.nS), ... delay=Constant(1.0 * u.ms) ... ) >>> >>> result = conn( ... pre_size=300, ... post_size=300, ... pre_positions=positions, ... post_positions=positions ... )
Short-range exponential connectivity:
>>> # Rapid decay for highly local connections >>> local_conn = Exponential( ... distance_profile=ExponentialProfile( ... scale=75 * u.um, # Short decay length ... max_distance=225 * u.um ... ), ... weight=Constant(2.5 * u.nS) ... )
Long-range connections with variable weights:
>>> from braintools.init import Normal >>> >>> # Longer-range connectivity with stochastic weights >>> long_range_conn = Exponential( ... distance_profile=ExponentialProfile( ... scale=300 * u.um, # Long decay length ... max_distance=900 * u.um ... ), ... weight=Normal(mean=1.0*u.nS, std=0.2*u.nS), ... seed=42 ... )
Distance-dependent delays:
>>> from braintools.init import DistanceModulated as DDDelay, LogNormal >>> >>> # Model conduction delays proportional to distance >>> conn_with_delays = Exponential( ... distance_profile=ExponentialProfile( ... scale=200 * u.um, ... max_distance=600 * u.um ... ), ... weight=Constant(1.0 * u.nS), ... delay=DDDelay(lambda d: (0.5 * u.ms) + d / (300 * u.um/u.ms)) ... )
Modeling hippocampal connectivity:
>>> # Exponential connectivity pattern typical of hippocampal networks >>> positions_1d = np.linspace(0, 2000, 200).reshape(-1, 1) * u.um >>> >>> hippo_conn = Exponential( ... distance_profile=ExponentialProfile( ... scale=250 * u.um, # Moderate spatial extent ... max_distance=1000 * u.um ... ), ... weight=LogNormal(mean=1.5*u.nS, sigma=0.4), ... delay=Normal(mean=2.0*u.ms, std=0.3*u.ms) ... ) >>> >>> result = hippo_conn( ... pre_size=200, ... post_size=200, ... pre_positions=positions_1d, ... post_positions=positions_1d ... )