MexicanHat#
- class braintools.conn.MexicanHat(sigma, max_distance=None, weight=None, delay=None, **kwargs)#
Mexican hat (Laplacian of Gaussian) connectivity pattern.
A special case of DoG with specific amplitude ratios to approximate the Laplacian of Gaussian. Creates strong lateral inhibition patterns.
- Parameters:
sigma (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Standard deviation of the Gaussian (surround sigma will be sqrt(2)*sigma).max_distance (
Array|ndarray|bool|number|bool|int|float|complex|Quantity|None) – Maximum distance for connections (default: 4*sigma).weight (
Initialization|float|int|ndarray|Array|Quantity|None) – Weight initialization.delay (
Initialization|float|int|ndarray|Array|Quantity|None) – Delay initialization.
Notes
The weight at distance
dis2 * G(d; sigma) - G(d; sqrt(2) * sigma)with unit-peak Gaussians frombraintools.init.GaussianProfile(seeDoGKernel). This is notbraintools.init.MexicanHatProfile, which is a Ricker wavelet clipped at zero.Candidate pairs are found with a k-d tree over the positions and handled in chunks of bounded size, so memory grows with the number of edges rather than with
pre_size * post_size. The edges, their order and the weights are the same as in version 0.3 (up to rounding). Generation runs on the host with NumPy and cannot be traced byjax.jit,jax.vmaporjax.grad.Examples
>>> import brainunit as u >>> import numpy as np >>> from braintools.conn import MexicanHat >>> positions = np.random.RandomState(0).uniform(0, 1000, (500, 2)) * u.um >>> mexican = MexicanHat( ... sigma=40 * u.um, ... weight=1.0 * u.nS ... ) >>> result = mexican( ... pre_size=500, post_size=500, ... pre_positions=positions, post_positions=positions ... ) >>> result.n_connections 17110