File: examples-misc_current_clamp.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 (59 lines) | stat: -rw-r--r-- 1,519 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
54
55
56
57
58
59
.. currentmodule:: brian

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

.. _example-misc_current_clamp:

Example: current_clamp (misc)
=============================

An example of single-electrode current clamp recording
with bridge compensation (using the electrophysiology library).

::

    from brian import *
    from brian.library.electrophysiology import *
    
    taum = 20 * ms        # membrane time constant
    gl = 1. / (50 * Mohm)   # leak conductance
    Cm = taum * gl        # membrane capacitance
    Re = 50 * Mohm        # electrode resistance
    Ce = 0.5 * ms / Re      # electrode capacitance
    
    eqs = Equations('''
    dvm/dt=(-gl*vm+i_inj)/Cm : volt
    Rbridge:ohm # bridge resistance
    I:amp # command current
    ''')
    eqs += current_clamp(i_cmd='I', Re=Re, Ce=Ce, bridge='Rbridge')
    setup = NeuronGroup(1, model=eqs)
    soma = StateMonitor(setup, 'vm', record=True)
    recording = StateMonitor(setup, 'v_rec', record=True)
    
    # No compensation
    run(50 * ms)
    setup.I = .5 * nA
    run(100 * ms)
    setup.I = 0 * nA
    run(50 * ms)
    
    # Full compensation
    setup.Rbridge = Re
    run(50 * ms)
    setup.I = .5 * nA
    run(100 * ms)
    setup.I = 0 * nA
    run(50 * ms)
    
    plot(recording.times / ms, recording[0] / mV, 'b')
    plot(soma.times / ms, soma[0] / mV, 'r')
    show()