👼 Matlab package implementing blind deconvolution method for neural spike recovery
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Neural Event Reconstruction and Detection via Sparsity

version 0.1 - this is first repository of NERDS (published on Nov 13, 2014)

Related Publication


Matlab package implementing blind deconvolution method for neural spike recovery from calcium signal


  • Matlab version >= 2007
  • SPGL1 (Solver for large-scale sparse reconstruction) see also at git link (note that we did not include SPGL1 in NERDS project) so make sure that you install SPGL1 and include in MATLAB path.


In order to download NERDS folder, either download zip file from git repository directly or use git to clone repository to particular directory that we want

git clone https://github.com/KordingLab/nerds

Also install SPGL1, run spgsetup.m, and then add to MATLAB path. After that, hover to the folder and run setup_nerds.m code in order to include path.


You can run NERDS algorithm by using the function compute_nerds in main folder

[gen_atom_out, spike_idx, x_hat_out, e_hat_out] = compute_nerds(y, opts)

where input has 2 arguments

  • y is 1-D fluorescent/ calcium signal (either row or column format)
  • opts is matlab structure contains parameters described in MATLAB code (if not specify, it will assign default parameters)
    • opts.numTrials - number of iteration, default numTrials = 10
    • opts.L - length of template that we want to estimate, default ask user
    • opts.thresh - thresholding parameter, default thresh = 0.1 i.e. we thershold spikes whose amplitude less than 10 % from range of recovered spikes
    • opts.wsize - window size where we apply summation of spikes (peak_sum) in order to remove small group of low magnitude splikes output from algorithm
    • opts.verbose - verbose parameter for SPGL1, default verbose = false

and output has 4 arguments

  • gen_atom_out is estimated template where each column contains estimated template of each iteration
  • spike_idx is cell that contain index that spikes occur
  • x_hat_out is matrix where each column contains estimated spikes train produced in each iteration (we'll fix amplitude problem soon)
  • e_hat_out is matrix contains DCT coefficient which can transform back to base-line drift in calcium signal

opts.L is estimated length of template (called gen_atom) where you can estimate the length by the following figure:

Example Code

See example_synth.m file for an example from the paper where we show that solving Non-Negative Basis Pursuit hold a promising result of estimating . And example_nerds.m that we apply NERDS algorithm to real data.

For synthetic example, you can follow the code which will produce result graphs as follow. Note that post-processing, we use some thresholding after compute spikes train and summing close peak together:

Plot of baseline drift, reconstruct spikes and synthetic data

#### Plot estimated spikes and synthetic data

#### Plot result of NERDS applying on real data

Team members


  • The calcium and electrophysiology data included in example_real_data.mat was collected in Jason MacLean's Lab at the University of Chicago. Check out the following two papers: Runfeldt et. al. and Sadovsky AJ et. al. for more details regarding the experimental methods utilized to acquire these simultaneous recordings.


  • The MIT License (MIT) Copyright (c) 2014 Eva Dyer, Christoph Studer and Titipat Achakulvisut