File: examples-electrophysiology_voltageclamp.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (53 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download
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
.. currentmodule:: brian

.. index::
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; figure
   pair: example usage; show
   pair: example usage; NeuronGroup
   pair: example usage; Equations
   pair: example usage; StateMonitor

.. _example-electrophysiology_voltageclamp:

Example: voltageclamp (electrophysiology)
=========================================

Voltage-clamp experiment

::

    from brian import *
    from brian.library.electrophysiology import *
    
    defaultclock.dt = .01 * ms
    
    taum = 20 * ms
    gl = 20 * nS
    Cm = taum * gl
    Re = 50 * Mohm
    Ce = 0.2 * ms / Re
    N = 1
    Rs = .9 * Re
    tauc = Rs * Ce # critical tau_u
    
    eqs = Equations('''
    dvm/dt=(-gl*vm+i_inj)/Cm : volt
    ''')
    eqs += electrode(.2 * Re, Ce)
    eqs += voltage_clamp(vm='v_el', v_cmd=20 * mV, i_inj='i_cmd', i_rec='ic',
                       Re=.8 * Re, Rs=.9 * Re, tau_u=.2 * ms)
    setup = NeuronGroup(N, model=eqs)
    setup.v = 0 * mV
    recording = StateMonitor(setup, 'ic', record=True)
    soma = StateMonitor(setup, 'vm', record=True)
    
    run(200 * ms)
    figure()
    plot(recording.times / ms, recording[0] / nA, 'k')
    figure()
    plot(soma.times / ms, soma[0] / mV, 'b')
    show()