csn-le / wave_clus

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

How to use Do_clustering() function #102

Closed Tenceto closed 6 years ago

Tenceto commented 6 years ago

I have a given dataset of already detected spikes. I have them saved in a matrix, where each row is a spike and each column is a sample. Thus, if I have 1000 spikes of 128 samples, the matrix has dimensions 1000x128.

I want to do just the clustering with wave_clus, and I thought that the function Do_clustering() would do the trick. However, I'm not being able to make it work. The .mat workspace has the matrix under the variable name spikes, and I also included the value of the sampling rate in sr. These are the warning and errors I get:

>>> Do_clustering('/home/iibm/Desktop/2_19_spikes.mat')

Warning: File: /home/iibm/Desktop/2_19_spikes.mat doesn't include spikes

Undefined function or variable 'ME'.

Error in Do_clustering>do_clustering_single (line 502)
        throw(ME)

Error in Do_clustering (line 167)
            do_clustering_single(filename,min_spikes4SPC, par_file, par_input,fnum);

Is it possible to use Do_clustering() to do the clustering on my already detected data?

ferchaure commented 6 years ago

Hi Tenceto, You will need to save your matrix in a file called _FILENAMEspikes.mat and add in that file a index variable with the time for each spike. Then call Do_clustering.

If you have to align the spikes better, you could call Get_spikes first using a FILENAME.mat as the input to make a _FILENAMEspikes.mat.

Tenceto commented 6 years ago

That's it, I was missing the index variable. Thanks!