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 Mexican hat function is defined as:

f(d) = (2 / (sqrt(3*sigma) * pi^(1/4))) * (1 - (d/sigma)^2) * exp(-(d/sigma)^2/2)

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

  • amplitude (float) – Amplitude scaling factor (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