TopographicProjection#

class braintools.conn.TopographicProjection(topographic_map, weight=None, delay=None, **kwargs)#

Topographic projection patterns.

Shorthand for AxonalProjection(topographic_map=...); positions are required.

Parameters:

Notes

topographic_map is a scalar function of one pre and one post position. It is called once per pair of distinct positions (within each chunk of presynaptic rows), so neurons at equal positions share one call; see AxonalProjection.

With topographic_map=None there is no spatial term and every pair connects with the default AxonalProjection probability (0.05).

Generation runs on the host with NumPy and cannot be traced by jax.jit, jax.vmap or jax.grad.

Changed in version 0.4.0: With topographic_map=None the pairs are sampled by the uniform path of AxonalProjection (binomial edge count, then distinct pairs), so the edges for a given seed differ from 0.3. With a map, the random draws are the same as in 0.3.

Examples

>>> import brainunit as u
>>> import numpy as np
>>> from braintools.conn import TopographicProjection
>>> grid = np.stack(np.meshgrid(np.arange(6), np.arange(6)), -1).reshape(-1, 2)
>>> positions = np.repeat(grid, 2, axis=0) * 40.0 * u.um  # two neurons per site
>>> topo = TopographicProjection(
...     topographic_map=lambda a, b: 0.8 * float(np.hypot(*(a - b)) < 50.0), seed=0
... )
>>> result = topo(pre_size=72, post_size=72,
...               pre_positions=positions, post_positions=positions)
>>> result.n_connections
443
generate(pre_size, post_size, pre_positions=None, post_positions=None, **kwargs)[source]#

Generate topographic projection connections.

Return type:

ConnectionResult