LaplacianKernel

LaplacianKernel#

class braintools.conn.LaplacianKernel(kernel_type='4-connected', kernel_size=1.0, allow_self_connections=False, weight=None, delay=None, **kwargs)#

Laplacian kernel for edge detection connectivity.

Implements Laplacian operators for detecting discontinuities and edges, useful for lateral inhibition and edge enhancement.

The Laplacian kernel has an essential negative centre coefficient (-4 or -8); connections are selected on coefficient magnitude so that centre weight is retained.

Parameters:
  • kernel_type (str) – Type of Laplacian (‘4-connected’, ‘8-connected’).

  • kernel_size (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Physical size of the kernel in position units.

  • allow_self_connections (bool) – Whether a neuron may connect to itself when pre and post are the same population (default: False). The Laplacian centre coefficient maps onto the self-connection, so enabling this retains the centre weight on the diagonal.

  • weight (Initialization | float | int | ndarray | Array | Quantity | None) – Weight initialization (Laplacian values are multiplied by this).

  • delay (Initialization | float | int | ndarray | Array | Quantity | None) – Delay initialization.

Examples

>>> positions = np.random.uniform(0, 1000, (500, 2)) * u.um
>>> laplacian = LaplacianKernel(
...     kernel_type='4-connected',
...     kernel_size=60 * u.um,
...     weight=1.0 * u.nS
... )
>>> result = laplacian(
...     pre_size=500, post_size=500,
...     pre_positions=positions, post_positions=positions
... )
generate(**kwargs)[source]#

Generate Laplacian kernel connections.

Return type:

ConnectionResult