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

Do_clustering #214

Closed EveyZhang closed 2 years ago

EveyZhang commented 2 years ago

Hi, I ran Do_clustering with a detected spike file. When I input 'Do_clustering ('1_spikes.mat')', and the 1_spikes.mat is a file contains a matrix named spikes (nspikes x length) and a vector index with the spike times (in ms) I encountered an error: Wave_clus didn't find a sampling rate in file. It will use the input parameter or set_parameters.m reference to a non-existent field 'tmin'. find_temp (line 19) if ~isempty(aux) && par.tmin==0 && aux==2

Do_clustering>do_clustering_single (line 561) [clust_num temp auto_sort] = find_temp(tree,clu,par);

Do_clustering (line 177) do_clustering_single(filename,min_spikes4SPC, par_file, par_input,fnum,save_spikes);

I would like to know the possible reasons. Any advice would be appreciated!

ferchaure commented 2 years ago

Hi, I remember a similar old bug. are you using the last version? Could happen if you use an old set_parameters as well

EveyZhang commented 2 years ago

Yes, I used the version 3.0.3.

ferchaure commented 2 years ago

that version has the issue, just download the latest code

EveyZhang commented 2 years ago

ok, Thanks for your response!

EveyZhang commented 2 years ago

Sorry, the latest version I found on Github is 3.0.3, did I get something wrong ?

ferchaure commented 2 years ago

just from the main page and download or from the link in my previous comment. probably it says the same version but it has a few bug fixed

EveyZhang commented 2 years ago

I download from the link in your previous comment and this errors still occurs. Is there something wrong with my input?

ferchaure commented 2 years ago

Do you have an old set_parameters in the same folder as the data? It looks like is loading from there and without par.tmin run: which('set_parameters.m') and check that is in the new code path.

EveyZhang commented 2 years ago

Yes, a new set_parameters.m is in the new folder.

ferchaure commented 2 years ago

Ok, I found the issue. Rename the file to something without the '_spikes' at the end. If the spikes are already interpolated (or you just don't have extra samples ) set par.interpolation = 'n' in set_parameters Let me know if that works

EveyZhang commented 2 years ago

It doesn't seem to work, still the same error.

ferchaure commented 2 years ago

Ok I just committed code that could fix your issue. Can you download the new code and try again?

EveyZhang commented 2 years ago

It works! Thank you for your patience!

ferchaure commented 2 years ago

Thank to you for keep trying :1st_place_medal: