-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some docstrings for the exponential Euler integrator and an example
for a Hodgkin-Huxley neuron. Closes #14
- Loading branch information
Marcel Stimberg
committed
Jun 13, 2013
1 parent
4edb549
commit 16e7e7e
Showing
3 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
''' | ||
Input-Frequency curve of a HH model | ||
Network: 100 unconnected Hodgin-Huxley neurons with an input current I. | ||
The input is set differently for each neuron. | ||
This simulation should use exponential Euler integration | ||
''' | ||
from pylab import * | ||
from brian2 import * | ||
|
||
BrianLogger.log_level_info() | ||
|
||
language = PythonLanguage() | ||
#language = CPPLanguage() | ||
|
||
N = 100 | ||
|
||
# Parameters | ||
area = 20000 * umetre ** 2 | ||
Cm = (1 * ufarad * cm ** -2) * area | ||
gl = (5e-5 * siemens * cm ** -2) * area | ||
El = -65 * mV | ||
EK = -90 * mV | ||
ENa = 50 * mV | ||
g_na = (100 * msiemens * cm ** -2) * area | ||
g_kd = (30 * msiemens * cm ** -2) * area | ||
VT = -63 * mV | ||
|
||
# The model | ||
eqs = Equations(''' | ||
dv/dt = (gl*(El-v) - g_na*(m*m*m)*h*(v-ENa) - g_kd*(n*n*n*n)*(v-EK) + I)/Cm : volt | ||
dm/dt = 0.32*(mV**-1)*(13.*mV-v+VT)/ | ||
(exp((13.*mV-v+VT)/(4.*mV))-1.)/ms*(1-m)-0.28*(mV**-1)*(v-VT-40.*mV)/ | ||
(exp((v-VT-40.*mV)/(5.*mV))-1.)/ms*m : 1 | ||
dn/dt = 0.032*(mV**-1)*(15.*mV-v+VT)/ | ||
(exp((15.*mV-v+VT)/(5.*mV))-1.)/ms*(1.-n)-.5*exp((10.*mV-v+VT)/(40.*mV))/ms*n : 1 | ||
dh/dt = 0.128*exp((17.*mV-v+VT)/(18.*mV))/ms*(1.-h)-4./(1+exp((40.*mV-v+VT)/(5.*mV)))/ms*h : 1 | ||
I : amp | ||
''') | ||
# Threshold and refractoriness are only used for spike counting | ||
group = NeuronGroup(N, equations=eqs, threshold='is_active * (v > -40*mV)', | ||
language=language) | ||
group.refractory = 1*ms | ||
group.v = El | ||
group.I = linspace(0 * nA, 0.7 * nA, N) | ||
|
||
monitor = SpikeMonitor(group) | ||
|
||
duration = 2 * second | ||
run(duration) | ||
plot(group.I / nA, monitor.count / duration) | ||
show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters