elephant icon indicating copy to clipboard operation
elephant copied to clipboard

[Doc] Spike Extraction parameters

Open myagmur01 opened this issue 3 years ago • 1 comments

Hi @mdenker

I am using elephant.spike_train_generation.spike_extraction function for my MEA 96-channel signal. I have following questions:

  1. Why default values are selected as [-2ms, 4ms]

  2. What is exactly the time_interval here? When I set it to [-10 ms,10 ms] or [0 ms, 10 ms] or [5 ms,15 ms] I get the same results of spike times as below. Could you explain me if I am doing something wrong?

spikes for [-10 ms,10 ms] =  [0.4288     5.9382     6.91823333 6.91963333 6.9386     7.71603333
 7.73576667 8.18213333 8.29553333 8.3024     8.30493333 8.31963333] s 

spikes for [0 ms, 10 ms] = [0.4288     5.9382     6.91823333 6.91963333 6.9386     7.71603333
 7.73576667 8.18213333 8.29553333 8.3024     8.30493333 8.31963333] s 

spikes for [5 ms,15 ms] = [0.4288     5.9382     6.91823333 6.91963333 6.9386     7.71603333
 7.73576667 8.18213333 8.29553333 8.3024     8.30493333 8.31963333] s 

Thank you

myagmur01 avatar Apr 13 '21 18:04 myagmur01

Hi @mytrjp ,

both questions relate to the spike waveforms which are extracted from the signal, i,e., the cutout of the signal around each spike.

The time_interval specifies the cut-out interval around each spike. -2 and 4 is of course somewhat arbitrary, however, many spike sorting tools choose values in this range: the spike is about 1-2 ms in length, and then you take a bit before the spike peak, and a bit more after the spike peak (to catch the dynamics after the spike).

If you set the time_stamps to None, peaks are extracted using numpy's peak finder. Therefore, the spike times will always be the same. However, the waveforms stored in the spike train (in spikes.waveforms, an NxM matrix for the N spikes, each row containing a waveform) should be different: In the first example, they should range from -10ms to 10ms, in the last example they should be from 5 to 15 ms. Thus, as an example, if the sampling frequency is 10KHz, and 123 spikes where detected, then spikes.waveforms should be size 123x200 for the first example.

I hope this helps. Thanks for asking this, I will keep this issue open as a reminder to augment the documentation to better explain this.

mdenker avatar Apr 14 '21 20:04 mdenker