Created
March 3, 2015 21:59
-
-
Save lebedov/69635f74ac2c7e0cfe9d to your computer and use it in GitHub Desktop.
Morris-Lecar neurons connected by a conductance-based synapse.
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Morris-Lecar neurons connected by a conductance-based synapse. | |
""" | |
import numpy as np | |
import matplotlib | |
matplotlib.use('agg') | |
from brian import * | |
# Parameters from Rinzel & Ermentrout: Analysis of Neural Excitability and | |
# Oscillations, ch.7 (pp. 251-292) in | |
# Methods in Neural Modeling: From Ions to Networks, 2nd Ed., 1998. | |
C = 20.0*uF | |
VL = -60.0*mV | |
VCa = 120.0*mV | |
VK = -84.0*mV | |
gCa = 4.4*msiemens | |
gK = 8.0*msiemens | |
gL = 2.0*msiemens | |
V1 = -1.2*mV | |
V2 = 18.0*mV | |
V3 = 2.0*mV | |
V4 = 30.0*mV | |
phi = 0.04/ms | |
n_model = Equations(""" | |
dV/dt=(I-gL*(V-VL)-gCa*Minf*(V-VCa)-gK*N*(V-VK))/C : volt | |
dN/dt=(Ninf-N)*TauN : 1 | |
Minf=(1+tanh((V-V1)/V2))/2.0 : 1 | |
Ninf=(1+tanh((V-V3)/V4))/2.0 : 1 | |
TauN=phi*cosh((V-V3)/(2*V4)) : 1/second | |
I : amp | |
""") | |
s_model = SynapticEquations(""" | |
gS : siemens | |
I = gS*(V_pre-V_post) : amp | |
""") | |
N = 2 | |
dt = 0.1*ms | |
clock = Clock(dt=dt) | |
g = NeuronGroup(N, model=n_model, clock=clock) | |
s = Synapses(g, model=s_model, clock=clock) | |
# Define connection between first and second neuron: | |
s[0, 1] = True | |
# Initialize conductance: | |
s.gS = 0.5*msiemens | |
# Link I parameters in neuron and synapse models: | |
g.I = s.I | |
# Initial state values: | |
g.V = -10.0*mV | |
g.N = (1+tanh((g.V-V3)/V4))/2.0 | |
# Set constant input current for first neuron: | |
dur = 300*ms | |
g[0].I = TimedArray(np.ones(int(dur/dt))*200*uamp, dt=dt) | |
# Execute model: | |
state_mon = MultiStateMonitor(g, record=True) | |
run(dur) | |
# Visualize results | |
subplot(211) | |
plot(state_mon['V'].times/ms, state_mon['V'][0]/mV) | |
xlabel('t (ms)') | |
ylabel('V (mV)') | |
title('Membrane Potential (neuron 0)') | |
subplot(212) | |
plot(state_mon['V'].times/ms, state_mon['V'][1]/mV) | |
xlabel('t (ms)') | |
ylabel('V (mV)') | |
title('Membrane Potential (neuron 1)') | |
tight_layout() | |
savefig('ml_syn.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment