Example #1
0
g = .95
sn = .3
Y, trueC, trueSpikes = gen_data()
y = Y[0]
N, T = Y.shape

c, s = constrained_foopsi(y, [g], sn)[:2]
c_t, s_t = oasisAR1(y, g, s_min=.55)
res = [np.where(oasisAR1(y, g, s_min=s0)[1] > 1e-2)[0]
       for s0 in np.arange(0, 1.1, .1)]
plotTrace(True)


# AR(2)

g = [1.7, -.712]
sn = 1.
Y, trueC, trueSpikes = gen_data(g, sn, seed=3)
rng = slice(150, 600)
trueC = trueC[:, rng]
trueSpikes = trueSpikes[:, rng]
y = Y[0, rng]
N, T = Y.shape

c, s = constrained_foopsi(y, g, sn)[:2]
c_t, s_t = np.array(oasisAR2(Y[0], g[0], g[1], s_min=.55))[:, rng]
res = [np.where(oasisAR2(Y[0], g[0], g[1], s_min=s0)[1][rng] > 1e-2)[0]
       for s0 in np.arange(0, 1.1, .1)]
plotTrace()
Example #2
0
plt.xticks([600, 1200, 1800, 2400], ['', 40, '', 80])
plt.xticks(range(0, 3000, 750), range(0, 100, 25))
plt.ylim(0, 1.)
plt.xlim(0, 2000)
plt.xlabel('Time [s]', labelpad=-10)
plt.ylabel('Activity')
plt.show()


# AR(2)

g = [1.7, -.712]
sn = 1
Y, trueC, trueSpikes = gen_data(g, sn, seed=3)
N, T = Y.shape
result_oasis = oasisAR2(Y[0], g1=g[0], g2=g[1], lam=25)
result_foopsi = foopsi(Y[0], g=np.array(g), lam=25)

fig = plt.figure(figsize=(20, 5.5))
fig.add_axes([.038, .57, .47, .42])
plt.plot(result_oasis[0][150:1350], c=col[0], label='OASIS')
plt.plot(result_foopsi[0][150:1350], '--', c=col[6], label='CVXPY')
plt.plot(trueC[0][150:1350], c=col[2], label='Truth', zorder=-5)
plt.plot(Y[0][150:1350], c=col[7], alpha=.7, zorder=-10, lw=1, label='Data')
plt.gca().set_xticklabels([])
simpleaxis(plt.gca())
plt.xlim(0, 1200)
plt.ylim(Y[0].min() + 1, Y[0].max() - .5)
plt.yticks([0, int(Y[0].max()) - 1], [0, int(Y[0].max()) - 1])
plt.xticks(range(300, 1500, 300), [''] * 4)
plt.ylabel('Fluor.')