Error in Bayesian spike remover while converting to LFP

Hi,

I encountered an error while trying to use the Bayesian Spike Remover while converting the raw signal to LFP using the provided data-set. Please note the error at the end of this message. Your suggestion to solve this problem is highly appreciated.
Also may you please explain a bit the basics of this spike removal or refer me to a related article? Considering that I have the spikes in another file, what is the problem of simply subtracting it from the signal and then perform the LFP analysis?

Thanks,


** Error: [process_convert_raw_to_lfp] Electrophysiology > Convert Raw to LFP
** Line 335: process_convert_raw_to_lfp>BayesianSpikeRemoval (line 335)
** Array indices must be positive integers or logical values.
**
** Call stack:
** >process_convert_raw_to_lfp.m>BayesianSpikeRemoval at 335
** >process_convert_raw_to_lfp.m>Run at 219
** >process_convert_raw_to_lfp.m at 27
** >bst_process.m>Run at 229
** >bst_process.m at 36
** >panel_process1.m>RunProcess at 151
** >panel_process1.m at 26
** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 760
** >bst_call.m at 28
** >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 293
**
**
** File: Floyd/@rawytu288c-01/data_0raw_ytu288c-01.mat
**


@mpompolas @MartinC
Any suggestion?

Hi,

I believe it crashed because a spike was detected extremely early and when trying to center on it the process encountered negative indices. I pushed a tentative quick fix: https://github.com/brainstorm-tools/brainstorm3/commit/dcbc66c5e102f6d224110cd391c7e90044ccf0c6

The Bayesian spike removal method implemented is described in the following paper: https://www.ncbi.nlm.nih.gov/pubmed/21068271

I'll let @mpompolas answer your second question.

Cheers,
Martin

Hi @afalaki,

the Bayesian spike removal algorithm is used after the spike sorting step.

Typically, the LFPs are computed just by filtering (usually 0.5-150 Hz) and sequentially downsampling the data. This process should get rid of the spikes, that are typically believed to have only high frequency components.
However, the paper that this process is based on, showed that there are low frequency components as well that are present at the time of the spiking activity (see Figure 2).

The Bayesian spike removal algorithm computes the spectral signature of your signals (this is the prior), then creates a window around each spike's occurrence (I assume this is what caused the error you reported, the window was out of bounds due to the early spike), and imitates the priors spectral signature within that window. This removes the spike-waveforms more effectively than the typical filtering and down-sampling processes.

This is very important in computations like the spike field coherence and spike triggered average processes where you look at each neuron's spectral influence on the LFPs.

Hope that helps,
Konstantinos

Hi,

I am working with tutorial data-set on brainstorm3, where the changes you've suggested in process_convert_raw_to_lfp, is already included. But I am still getting the same error as @afalaki but on line 337.

I don't get any error if I uncheck 'Despike LFP' in process options.

Any suggestions would be highly appreciated.


** Error: [process_convert_raw_to_lfp] Electrophysiology > Convert Raw to LFP
** Line 337: process_convert_raw_to_lfp>BayesianSpikeRemoval (line 337)
** Array indices must be positive integers or logical values.
**
** Call stack:
** >process_convert_raw_to_lfp.m>BayesianSpikeRemoval at 337
** >process_convert_raw_to_lfp.m>Run at 219
** >process_convert_raw_to_lfp.m at 27
** >bst_process.m>Run at 229
** >bst_process.m at 36
** >panel_process1.m>RunProcess at 151
** >panel_process1.m at 26
** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 760
** >bst_call.m at 28
** >gui_brainstorm.m>atbst_call([at]ProcessRun_Callback) at 293
**
**
** File: Floyd/[at]rawytu288c-01/data_0raw_ytu288c-01.mat
**


@mpompolas @MartinC

Thank you for your report! I believe the issue was coming from minor rounding errors with samples computation, I added a round() operation to ensure the spike samples are integers: https://github.com/brainstorm-tools/brainstorm3/commit/41028dd1112e518e2b3e825a4b093ee4283a1402

That worked on my end, let me know.

Thanks!
Martin

Worked! Thank you for the quick fix.

Dixit

1 Like