In [1]:
%matplotlib inline
In [2]:
from brian2 import *
WARNING  py.warnings: /Users/joe/anaconda/lib/python2.7/site-packages/jinja2/loaders.py:212: UserWarning: Module argparse was already imported from /Users/joe/anaconda/lib/python2.7/argparse.pyc, but /Users/joe/anaconda/lib/python2.7/site-packages is being added to sys.path
  from pkg_resources import DefaultProvider, ResourceManager, \

WARNING:py.warnings:/Users/joe/anaconda/lib/python2.7/site-packages/jinja2/loaders.py:212: UserWarning: Module argparse was already imported from /Users/joe/anaconda/lib/python2.7/argparse.pyc, but /Users/joe/anaconda/lib/python2.7/site-packages is being added to sys.path
  from pkg_resources import DefaultProvider, ResourceManager, \

Set up ramping depolarization

In [3]:
duration = 1000*ms
t0 = duration / 2
s_ramp = 225.0 * ms # duration / 4
I_max = 40.0
def I_ramp(t, s=s_ramp):
    return I_max * exp(-(t - t0)**2/(2*s**2))

time = np.linspace(0*ms, duration, 256)
for s in linspace(50*ms, duration / 4, 6):
    plot(time / ms, I_ramp(time, s=s), label='s=%.1f ms' % (s / ms))
    
xlabel('time (ms)')
ylabel('I_ramp')
legend(loc='upper right')
Out[3]:
<matplotlib.legend.Legend at 0x109da0bd0>

Bursting neuron model

In [4]:
n = 100
freq = 8 * Hz
I_theta = 10.0

a = 0.02
b = 0.2
# c = -50.0
d = 4.0

eqs = '''
    dv/dt = (0.04 * v**2 + 5 * v + 140 - u + I + theta) / (7*ms) : 1
    du/dt = a * (b * v - u) / (7*ms) : 1
    I = I_max * exp(-(t - t0)**2/(2*s_ramp**2)) : 1 (shared)
    theta = I_theta * sin(2 * pi * freq * t) : 1 (shared)
    c : 1
'''

neurons = NeuronGroup(n, model=eqs, threshold='v > 30', reset='v = c; u = u + d')
neurons.v = '-87.0 + 25.0 * rand()'
neurons.c = '-50.0 - 40.0 * i/n'
In [5]:
S = SpikeMonitor(neurons)
trace = StateMonitor(neurons, ('v', 'u', 'I', 'theta'), record=[50])

run(duration)
In [9]:
f, ax = subplots(3, 1, sharex=True, figsize=(13, 8))
sax, vax, rax = ax

sax.plot(S.t/ms, S.i, '.k')
sax.set(xlabel='Time (ms)', ylabel='Neuron index')

vax.plot(trace.t/ms, trace.v[0])
vax.plot(trace.t/ms, 2*(trace.theta[0]+1))
vax.set(xlabel='Time (ms)', ylabel=r'$V_m$ [Neuron 50]')

rax.plot(trace.t/ms, trace.I[0], 'r-')
rax.set(xlabel='Time (ms)', ylabel=r'$I_{RAMP}$', ylim=(0,1.1*I_max))

sax.set_xlim(0.0, duration / ms);

Save the figure

In [ ]:
posterdir = '/Users/joe/projects/poster'
imagefn = 'mehta_ramp_demo.pdf'

savepath = os.path.join(posterdir, imagefn)
f.savefig(savepath)