braintools.conn module#
Modular Connectivity System for Neural Network Generation.
This module provides a comprehensive, modular system for building connectivity patterns across different types of neural models. The system is designed with complete decoupling between model types to ensure clean, specialized implementations.
Supported Model Types:
Point Neurons: Single-compartment integrate-and-fire models
Multi-Compartment Models: Detailed morphological neuron models
Key Features:
Direct Class Access: All connectivity patterns available as classes
Biological Realism: Realistic parameters and constraints for each model type
Spatial Awareness: Position-dependent connectivity with proper units
Composable Patterns: Combine and transform connectivity patterns
Extensible Design: Easy to add custom patterns for any model type
Quick Start:
import brainunit as u
from braintools.conn import Random, ExcitatoryInhibitory, AxonToDendrite
# Point neuron random connectivity
random_conn = Random(prob=0.1)
result = random_conn(pre_size=1000, post_size=1000)
# E-I network dynamics
ei_conn = ExcitatoryInhibitory(
exc_ratio=0.8,
exc_prob=0.1,
inh_prob=0.2,
exc_weight=1.0 * u.nS,
inh_weight=-0.8 * u.nS
)
result = ei_conn(pre_size=1000, post_size=1000)
# Multi-compartment axon-to-dendrite connectivity
axon_dend = AxonToDendrite(
connection_prob=0.1,
weight_distribution='lognormal',
weight_params={'mean': 2.0 * u.nS, 'sigma': 0.5}
)
result = axon_dend(pre_size=100, post_size=100)
Point Neuron Connectivity:
import numpy as np
import brainunit as u
from braintools.conn import Random, DistanceDependent, ExcitatoryInhibitory
# Realistic synaptic connectivity with proper units
from braintools.init import LogNormal, Normal
ampa_conn = Random(
prob=0.05,
weight=LogNormal(mean=1.0 * u.nS, sigma=0.5),
delay=Normal(mean=1.5 * u.ms, std=0.3 * u.ms)
)
# Spatial connectivity
positions = np.random.uniform(0, 1000, (500, 2)) * u.um
spatial_conn = DistanceDependent(
sigma=100 * u.um,
decay='gaussian',
max_prob=0.3
)
result = spatial_conn(500, 500, positions, positions)
# E-I network with Dale's principle
ei_network = ExcitatoryInhibitory(
exc_ratio=0.8,
exc_prob=0.1,
inh_prob=0.2,
exc_weight=1.0 * u.nS,
inh_weight=-0.8 * u.nS
)
Modular connectivity system for building neural network connection patterns across different types of neural models. The system provides specialized implementations for point neurons and multi-compartment models with direct class access.
Base Classes and Results#
Core infrastructure for connectivity patterns and results.
Universal container for connectivity results across all neuron model types. |
|
Abstract base class for all connectivity patterns. |
|
Base class for point neuron connectivity patterns. |
|
Base class for multi-compartment neuron connectivity patterns. |
|
Connectivity with scaled weights or delays. |
|
Composite connectivity created by combining patterns. |
Point Neuron Connectivity#
Connectivity patterns for single-compartment point neuron models.
Basic Patterns#
Simple connectivity patterns including random and deterministic connections.
Spatial Patterns#
Distance-dependent and spatially-structured connectivity patterns.
Distance-dependent connectivity for spatially arranged point neurons. |
|
Gaussian distance-dependent connectivity for spatially organized neural networks. |
|
Exponential distance-dependent connectivity for spatially organized neural networks. |
|
Ring topology connectivity where neurons are arranged in a circular structure. |
|
Two-dimensional grid connectivity for spatially arranged neural populations. |
|
Radial patch connectivity where neurons connect within multiple localized spatial patches. |
|
Random connectivity with spatial clustering and distance-dependent connection enhancement. |
Topological Patterns#
Complex network topology patterns based on graph theory.
Watts-Strogatz small-world network topology. |
|
Barabási-Albert scale-free network with preferential attachment. |
|
Regular network where all neurons have the same degree. |
|
Modular network with intra-module and inter-module random connectivity. |
|
Modular network using Connectivity instances for both intra and inter-module patterns. |
|
Hierarchical network with multiple levels and asymmetric feedforward/feedback connections. |
|
Core-periphery network with densely connected core and sparse periphery. |
Biological Patterns#
Biologically-inspired connectivity patterns following neural principles.
Standard excitatory-inhibitory network following Dale's principle. |
Kernel-Based Connectivity#
Connectivity patterns using convolution kernels for spatial receptive fields.
Convolutional kernel connectivity for spatially arranged point neurons. |
|
Gaussian kernel connectivity for center-surround receptive fields. |
|
Gabor kernel connectivity for orientation-selective receptive fields. |
|
Difference of Gaussians (DoG) kernel for center-surround receptive fields. |
|
Mexican hat (Laplacian of Gaussian) connectivity pattern. |
|
Sobel edge detection kernel for orientation-selective connectivity. |
|
Laplacian kernel for edge detection connectivity. |
|
Custom kernel connectivity using user-defined kernel function. |
Multi-Compartment Connectivity#
Connectivity patterns for detailed multi-compartment neuron models with compartment-specific targeting.
Compartment Constants#
Predefined constants for identifying neural compartments.
int([x]) -> integer int(x, base=10) -> integer |
|
int([x]) -> integer int(x, base=10) -> integer |
|
int([x]) -> integer int(x, base=10) -> integer |
|
int([x]) -> integer int(x, base=10) -> integer |
Basic Compartment Patterns#
Fundamental patterns for compartment-specific connectivity.
General compartment-specific connectivity pattern. |
|
All-to-all compartment connectivity. |
|
Custom compartment connectivity using user-defined function. |
Anatomical Targeting Patterns#
Connectivity patterns based on anatomical organization.
Specialized connectivity from soma to dendritic compartments. |
|
Specialized connectivity from axon to soma compartments. |
|
Specialized connectivity from dendrites to soma. |
|
Specialized connectivity from axon to dendritic compartments. |
|
Dendrite-to-dendrite connectivity patterns. |
Morphology-Aware Patterns#
Patterns that utilize detailed morphological information.
Connectivity targeting proximal dendritic compartments. |
|
Connectivity targeting distal dendritic compartments. |
|
Branch-specific dendritic targeting. |
|
Distance-dependent connectivity based on detailed morphology. |
Dendritic Patterns#
Specialized patterns for dendritic targeting and integration.
Dendritic tree connectivity patterns with branch-specific targeting. |
|
Specific targeting of basal dendrites. |
|
Specific targeting of apical dendrites. |
|
Dendritic integration connectivity patterns. |
Axonal Patterns#
Patterns for axonal projection and arborization.
Axonal projection patterns with topographic organization. |
|
Axonal branching patterns. |
|
Axonal arborization patterns. |
|
Topographic projection patterns. |
Synaptic Patterns#
Patterns for synaptic placement and organization.
Synaptic placement rules. |
|
Synaptic clustering patterns. |