.. currentmodule:: brian2 .. synapses: Example: synapses ================= .. only:: html .. |launchbinder| image:: http://mybinder.org/badge.svg .. _launchbinder: https://mybinder.org/v2/gh/brian-team/brian2-binder/master?filepath=examples/synapses/synapses.ipynb .. note:: You can launch an interactive, editable version of this example without installing any local files using the Binder service (although note that at some times this may be slow or fail to open): |launchbinder|_ A simple example of using `Synapses`. :: from brian2 import * G1 = NeuronGroup(10, 'dv/dt = -v / (10*ms) : 1', threshold='v > 1', reset='v=0.', method='exact') G1.v = 1.2 G2 = NeuronGroup(10, 'dv/dt = -v / (10*ms) : 1', threshold='v > 1', reset='v=0', method='exact') syn = Synapses(G1, G2, 'dw/dt = -w / (50*ms): 1 (event-driven)', on_pre='v += w') syn.connect('i == j', p=0.75) # Set the delays syn.delay = '1*ms + i*ms + 0.25*ms * randn()' # Set the initial values of the synaptic variable syn.w = 1 mon = StateMonitor(G2, 'v', record=True) run(20*ms) plot(mon.t/ms, mon.v.T) xlabel('Time (ms)') ylabel('v') show() .. image:: ../resources/examples_images/synapses.synapses.1.png