MyNixOS website logo
Description

Exact Spike Train Inference via L0 Optimization.

An implementation of algorithms described in Jewell and Witten (2017) <arXiv:1703.08644>.

LZeroSpikeInference: A package for estimating spike times from calcium imaging data using an L0 penalty Build Status

This package implements an algorithm for deconvolving calcium imaging data for a single neuron in order to estimate the times at which the neuron spikes.

This algorithm solves the optimization problems

AR(1) model

minimize_{c1,...,cT} 0.5 sum_{t=1}^T ( y_t - c_t )^2 + lambda sum_{t=2}^T 1_{c_t neq gamma c_{t-1} }

for the global optimum, where y_t is the observed fluorescence at the tth timepoint. We also solve the above problem with the constraint that c_t >= 0 (hardThreshold = T).

AR(1) with intercept

minimize_{c1,...,cT,b1,...,bT} 0.5 sum_{t=1}^T (y_t - c_t - b_t)^2 + lambda sum_{t=2}^T 1_{c_t neq gamma c_{t-1}, b_t neq b_{t-1} }

where the indicator variable 1_{(A,B)} equals 1 if the event A cup B holds, and equals zero otherwise.

Install

In R, if devtools is installed type

devtools::install_github("jewellsean/LZeroSpikeInference")

Usage

Once installed type

library(LZeroSpikeInference)
?LZeroSpikeInference

Python

This package can be called from Python using the py2 package. To install LZeroSpikeInference and rpy2 for use in Python first

  1. Install R (for example apt-get install r-base)

and then from within R install this package (as above). Then pip install rpy2

  1. pip install --user rpy2

The following example illustrates use of the LZeroSpikeInference package from python

from numpy import array
import rpy2.robjects.packages
lzsi = rpy2.robjects.packages.importr("LZeroSpikeInference")
d = lzsi.simulateAR1(n = 500, gam = 0.998, poisMean = 0.009, sd = 0.15, seed = 8)
fit = lzsi.estimateSpikes(d[1], **{'gam':0.998, 'lambda':8, 'type':"ar1"})
spikes = array(fit[0])
fittedValues = array(fit[1])

Thanks to Luke Campagnola for suggesting this approach!

Reference

See Jewell and Witten, Exact Spike Train Inference Via L0 Optimization (2017)

Metadata

Version

1.0.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows