/usr/share/doc/python-brian-doc/docs/librarymodels.html is in python-brian-doc 1.3.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Library models — Brian v1.3.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '1.3.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Brian v1.3.1 documentation" href="index.html" />
<link rel="up" title="The library" href="library.html" />
<link rel="next" title="Random processes" href="randomprocesses.html" />
<link rel="prev" title="The library" href="library.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="randomprocesses.html" title="Random processes"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="library.html" title="The library"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Brian v1.3.1 documentation</a> »</li>
<li><a href="library.html" accesskey="U">The library</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="library-models">
<h1>Library models<a class="headerlink" href="#library-models" title="Permalink to this headline">¶</a></h1>
<div class="section" id="membrane-equations">
<h2>Membrane equations<a class="headerlink" href="#membrane-equations" title="Permalink to this headline">¶</a></h2>
<p>Library models are defined using the <tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt> class. This is a subclass of
<a class="reference internal" href="reference-models-and-groups.html#brian.Equations" title="brian.Equations"><tt class="xref py py-class docutils literal"><span class="pre">Equations</span></tt></a> which is defined by a capacitance C and a sum of currents. The following instruction:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">)</span>
</pre></div>
</div>
<p>defines the equation C*dvm/dt=0*amp, with the membrane capacitance C=200 pF. The name of the membrane potential
variable can be changed as follows:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">,</span><span class="n">vm</span><span class="o">=</span><span class="s">'V'</span><span class="p">)</span>
</pre></div>
</div>
<p>The main interest of this class is that one can use it to build models by adding currents to a membrane
equation. The <tt class="xref py py-class docutils literal"><span class="pre">Current</span></tt> class is a subclass of <a class="reference internal" href="reference-models-and-groups.html#brian.Equations" title="brian.Equations"><tt class="xref py py-class docutils literal"><span class="pre">Equations</span></tt></a> which defines a current to be added
to a membrane equation. For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">)</span><span class="o">+</span><span class="n">Current</span><span class="p">(</span><span class="s">'I=(V0-vm)/R : amp'</span><span class="p">,</span><span class="n">current_name</span><span class="o">=</span><span class="s">'I'</span><span class="p">)</span>
</pre></div>
</div>
<p>defines the same equation as:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">Equations</span><span class="p">(</span><span class="s">'''</span>
<span class="s">dvm/dt=I/(200*pF) : volt</span>
<span class="s">I=(V0-vm)/R : amp</span>
<span class="s">'''</span><span class="p">)</span>
</pre></div>
</div>
<p>The keyword <tt class="docutils literal"><span class="pre">current_name</span></tt> is optional if there is no ambiguity, i.e., if there is only one variable
or only one variable with amp units. As for standard equations, <tt class="xref py py-class docutils literal"><span class="pre">Current</span></tt> objects can be initialised with
a multiline string (several equations). By default, the convention for the current direction is the one for injected
current. For the ionic current convention, use the <tt class="xref py py-class docutils literal"><span class="pre">IonicCurrent</span></tt> class:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">)</span><span class="o">+</span><span class="n">IonicCurrent</span><span class="p">(</span><span class="s">'I=(vm-V0)/R : amp'</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="compartmental-modelling">
<h2>Compartmental modelling<a class="headerlink" href="#compartmental-modelling" title="Permalink to this headline">¶</a></h2>
<p>Compartmental neuron models can be created by merging several <tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt> objects,
with the <tt class="docutils literal"><span class="pre">compartments</span></tt> module. If <tt class="docutils literal"><span class="pre">soma</span></tt> and <tt class="docutils literal"><span class="pre">dendrite</span></tt> are two compartments defined as
<tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt> objects, then a neuron with those 2 compartments can be created as follows:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">neuron_eqs</span><span class="o">=</span><span class="n">Compartments</span><span class="p">({</span><span class="s">'soma'</span><span class="p">:</span><span class="n">soma</span><span class="p">,</span><span class="s">'dendrite'</span><span class="p">:</span><span class="n">dendrite</span><span class="p">})</span>
<span class="n">neuron_eqs</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">'soma'</span><span class="p">,</span><span class="s">'dendrite'</span><span class="p">,</span><span class="n">Ra</span><span class="p">)</span>
<span class="n">neuron</span><span class="o">=</span><span class="n">NeuronGroup</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">model</span><span class="o">=</span><span class="n">neuron_eqs</span><span class="p">)</span>
</pre></div>
</div>
<p>The <tt class="xref py py-class docutils literal"><span class="pre">Compartments</span></tt> object is initialised with a dictionary of <tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt> objects.
The returned object <tt class="docutils literal"><span class="pre">neuron_eqs</span></tt> is also a <tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt> object, where the name of
each compartment has been appended to variable names (with a leading underscore).
For example, <tt class="docutils literal"><span class="pre">neuron.vm_soma</span></tt> refers to variable <tt class="docutils literal"><span class="pre">vm</span></tt> of the somatic compartment.
The <tt class="docutils literal"><span class="pre">connect</span></tt> method adds a coupling current between the two named compartments, with the given
resistance <tt class="docutils literal"><span class="pre">Ra</span></tt>.</p>
</div>
<div class="section" id="integrate-and-fire-models">
<h2>Integrate-and-Fire models<a class="headerlink" href="#integrate-and-fire-models" title="Permalink to this headline">¶</a></h2>
<p>A few standard Integrate-and-Fire models are implemented in the <tt class="docutils literal"><span class="pre">IF</span></tt> library module:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">brian.library.IF</span> <span class="kn">import</span> <span class="o">*</span>
</pre></div>
</div>
<p>All these functions return <a class="reference internal" href="reference-models-and-groups.html#brian.Equations" title="brian.Equations"><tt class="xref py py-class docutils literal"><span class="pre">Equations</span></tt></a> objects (more precisely, <tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt> objects).</p>
<ul>
<li><p class="first">Leaky integrate-and-fire model (<tt class="docutils literal"><span class="pre">dvm/dt=(El-vm)/tau</span> <span class="pre">:</span> <span class="pre">volt</span></tt>):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">leaky_IF</span><span class="p">(</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">El</span><span class="o">=-</span><span class="mi">70</span><span class="o">*</span><span class="n">mV</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p class="first">Perfect integrator (<tt class="docutils literal"><span class="pre">dvm/dt=Im/tau</span> <span class="pre">:</span> <span class="pre">volt</span></tt>):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">perfect_IF</span><span class="p">(</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p class="first">Quadratic integrate-and-fire model (<tt class="docutils literal"><span class="pre">C*dvm/dt=a*(vm-EL)*(vm-VT)</span> <span class="pre">:</span> <span class="pre">volt</span></tt>):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">quadratic_IF</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">,</span><span class="n">a</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">nS</span><span class="o">/</span><span class="n">mV</span><span class="p">,</span><span class="n">EL</span><span class="o">=-</span><span class="mi">70</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">VT</span><span class="o">=-</span><span class="mi">50</span><span class="o">*</span><span class="n">mV</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p class="first">Exponential integrate-and-fire model (<tt class="docutils literal"><span class="pre">C*dvm/dt=gL*(EL-vm)+gL*DeltaT*exp((vm-VT)/DeltaT)</span> <span class="pre">:volt</span></tt>):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">exp_IF</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">,</span><span class="n">gL</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">nS</span><span class="p">,</span><span class="n">EL</span><span class="o">=-</span><span class="mi">70</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">VT</span><span class="o">=-</span><span class="mi">55</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">DeltaT</span><span class="o">=</span><span class="mi">3</span><span class="o">*</span><span class="n">mV</span><span class="p">)</span>
</pre></div>
</div>
</li>
</ul>
<p>In general, it is possible to define a neuron group with different parameter values for each neuron, by
passing strings at initialisation. For example, the following code defines leaky integrate-and-fire models
with heterogeneous resting potential values:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">leaky_IF</span><span class="p">(</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">El</span><span class="o">=</span><span class="s">'V0'</span><span class="p">)</span><span class="o">+</span><span class="n">Equations</span><span class="p">(</span><span class="s">'V0:volt'</span><span class="p">)</span>
<span class="n">group</span><span class="o">=</span><span class="n">NeuronGroup</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="n">model</span><span class="o">=</span><span class="n">eqs</span><span class="p">,</span><span class="n">reset</span><span class="o">=</span><span class="mi">0</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">threshold</span><span class="o">=</span><span class="mi">15</span><span class="o">*</span><span class="n">mV</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="two-dimensional-if-models">
<h2>Two-dimensional IF models<a class="headerlink" href="#two-dimensional-if-models" title="Permalink to this headline">¶</a></h2>
<p>Integrate-and-fire models with two variables can display a very rich set of electrophysiological behaviours.
In Brian, two such models have been implemented: Izhikevich model and Brette-Gerstner adaptive exponential
integrate-and-fire model (also included in the <tt class="docutils literal"><span class="pre">IF</span></tt> module).
The equations are obtained in the same way as for one-dimensional models:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">Izhikevich</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="mf">0.02</span><span class="o">/</span><span class="n">ms</span><span class="p">,</span><span class="n">b</span><span class="o">=</span><span class="mf">0.2</span><span class="o">/</span><span class="n">ms</span><span class="p">)</span>
<span class="n">eqs</span><span class="o">=</span><span class="n">Brette_Gerstner</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">281</span><span class="o">*</span><span class="n">pF</span><span class="p">,</span><span class="n">gL</span><span class="o">=</span><span class="mi">30</span><span class="o">*</span><span class="n">nS</span><span class="p">,</span><span class="n">EL</span><span class="o">=-</span><span class="mf">70.6</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">VT</span><span class="o">=-</span><span class="mf">50.4</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">DeltaT</span><span class="o">=</span><span class="mi">2</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">tauw</span><span class="o">=</span><span class="mi">144</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">a</span><span class="o">=</span><span class="mi">4</span><span class="o">*</span><span class="n">nS</span><span class="p">)</span>
<span class="n">eqs</span><span class="o">=</span><span class="n">aEIF</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">281</span><span class="o">*</span><span class="n">pF</span><span class="p">,</span><span class="n">gL</span><span class="o">=</span><span class="mi">30</span><span class="o">*</span><span class="n">nS</span><span class="p">,</span><span class="n">EL</span><span class="o">=-</span><span class="mf">70.6</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">VT</span><span class="o">=-</span><span class="mf">50.4</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">DeltaT</span><span class="o">=</span><span class="mi">2</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">tauw</span><span class="o">=</span><span class="mi">144</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">a</span><span class="o">=</span><span class="mi">4</span><span class="o">*</span><span class="n">nS</span><span class="p">)</span> <span class="c"># equivalent</span>
</pre></div>
</div>
<p>and two state variables are defined: <tt class="docutils literal"><span class="pre">vm</span></tt> (membrane potential) and <tt class="docutils literal"><span class="pre">w</span></tt> (adaptation variable).
The equivalent equations for Izhikevich model are:</p>
<div class="highlight-python"><pre>dvm/dt=(0.04/ms/mV)*vm**2+(5/ms)*vm+140*mV/ms-w : volt
dw/dt=a*(b*vm-w) : volt/second</pre>
</div>
<p>and for Brette-Gerstner model:</p>
<div class="highlight-python"><pre>C*dvm/dt=gL*(EL-vm)+gL*DeltaT*exp((vm-VT)/DeltaT)-w :volt
dw/dt=(a*(vm-EL)-w)/tauw : amp</pre>
</div>
<p>To simulate these models, one needs to specify a threshold value, and a good choice is
<tt class="docutils literal"><span class="pre">VT+4*DeltaT</span></tt>. The reset is particular in these models since it is bidimensional:
vm->Vr and w->w+b. A specific reset class has been implemented for this purpose:
<tt class="xref py py-class docutils literal"><span class="pre">AdaptiveReset</span></tt>, initialised with Vr and b. Thus, a typical construction of a group of
such models is:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">Brette_Gerstner</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">281</span><span class="o">*</span><span class="n">pF</span><span class="p">,</span><span class="n">gL</span><span class="o">=</span><span class="mi">30</span><span class="o">*</span><span class="n">nS</span><span class="p">,</span><span class="n">EL</span><span class="o">=-</span><span class="mf">70.6</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">VT</span><span class="o">=-</span><span class="mf">50.4</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">DeltaT</span><span class="o">=</span><span class="mi">2</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">tauw</span><span class="o">=</span><span class="mi">144</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">a</span><span class="o">=</span><span class="mi">4</span><span class="o">*</span><span class="n">nS</span><span class="p">)</span>
<span class="n">group</span><span class="o">=</span><span class="n">NeuronGroup</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="n">model</span><span class="o">=</span><span class="n">eqs</span><span class="p">,</span><span class="n">threshold</span><span class="o">=-</span><span class="mi">43</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">reset</span><span class="o">=</span><span class="n">AdaptiveReset</span><span class="p">(</span><span class="n">Vr</span><span class="o">=-</span><span class="mf">70.6</span><span class="o">*</span><span class="n">mvolt</span><span class="p">,</span><span class="n">b</span><span class="o">=</span><span class="mf">0.0805</span><span class="o">*</span><span class="n">nA</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="section" id="synapses">
<h2>Synapses<a class="headerlink" href="#synapses" title="Permalink to this headline">¶</a></h2>
<p>A few simple synaptic models are implemented in the module <tt class="docutils literal"><span class="pre">synapses</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">brian.library.synapses</span> <span class="kn">import</span> <span class="o">*</span>
</pre></div>
</div>
<p>All the following functions need to be passed the name of the variable upon which the received spikes
will act, and the name of the variable representing the current or conductance.
The simplest one is the exponential synapse:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">exp_synapse</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="s">'x'</span><span class="p">,</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">unit</span><span class="o">=</span><span class="n">amp</span><span class="p">,</span><span class="n">output</span><span class="o">=</span><span class="s">'x_current'</span><span class="p">)</span>
</pre></div>
</div>
<p>It is equivalent to:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">Equations</span><span class="p">(</span><span class="s">'''</span>
<span class="s">dx/dt=-x/tau : amp</span>
<span class="s">x_out=x</span>
<span class="s">'''</span><span class="p">)</span>
</pre></div>
</div>
<p>Here, <tt class="docutils literal"><span class="pre">x</span></tt> is the variable which receives the spikes and <tt class="docutils literal"><span class="pre">x_current</span></tt> is the variable to be inserted in
the membrane equation (since it is a one-dimensional synaptic model, the variables are the same).
If the output variable name is not defined, then it will be automatically generated by adding the
suffix <tt class="docutils literal"><span class="pre">_out</span></tt> to the input name.</p>
<p>Two other types of synapses are implemented. The alpha synapse (<tt class="docutils literal"><span class="pre">x(t)=alpha*(t/tau)*exp(1-t/tau)</span></tt>, where
<tt class="docutils literal"><span class="pre">alpha</span></tt> is a normalising factor) is defined with the same syntax by:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">alpha_synapse</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="s">'x'</span><span class="p">,</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">unit</span><span class="o">=</span><span class="n">amp</span><span class="p">)</span>
</pre></div>
</div>
<p>and the bi-exponential synapse is defined by (<tt class="docutils literal"><span class="pre">x(t)=(tau2/(tau2-tau1))*(exp(-t/tau1)-exp(-t/tau2))</span></tt>,
up to a normalising factor):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">biexp_synapse</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="s">'x'</span><span class="p">,</span><span class="n">tau1</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">tau2</span><span class="o">=</span><span class="mi">5</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">unit</span><span class="o">=</span><span class="n">amp</span><span class="p">)</span>
</pre></div>
</div>
<p>For all types of synapses, the normalising factor is such that the maximum of x(t) is 1.
These functions can be used as in the following example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">)</span><span class="o">+</span><span class="n">Current</span><span class="p">(</span><span class="s">'I=gl*(El-vm)+ge*(Ee-vm):amp'</span><span class="p">)</span>
<span class="n">eqs</span><span class="o">+=</span><span class="n">alpha_synapse</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="s">'ge_in'</span><span class="p">,</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">,</span><span class="n">unit</span><span class="o">=</span><span class="n">siemens</span><span class="p">,</span><span class="n">output</span><span class="o">=</span><span class="s">'ge'</span><span class="p">)</span>
</pre></div>
</div>
<p>where alpha conductances have been inserted in the membrane equation.</p>
<p>One can directly insert synaptic currents with the functions <tt class="docutils literal"><span class="pre">exp_current</span></tt>, <tt class="docutils literal"><span class="pre">alpha_current</span></tt>
and <tt class="docutils literal"><span class="pre">biexp_current</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">)</span><span class="o">+</span><span class="n">Current</span><span class="p">(</span><span class="s">'I=gl*(El-vm):amp'</span><span class="p">)</span><span class="o">+</span>\
<span class="n">alpha_current</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="s">'ge'</span><span class="p">,</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">)</span>
</pre></div>
</div>
<p>(the units is amp by default), or synaptic conductances with the functions <tt class="docutils literal"><span class="pre">exp_conductance</span></tt>, <tt class="docutils literal"><span class="pre">alpha_conductance</span></tt>
and <tt class="docutils literal"><span class="pre">biexp_conductance</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eqs</span><span class="o">=</span><span class="n">MembraneEquation</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="mi">200</span><span class="o">*</span><span class="n">pF</span><span class="p">)</span><span class="o">+</span><span class="n">Current</span><span class="p">(</span><span class="s">'I=gl*(El-vm):amp'</span><span class="p">)</span><span class="o">+</span>\
<span class="n">alpha_conductance</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="s">'ge'</span><span class="p">,</span><span class="n">E</span><span class="o">=</span><span class="mi">0</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">tau</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">ms</span><span class="p">)</span>
</pre></div>
</div>
<p>where <tt class="docutils literal"><span class="pre">E</span></tt> is the reversal potential.</p>
</div>
<div class="section" id="ionic-currents">
<h2>Ionic currents<a class="headerlink" href="#ionic-currents" title="Permalink to this headline">¶</a></h2>
<p>A few standard ionic currents have implemented in the module <tt class="docutils literal"><span class="pre">ionic_currents</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">brian.library.ionic_currents</span> <span class="kn">import</span> <span class="o">*</span>
</pre></div>
</div>
<p>When the current name is not specified,
a unique name is generated automatically. Models can be constructed by adding currents to a
<tt class="xref py py-class docutils literal"><span class="pre">MembraneEquation</span></tt>.</p>
<ul>
<li><p class="first">Leak current (<tt class="docutils literal"><span class="pre">gl*(El-vm)</span></tt>):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">current</span><span class="o">=</span><span class="n">leak_current</span><span class="p">(</span><span class="n">gl</span><span class="o">=</span><span class="mi">10</span><span class="o">*</span><span class="n">nS</span><span class="p">,</span><span class="n">El</span><span class="o">=-</span><span class="mi">70</span><span class="o">*</span><span class="n">mV</span><span class="p">,</span><span class="n">current_name</span><span class="o">=</span><span class="s">'I'</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p class="first">Hodgkin-Huxley K+ current:</p>
<div class="highlight-python"><pre>current=K_current_HH(gmax,EK,current_name='IK'):</pre>
</div>
</li>
<li><p class="first">Hodgkin-Huxley Na+ current:</p>
<div class="highlight-python"><pre>current=Na_current_HH(gmax,ENa,current_name='INa'):</pre>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/brian-logo.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Library models</a><ul>
<li><a class="reference internal" href="#membrane-equations">Membrane equations</a></li>
<li><a class="reference internal" href="#compartmental-modelling">Compartmental modelling</a></li>
<li><a class="reference internal" href="#integrate-and-fire-models">Integrate-and-Fire models</a></li>
<li><a class="reference internal" href="#two-dimensional-if-models">Two-dimensional IF models</a></li>
<li><a class="reference internal" href="#synapses">Synapses</a></li>
<li><a class="reference internal" href="#ionic-currents">Ionic currents</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="library.html"
title="previous chapter">The library</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="randomprocesses.html"
title="next chapter">Random processes</a></p>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="randomprocesses.html" title="Random processes"
>next</a> |</li>
<li class="right" >
<a href="library.html" title="The library"
>previous</a> |</li>
<li><a href="index.html">Brian v1.3.1 documentation</a> »</li>
<li><a href="library.html" >The library</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008, Romain Brette, Dan Goodman.
Last updated on Feb 19, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div>
</body>
</html>
|