MexicanHatProfile#

class braintools.init.MexicanHatProfile(sigma, amplitude=1.0, max_distance=None)#

Mexican Hat (Ricker wavelet) distance profile.

Connection probability follows a Mexican hat shape, which is the second derivative of a Gaussian function. This creates a center-surround pattern with positive values at the center, negative values in the surround, and approaching zero at far distances. The negative values are clipped to zero for probability interpretation.

The (peak-normalized) Mexican hat function used here is:

f(d) = amplitude * (1 - (d/sigma)^2) * exp(-(d/sigma)^2 / 2)

This form peaks at amplitude when d = 0 and is invariant to the unit in which sigma/distances are expressed (it depends only on the dimensionless ratio d/sigma). The classical wavelet L2-normalization constant 2 / (sqrt(3*sigma) * pi^(1/4)) is intentionally dropped because it is unit-dependent and would make the peak height vary with the chosen length unit.

Parameters:
  • sigma (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Standard deviation controlling the width of the profile.

  • amplitude (float) – Amplitude scaling factor; equals the peak value at d = 0 (default: 1.0).

  • max_distance (Array | ndarray | bool | number | bool | int | float | complex | Quantity | None) – Maximum connection distance (connections beyond this are set to 0).

Examples

>>> import numpy as np
>>> import brainunit as u
>>> from braintools.init import MexicanHatProfile
>>>
>>> profile = MexicanHatProfile(
...     sigma=50.0 * u.um,
...     amplitude=1.0,
...     max_distance=300.0 * u.um
... )
>>> distances = np.array([0, 25, 50, 100, 200]) * u.um
>>> probs = profile.probability(distances)
probability(distances)[source]#

Calculate connection probability based on distance.

Parameters:

distances (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Array of distances between neuron pairs.

Returns:

probability – Connection probabilities (values between 0 and 1).

Return type:

ndarray