File: examples-electrophysiology_DCC.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 (62 lines) | stat: -rw-r--r-- 1,717 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
60
61
62
.. 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-electrophysiology_DCC:

Example: DCC (electrophysiology)
================================

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

::

    from brian import *
    from brian.library.electrophysiology import *
    
    defaultclock.dt = 0.01 * ms
    
    taum = 20 * ms        # membrane time constant
    gl = 1. / (50 * Mohm)   # leak conductance
    Cm = taum * gl        # membrane capacitance
    Re = 50 * Mohm        # electrode resistance
    Ce = 0.1 * 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)
    setup = NeuronGroup(1, model=eqs)
    ampli = DCC(setup, 'v_rec', 'I', 1 * kHz)
    soma = StateMonitor(setup, 'vm', record=True)
    recording = StateMonitor(setup, 'v_rec', record=True)
    DCCrecording = StateMonitor(ampli, 'record', record=True)
    
    # No compensation
    run(50 * ms)
    ampli.command = .5 * nA
    run(100 * ms)
    ampli.command = 0 * nA
    run(50 * ms)
    
    ampli.set_frequency(2 * kHz)
    ampli.command = .5 * nA
    run(100 * ms)
    ampli.command = 0 * nA
    run(50 * ms)
    
    plot(recording.times / ms, recording[0] / mV, 'b')
    plot(DCCrecording.times / ms, DCCrecording[0] / mV, 'k')
    plot(soma.times / ms, soma[0] / mV, 'r')
    show()