| 1 |
""" |
| 2 |
A pseudo MSO neuron, with two dendrites (fake geometry). |
| 3 |
There are synaptic inputs. |
| 4 |
""" |
| 5 |
from brian2 import * |
| 6 |
|
| 7 |
# Morphology |
| 8 |
morpho = Soma(30*um) |
| 9 |
morpho.L = Cylinder(diameter=1*um, length=100*um, n=50) |
| 10 |
morpho.R = Cylinder(diameter=1*um, length=100*um, n=50) |
| 11 |
|
| 12 |
# Passive channels |
| 13 |
gL = 1e-4*siemens/cm**2 |
| 14 |
EL = -70*mV |
| 15 |
Es = 0*mV |
| 16 |
eqs=''' |
| 17 |
Im = gL*(EL-v) : amp/meter**2 |
| 18 |
Is = gs*(Es-v) : amp (point current) |
| 19 |
gs : siemens |
| 20 |
''' |
| 21 |
|
| 22 |
neuron = SpatialNeuron(morphology=morpho, model=eqs, |
| 23 |
Cm=1*uF/cm**2, Ri=100*ohm*cm, method='exponential_euler') |
| 24 |
neuron.v = EL |
| 25 |
|
| 26 |
# Regular inputs |
| 27 |
stimulation = NeuronGroup(2, 'dx/dt = 300*Hz : 1', threshold='x>1', reset='x=0', |
| 28 |
method='euler') |
| 29 |
stimulation.x = [0, 0.5] # Asynchronous |
| 30 |
|
| 31 |
# Synapses |
| 32 |
taus = 1*ms |
| 33 |
w = 20*nS |
| 34 |
S = Synapses(stimulation, neuron, model='''dg/dt = -g/taus : siemens (clock-driven) |
| 35 |
gs_post = g : siemens (summed)''', |
| 36 |
on_pre='g += w', method='exact') |
| 37 |
|
| 38 |
S.connect(i=0, j=morpho.L[-1]) |
| 39 |
S.connect(i=1, j=morpho.R[-1]) |
| 40 |
|
| 41 |
# Monitors |
| 42 |
mon_soma = StateMonitor(neuron, 'v', record=[0]) |
| 43 |
mon_L = StateMonitor(neuron.L, 'v', record=True) |
| 44 |
mon_R = StateMonitor(neuron.R, 'v', |
| 45 |
record=morpho.R[-1]) |
| 46 |
|
| 47 |
run(50*ms, report='text') |
| 48 |
|
| 49 |
subplot(211) |
| 50 |
plot(mon_L.t/ms, mon_soma[0].v/mV, 'k') |
| 51 |
plot(mon_L.t/ms, mon_L[morpho.L[-1]].v/mV, 'r') |
| 52 |
plot(mon_L.t/ms, mon_R[morpho.R[-1]].v/mV, 'b') |
| 53 |
ylabel('v (mV)') |
| 54 |
subplot(212) |
| 55 |
for x in linspace(0*um, 100*um, 10, endpoint=False): |
| 56 |
plot(mon_L.t/ms, mon_L[morpho.L[x]].v/mV) |
| 57 |
xlabel('Time (ms)') |
| 58 |
ylabel('v (mV)') |
| 59 |
show() |