Giter VIP home page Giter VIP logo

constrained-foopsi's Introduction

constrained-foopsi

Implementation of the constrained deconvolution spike inference algorithm in Matlab.

spike inference using a constrained foopsi approach:
min | sum(sp)
c,sp,b,c1 |
subject to: sp| >= 0
b| >= 0
Gc| = sp
c1| >= 0
||y-b-c - c_in|| | <= sn
sqrt(T)

File constained_foopsi.m

Variables:
y: raw fluorescence data (vector of length(T))
c: denoised calcium concentration (Tx1 vector)
b: baseline concentration (scalar)
c1: initial concentration (scalar)
g: discrete time constant(s) (scalar or 2x1 vector)
sn: noise standard deviation (scalar)
sp: spike vector (Tx1 vector)

USAGE:
[c,b,c1,g,sn,sp] = constrained_foopsi(y,b,c1,g,sn,OPTIONS)
The parameters b,cin,g,sn can be given or else are estimated from the data

OPTIONS: (stuct for specifying options)
p: order for AR model, used when g is not given (default 2)
method: methods for performing spike inference
available methods: 'dual' uses dual ascent
'cvx' uses the cvx package available from cvxr.com (default)
'lars' uses the least regression algorithm
'spgl1' uses the spgl1 package available from math.ucdavis.edu/~mpf/spgl1/ (usually fastest)
bas_nonneg: flag for setting the baseline lower bound. if 1, then b >= 0 else b >= min(y)
noise_range: frequency range over which the noise power is estimated. Default [Fs/4,Fs/2]
noise_method: method to average the PSD in order to obtain a robust noise level estimate
lags: number of extra autocovariance lags to be considered when estimating the time constants
resparse: number of times that the solution is resparsened (default 0). Currently available only with methods 'cvx', 'spgl'

The noise is estimated with a power spectral density approach and the time constants from the signal autocovariance.

The algorithm can also handle missing data (appearing as NaNs in y) due to motion artifacts or for super-resolution approaches

The algorithm is presented in more detail in

Pnevmatikakis, E. A., Gao, Y., Soudry, D., Pfau, D., Lacefield, C., Poskanzer, K., ... & Paninski, L. (2014). A structured matrix factorization framework for large scale calcium imaging data analysis. arXiv preprint arXiv:1409.2903. http://arxiv.org/abs/1409.2903

Toolbox Dependencies

The signal processing toolbox is optional. If present it is used for computing the power spectral density and the autocovariance function.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

constrained-foopsi's People

Contributors

epnev avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.