In [1]:
from brian import *
from brian.library.ionic_currents import *


/usr/lib/pymodules/python2.7/brian/utils/sparse_patch/__init__.py:36: UserWarning: Couldn't find matching sparse matrix patch for scipy version 0.10.1, but in most cases this shouldn't be a problem.
  warnings.warn("Couldn't find matching sparse matrix patch for scipy version %s, but in most cases this shouldn't be a problem." % scipy.__version__)

Parameters


In [2]:
defaultclock.dt = .01 * ms
El = 10.6 * mV
EK = -12 * mV
ENa = 120 * mV

Model


In [3]:
eqs = MembraneEquation(1 * uF) + leak_current(.3 * msiemens, El)
eqs += K_current_HH(36 * msiemens, EK) + Na_current_HH(120 * msiemens, ENa)
eqs += Current('I:amp')

neuron = NeuronGroup(1, eqs, implicit=True, freeze=True)

Monitoring


In [4]:
trace = StateMonitor(neuron, 'vm', record=True)

Simulation


In [5]:
run(100 * ms, report='text')
neuron.I = 10 * uA
run(100 * ms, report='text')
neuron.I = 1e-5 * uA
run(200 * ms, report='text')


85% complete, 10s elapsed, approximately 1s remaining.
100% complete, 11s elapsed, approximately 0s remaining.
86% complete, 10s elapsed, approximately 1s remaining.
100% complete, 11s elapsed, approximately 0s remaining.
43% complete, 10s elapsed, approximately 12s remaining.
84% complete, 20s elapsed, approximately 3s remaining.
100% complete, 23s elapsed, approximately 0s remaining.

Results


In [6]:
plot(trace.times / ms, trace[0] / mV)
show()