Download Example - Read the Docs
Transcript
Brian Documentation, Release 1.4.1 where N is the number of neurons in the group, and spiketimes is a list of pairs (i,t) indicating that neuron i should fire at time t. In fact, spiketimes can be any ‘iterable container’ or ‘generator’, but we don’t cover that here (see the detailed documentation for SpikeGeneratorGroup). In our case, we want to create a group with two neurons, the first of which (neuron 0) fires at times 1 ms and 4 ms, and the second of which (neuron 1) fires at times 2 ms and 3 ms. The list of spiketimes then is: spiketimes = [(0, 1 * ms), (0, 4 * ms), (1, 2 * ms), (1, 3 * ms)] and we create the group as follows: G1 = SpikeGeneratorGroup(2, spiketimes) Now we create a second group, with one neuron, according to the model we defined earlier. G2 = NeuronGroup(N=1, model=eqs, threshold=Vt, reset=Vr) Connections In Brian, a Connection from one NeuronGroup to another is defined by writing: C = Connection(G,H,state) Here G is the source group, H is the target group, and state is the name of the target state variable. When a neuron i in G fires, Brian finds all the neurons j in H that i in G is connected to, and adds the amount C[i,j] to the specified state variable of neuron j in H. Here C[i,j] is the (i,j)th entry of the connection matrix of C (which is initially all zero). To start with, we create two connections from the group of two directly controlled neurons to the group of one neuron with the differential equations. The first connection has the target state Va and the second has the target state Vb. C1 = Connection(G1, G2, 'Va') C2 = Connection(G1, G2, 'Vb') So far, this only declares our intention to connect neurons in group G1 to neurons in group G2, because the connection matrix is initially all zeros. Now, with connection C1 we connect neuron 0 in group G1 to neuron 0 in group G2, with weight 3 mV. This means that when neuron 0 in group G1 fires, the state variable Va of the neuron in group G2 will be increased by 6 mV. Then we use connection C2 to connection neuron 1 in group G1 to neuron 0 in group G2, this time with weight 3 mV. C1[0, 0] = 6 * mV C2[1, 0] = 3 * mV The net effect of this is that when neuron 0 of G1 fires, Va for the neuron in G2 will increase 6 mV, and when neuron 1 of G1 fires, Vb for the neuron in G2 will increase 3 mV. Now we set up monitors to record the activity of the network, run it and plot it. Ma = StateMonitor(G2, 'Va', record=True) Mb = StateMonitor(G2, 'Vb', record=True) run(10 * ms) plot(Ma.times, Ma[0]) plot(Mb.times, Mb[0]) show() 20 Chapter 3. Getting started