1 Population - LIF Network


In [1]:
from brian import *

# Set the parameters from the specified file first
from utils import set_model_ps
PSFILE = 'paramsets/std_beta.py'
set_model_ps(PSFILE)

import model
from model.network_input import NetworkInput
from model.mitral_cells import MitralCells
from model.synapse import Synapse
from model.granule_cells import GranuleCells

import numpy as np

In [2]:
clear(erase=True, all=True)
defaultclock.reinit()

Parameters


In [3]:
psmt = model.PARAMETERS['Mitral']
psgr = model.PARAMETERS['Granule']
pscommon = model.PARAMETERS['Common']

print model.PARAMETERS

N_mitral = pscommon['N_mitral']
N_glomerule = N_granule = N_mitral_subpop = pscommon['N_subpop']


{'Mitral': {'V_t': -62.0 * mvolt, 'V_r': -74.0 * mvolt, 't_refract': 0.2 * msecond, 'C_m': 0.08 * metre ** -4 * kilogram ** -1 * second ** 4 * amp ** 2, 'g_L': 0.87 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2, 'E_L': -64.5 * mvolt}, 'Synapse': {'V_E': 0.0 * volt, 'sigma_I': 0.4 * mvolt, 'beta_E': 0.333333333333 * khertz, 'beta_I': 0.1 * khertz, 'V_I': -80.0 * mvolt, 'sigma_E': 10.0 * uvolt, 'V_act_I': -66.4 * mvolt, 'alpha_E': 10.0 * khertz, 'V_act_E': 0.0 * volt, 'alpha_I': 5.0 * khertz, 'g_I': 10.0 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2, 'g_E': 3.5 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2}, 'Granule': {'g_L': 0.83 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2, 'g_SD': 1.0 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2, 'C_m': 0.01 * metre ** -4 * kilogram ** -1 * second ** 4 * amp ** 2, 'g_DS': 300.0 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2, 'E_L': -70.0 * mvolt}, 'Common': {'inter_conn': {0: {1: 0.0}, 1: {0: 0.0}}, 'simu_length': 2.0 * second, 'N_mitral': 10, 'N_subpop': 2, 'simu_dt': 50.0 * usecond}, 'Input': {'tau_Ein': 6.0 * msecond, 'sigma_Ein': 0.05 * metre ** -4.0 * kilogram ** -1.0 * second ** 2.5 * amp ** 2.0, 'g_Ein0': 2.4 * metre ** -4 * kilogram ** -1 * second ** 3 * amp ** 2}, 'Glomerule': {'A': 0.1 * metre ** -4.0 * kilogram ** -1.0 * second ** 2.5 * amp ** 2.0, 'tau': 3.0 * msecond, 'C': 1, 'B': 10.0 * metre ** -4 * kilogram ** -1 * second ** 2 * amp ** 2, 'f': 2.0 * hertz}}

Simulation timestep, always set before any NeuronGroup creation, bugs otherwise.


In [4]:
defaultclock.dt = pscommon['simu_dt']
t_simu          = pscommon['simu_length']

Network Input

Create and initialize it


In [5]:
netin = NetworkInput()
netin.set_eqs_model()
netin.get_eqs_model()


Out[5]:
dg_Ein/dt = (g_Ein0 - g_Ein)/tau_Ein + sigma_Ein * xi [diffeq]
I_input = g_Ein*(V - 0*mvolt) [eq]

Synapses

Excitatory synapse (mitral --> granule)


In [6]:
synexc = Synapse(synapse_type='exc')
synexc.set_eqs_model()
synexc.get_eqs_model()


Out[6]:
ds/dt = alpha_E * (1 - s) * T - beta_E * s [diffeq]
dT/dt = 0*1/second [diffeq]
ds_syn/dt = 0*1/second [diffeq]
I_syn = g_I * s_syn * (V - V_I) [eq]

Inhibitory synapse (granule --> mitral)


In [7]:
syninhib = Synapse(synapse_type='inhib')
syninhib.set_eqs_model()
syninhib.get_eqs_model()


Out[7]:
ds/dt = alpha_I * (1 - s) * T - beta_I * s [diffeq]
ds_syn/dt = 0*1/second [diffeq]
I_syn = N_subpop*g_E * s_syn * (V_D - V_E) [eq]
T = 1/(1 + exp(-1*(V_D - V_act_I)/sigma_I)) [eq]

Mitral Cells

Create the mitral cells


In [8]:
mt = MitralCells()

Initialize it with the default equation model and input and synaptic currents


In [9]:
mt_supp_eqs = {'var': ['-I_input', '-I_syn'],
               'eqs': [netin.get_eqs_model(), synexc.get_eqs_model()]}
mt.add_eqs(supp_eqs=mt_supp_eqs)
print mt.eqs_model


dV/dt = (-g_L*(V - E_L) -I_input -I_syn)/C_m [diffeq]
ds/dt = alpha_E * (1 - s) * T - beta_E * s [diffeq]
dg_Ein/dt = (g_Ein0 - g_Ein)/tau_Ein + sigma_Ein * xi [diffeq]
dT/dt = 0*1/second [diffeq]
ds_syn/dt = 0*1/second [diffeq]
I_input = g_Ein*(V - 0*mvolt) [eq]
I_syn = g_I * s_syn * (V - V_I) [eq]

