csn-le / wave_clus

A fast and unsupervised algorithm for spike detection and sorting using wavelets and super-paramagnetic clustering
121 stars 65 forks source link

Issues with uploading spike data to GUI #207

Closed nicwint closed 2 years ago

nicwint commented 2 years ago

Hi there,

Thank you for a great spike sorting algorithm! I am struggling a bit with uploading spike data to the GUI. I continue getting an error message saying that there is an error while evaluating UIcontrol Callback, and that less than 15 spikes are detected. I know there are a lot of spikes present, and it works fins when just uploading the raw data and letting wave_clus do the spike detection itself. I am therefore wondering if I am somehow formatting the data in a wrong manner. To the best of my knowledge, I have done it as the wiki suggests, and I have tried looking through the raw code, but has not managed to figure out if I am doing it correctly.

I have created a struct/cell array (I have tried both) where I store "index" as a vector containing the spike timings (I am using the peak of the spikes, but I guess this does not matter?), and one field/cell with a matrix listing the voltage traces of the spikes along the rows. To make this matrix, I have used the voltage peak as a reference, and included a set number of data points on each side of the peak so that the whole spike is included, but without including too much extra data points outside of the spike. I am therefore wondering if this is the correct way to format the data, and if the number of data points I include on each side of a detected spike will affect how well the algorithm is able to recognize the spike and include it in the sorting?

I have added an example .mat file for reference. channel1.mat.zip

Thanks a lot! :)

ferchaure commented 2 years ago

Hi, you don't need a struct (or cell) just a file with both spikes and index variables inside.

I have used the voltage peak as a reference

That's fine

included a set number of data points on each side of the peak so that the whole spike is included, but without including too much extra data points outside of the spike

That could be tricky, I would recommend adding two extra samples in each side to interpolate the peak and reduce errors related to subsample alignments (the interpolation is enable by default in the parameters). Notice as well that the parameters par.pre and par.post should make sense (without counting the additional ones)

nicwint commented 2 years ago

Great, thank you very much! It worked when storing the variables the way you said and increasing the number of data points included on each side. :)