Large-scale separation of neural spikes from stimulation artifacts code
This repo contains (matlab) sample code for doing spike sorting with stimulation artifacts.
- See
Example.m
for the full execution of the code, along with details. Art0.mat
contains the initial artifact that is used to find the model hyperparameteres. This Artifact is a three dimensional tensor (Art0=Art0(j,e,t)
) with dimensions E=512 (electrodes), T=55 (time samples), J=34 (number of different electrical stimuli). This initial estimate was built using equation (7) in the paper. Also, hyperparameters based on this estimate are computed according to equation (8).Data.mat
contains the actual data where spikes are to be found. Specifically
- The fourth dimensional tensor
TracesAll(j,n_j,t,e)
of recordings over array for all trials (n_j=51
is the number of trials) at all amplitudes of stimulation. - The EI of 24 neurons (figure 1 here and in the paper), represented as a the cell array
templates
. Each of these EIs is represented as a matrixV(e,t)
which states how a spike is recorded in each electrode. - The list of stimulation amplitudes,
listAmps
- Stimulating electrode indexes
stimElecs
(here, 404). breakpoints
contains the indexes of stimuli at which breakpoints (Sudden changes in the artifact measured in the stimulating electrode) occurred
- After running
Example.m
two outputs should appear:
Array support
This code is based on a 512-array, the one depicted below(each circle represents and electrode, and the number its index)
- The structure Array in
/Utils
,Array.m
contains array-specific information (e.g. positions, spacing, etc). Specifics for a distinct, 519-array (see below) are also shown there, to illustrate that the algorithm depends on the array through those parameters, and therefore, extensions are straightforward as long as assumptions hold.