KiloSort icon indicating copy to clipboard operation
KiloSort copied to clipboard

Alignment of positive spikes

Open shihaisun opened this issue 5 years ago • 1 comments

Hi,

I was wondering how positive spikes are aligned with spike time? To my understanding, the spike time of negative spikes indicates the spike's minimum trough. However, this doesn't seem to be the case for positive spikes. In the image below, I extracted the waveform of a single cluster from the raw binary file. The three above are individual spikes and the one below is an average of 10,000 random spikes from that cluster. The x-axes represent time in sample with the 31st sample representing the spike time (red line). So it seems that the positive peak of the spikes are aligned but not at the spike time?

positivewaveforms

Spike times were extracted from spike_times.npy and waveforms from the binary file. I used the getWaveforms.m script by C. Schoonover and A. Fink to extract the waveforms.

So in short, just wanted to know how positive spikes are aligned with the spike time.

Thank you for your time, Scott

shihaisun avatar Mar 05 '19 10:03 shihaisun

I don't believe you can get positive spikes to align to the peak in KiloSort, as the code looks for a local minimum around the threshold crossing: https://github.com/cortex-lab/KiloSort/blob/3ff2d1027166b6e54ab4661b8c56e33e1ba9c4e7/preProcess/isolated_peaks.m#L4-L5

In our usage case, we multiplied the data by -1 and ran this new inverted data through KiloSort to get the correct spike times. Alternatively, you can try looking for a maximum within a certain number of samples from KiloSort's spiketimes (e.g. like how KiloSort uses loc_range) .

adehad avatar May 25 '19 18:05 adehad