File: simple_case.py

package info (click to toggle)
brian 2.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,732 kB
  • sloc: python: 45,765; cpp: 1,832; ansic: 329; makefile: 113; sh: 64
file content (19 lines) | stat: -rw-r--r-- 415 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
"""
The most simple case how to use standalone mode.
"""
from brian2 import *
set_device('cpp_standalone')  # ← only difference to "normal" simulation

tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1
'''
G = NeuronGroup(10, eqs, method='exact')
G.v = 'rand()'
mon = StateMonitor(G, 'v', record=True)
run(100*ms)

plt.plot(mon.t/ms, mon.v.T)
plt.gca().set(xlabel='t (ms)', ylabel='v')
plt.show()