This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
/
examples-electrophysiology_AEC.txt
77 lines (64 loc) · 1.8 KB
/
examples-electrophysiology_AEC.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
.. currentmodule:: brian
.. index::
pair: example usage; plot
pair: example usage; run
pair: example usage; figure
pair: example usage; show
pair: example usage; sum
pair: example usage; Clock
pair: example usage; NeuronGroup
pair: example usage; Equations
pair: example usage; StateMonitor
.. _example-electrophysiology_AEC:
Example: AEC (electrophysiology)
================================
AEC experiment (current-clamp)
::
from brian import *
from brian.library.electrophysiology import *
from time import time
myclock = Clock(dt=.1 * ms)
clock_rec = Clock(dt=.1 * ms)
#log_level_debug()
taum = 20 * ms
gl = 20 * nS
Cm = taum * gl
Re = 50 * Mohm
Ce = 0.1 * ms / Re
eqs = Equations('''
dvm/dt=(-gl*vm+i_inj)/Cm : volt
I:amp
''')
eqs += electrode(.6 * Re, Ce)
eqs += current_clamp(vm='v_el', i_inj='i_cmd', i_cmd='I', Re=.4 * Re, Ce=Ce)
setup = NeuronGroup(1, model=eqs, clock=myclock)
board = AEC(setup, 'v_rec', 'I', clock_rec)
recording = StateMonitor(board, 'record', record=True, clock=myclock)
soma = StateMonitor(setup, 'vm', record=True, clock=myclock)
run(50 * ms)
board.command = .5 * nA
run(200 * ms)
board.command = 0 * nA
run(150 * ms)
board.start_injection()
t1 = time()
run(1 * second)
t2 = time()
print 'Duration:', t2 - t1, 's'
board.stop_injection()
run(100 * ms)
board.estimate()
print 'Re=', sum(board.Ke) * ohm
board.switch_on()
run(50 * ms)
board.command = .5 * nA
run(200 * ms)
board.command = 0 * nA
run(150 * ms)
board.switch_off()
figure()
plot(recording.times / ms, recording[0] / mV, 'b')
plot(soma.times / ms, soma[0] / mV, 'r')
figure()
plot(board.Ke)
show()