Giter VIP home page Giter VIP logo

spikefrinder's Introduction

spikeFRInder: Spike inference algorithm using frequency-domain FRI framework

This code can be used to estimate the locations of a stream of decaying exponentials, such as neural spikes in a calcium imaging recording, as described in this paper:

Béjar, Benjamín and Gavin Mischler. "A finite rate of innovation approach for the estimation of a stream of decaying exponentials." 2020 54th Asilomar Conference on Signals, Systems, and Computers, (2020): 1497-1501.

Basic decaying exponential model

The model assumes the input signal to come from a stream of dirac delta functions convolved with a causal decaying exponential. Thus, the signal in continuous-time is of the form

model form

The continuous-time signal is then corrupted with noise and sampled to create the input to the method. The method estimates the amplitudes and locations of the delta functions.

Estimating spike times and amplitudes from a signal can be done with the following code:

from spikeFRInder import estimate_tk_ak
output = estimate_tk_ak(signal, Fs, K, alpha_grid_ends)
tk_indices = output['tk_indices']
ak_hat = output['ak_hat']

The code includes descriptions of all parameters.

Application to calcium imaging spike inference

An application of this is in spike inference with calcium imaging signals. This can be achieved with the following code.

from spikeFRInder import sliding_window_predict
smoothed_estimate_histogram = sliding_window_predict(signal, Fs, K_full_signal_estimate)

The code includes descriptions of all parameters, including optional arguments which should be optimized. The smoothed estimate histogram can be thresholded to obtain more exact spike location estimates.

An example using a synthetic calcium signal can be found in example.ipynb.

The following figure demonstrates a thresholded output from a real calcium imaging trace.

method output

Script to recreate paper figure

The script crossval.py was used to generate Fig. 4 in the paper. We do not own the data, which must be downloaded using a CRCNS.org account, so it is not included in this repository.

Preprocessing code

The calcium signal preprocessing was done with a slightly modified version of the preprocessing done by Theis et al. Benchmarking spike rate inference in population calcium imaging. Thus, the code in c2s_preprocess_modified.py comes from their provided code, with only a minor change in the method of robust linear regression.

BibTeX Citation

@INPROCEEDINGS{bejar2020finite,
  author={Béjar, Benjamín and Mischler, Gavin},
  booktitle={2020 54th Asilomar Conference on Signals, Systems, and Computers}, 
  title={A finite rate of innovation approach for the estimation of a stream of decaying exponentials}, 
  year={2020},
  volume={},
  number={},
  pages={1497-1501},
  doi={10.1109/IEEECONF51394.2020.9443495}}

spikefrinder's People

Contributors

gavinmischler avatar

Watchers

 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.