Create the NeuronGroup of mitral cells and initialize their membrane potential


In [10]:
mt.make_pop(N_mitral)
mt.pop.V = (psmt['E_L'] - psmt['V_r'])*np.random.random_sample(np.shape(mt.pop.V)) + psmt['V_r']

Granule Cells

Create the granule cells


In [11]:
gr = GranuleCells()

Add the equation model with the synaptic current


In [12]:
gr_supp_eqs = {'var': ['-I_syn'],
               'eqs': [syninhib.get_eqs_model()]}
gr.add_eqs(supp_eqs=gr_supp_eqs)
print gr.eqs_model


dV_D/dt = (-g_L*(V_D - E_L) + g_DS*(V_S - V_D) -I_syn)/C_m [diffeq]
ds/dt = alpha_I * (1 - s) * T - beta_I * s [diffeq]
ds_syn/dt = 0*1/second [diffeq]
dV_S/dt = (-g_L*(V_S - E_L) + g_SD*(V_D - V_S))/C_m [diffeq]
T = 1/(1 + exp(-1*(V_D - V_act_I)/sigma_I)) [eq]
I_syn = N_subpop*g_E * s_syn * (V_D - V_E) [eq]

Create the NeuronGroup of granule cells and initialize their membrane potential


In [13]:
gr.make_pop(N_granule)
gr.pop.V_D = psgr['E_L']
gr.pop.V_S = psgr['E_L']

Connecting mitral and granule cells

Setting the connections between mitral and granule cells


In [14]:
connections = ones((N_mitral,N_granule))
@network_operation(when='start')
def graded_synapse():
    #connections
    mt.pop.state('T')[:]=0.
    mt.pop.state('T')[mt.pop.get_refractory_indices()]=1.
    gr.pop.s_syn = dot(mt.pop.s, connections)
    mt.pop.s_syn = dot(gr.pop.s, transpose(connections))

@network_operation(when='after_groups')
def keep_reset():
    mt.pop.state('V')[mt.pop.get_refractory_indices()] = psmt['V_r']

Simulation

Setting the monitors


In [15]:
monit_mitral = {}
monit_granule = {}
rec_mitral = [0, N_mitral/2, N_mitral-1]
for pname in ('s', 's_syn', 'V', 'T', 'g_Ein'):
    monit_mitral[pname] = StateMonitor(mt.pop, pname, record=rec_mitral)
for pname in ('V_D', 's_syn', 's', 'T'):
    monit_granule[pname] = StateMonitor(gr.pop, pname, record=True)
monit_mitral['spikes'] = SpikeMonitor(mt.pop, record=True)

Creating and running the network


In [16]:
nn = Network(mt.pop, gr.pop, [mgr for mgr in monit_granule.values()], [mmt for mmt in monit_mitral.values()],
             graded_synapse, keep_reset)
nn.run(t_simu, report='text')


15% complete, 10s elapsed, approximately 55s remaining.
30% complete, 20s elapsed, approximately 46s remaining.
45% complete, 30s elapsed, approximately 36s remaining.
59% complete, 40s elapsed, approximately 26s remaining.
74% complete, 50s elapsed, approximately 17s remaining.
88% complete, 1m 0s elapsed, approximately 7s remaining.
100% complete, 1m 7s elapsed, approximately 0s remaining.

Results

Granule membrane potential over time


In [17]:
figure()
plot(monit_granule['V_D'].times/msecond, monit_granule['V_D'][0]/mvolt)
xlabel('time (ms)')
ylabel('membrane potential of granule : V_D (mvolt)')


Out[17]:
<matplotlib.text.Text at 0x779b250>

Mitral membrane potential over time


In [18]:
figure()
for n in rec_mitral:
    plot(monit_mitral['V'].times / msecond, monit_mitral['V'][n]/mvolt, label="mitral #"+str(n))
legend()
xlabel('time (ms)')
ylabel('membrane potential of mitral : V (mvolt)')


Out[18]:
<matplotlib.text.Text at 0xa2ce390>

s and s_syn from mitral and granule cells


In [19]:
figure()
plot(monit_mitral['s'].times/msecond, monit_mitral['s'][0], label="s mitral")
plot(monit_mitral['s_syn'].times/msecond, monit_mitral['s_syn'][0], label="s_syn mitral")
plot(monit_granule['s_syn'].times/msecond, monit_granule['s_syn'][0], label="s_syn granule")
plot(monit_granule['s'].times/msecond, monit_granule['s'][0], label="s granule")
legend()
xlabel('time (ms)')
ylabel('s mitral & s_syn granule & s granule')


Out[19]:
<matplotlib.text.Text at 0xa651e10>

Raster plot


In [20]:
print 'Spikes of', N_mitral, ' mitral:', monit_mitral['spikes'].nspikes
raster_plot(monit_mitral['spikes'], newfigure=True)


Spikes of 100  mitral: 5493

In [21]:
show()