Large-scale separation of neural spikes from stimulation artifacts code
This repo contains (matlab) sample code for doing spike sorting with stimulation artifacts.
Example.mfor the full execution of the code, along with details.
Art0.matcontains 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.matcontains 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=51is 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 matrix
V(e,t)which states how a spike is recorded in each electrode.
- The list of stimulation amplitudes,
- Stimulating electrode indexes
breakpointscontains the indexes of stimuli at which breakpoints (Sudden changes in the artifact measured in the stimulating electrode) occurred
- After running
Example.mtwo outputs should appear:
- The structure Array in
Array.mcontains 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.