Projection#
- class braintools.conn.Projection(pre, post, connectivity, *, name=None)#
A connectivity generator bound to a presynaptic and a postsynaptic population.
- Parameters:
pre (
Population) – Source population.post (
Population) – Target population (may bepreitself for recurrent connections).connectivity (
Connectivity) – Generator called with the populations’ sizes and positions.name (
str|None) – Projection name; defaults tof"{pre.name}->{post.name}".
- Raises:
TypeError – If
pre/postare notPopulationorconnectivityis not aConnectivity.ValueError – If
connectivitywas constructed with apre_size/post_sizewhose neuron count differs from the population’s, ornameis empty.
See also
Notes
Generators cache their result per (sizes, positions). Sharing one generator instance between two projections with the same sizes therefore gives both the same edges; use one instance per projection for independent draws.
A generator’s
allow_self_connections=False(the default ofFixedProb) removes the pairs(i, i)when the two sides have the same size. Those pairs are autapses only whenpreandpostare the same population, so for a projection between two different populations the generator is built from a copy with self-connections allowed (sharing its random state); the passed generator is not modified.Examples
>>> from braintools.conn import Population, Projection, FixedInDegree >>> E = Population(80, name='E') >>> I = Population(20, name='I') >>> proj = Projection(E, I, FixedInDegree(8, seed=0)) >>> proj.name 'E->I' >>> proj.build().shape (80, 20)