liubenyuan / py-oopsi

Python implementation of fast-oopsi, smc-oopsi, wiener, and discretize with binning
14 stars 4 forks source link

this is a working document

Py-oopsi: the python implementation of the fast-oopsi algorithm

Fast-oopsi was developed by joshua vogelstein in 2009, which is now widely used to extract neuron spike activities from calcium fluorescence signals. Here, we propose detailed implementation of the fast-oopsi algorithm in python programming language.

Py-oopsi requires numpy, scipy and matplotlib.

Generate Synthetic Calcium Trace

To generate synthetic calcium trace, you can

T = 2000
dt = 0.020
lam = 0.1
tau = 1.5
sigma = 0.2

# signal generator
F,C,N = oopsi.fcn_generate(T, dt=dt, lam=lam, tau=tau, sigma=sigma)

where F is the Fluorescence signal with noise, C is the clean calcium trace, N is the ground truth spikes.

Reconstruct Spikes via py-oopsi

We provide demo.py to illustrate the usage of py-oopsi (as well as wiener filter, discretized binning),

# fast-oopsi,
d,Cz = oopsi.fast(F,dt=dt,iter_max=6)

# wiener filter,
d,Cw = oopsi.wiener(F,dt=dt,iter_max=100)

# descritized binning,
d,v = oopsi.discretize(F,bins=[0.75])

Simulation Results

Tweak py-oopsi

py-oopsi requires

when imaging large population of fluorescene signals of multiple neurons, for example, the connectomics challenge at kaggle.com, you need to write a subroutine to process the fluorescence trace per neuron.

Reference