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

Clustering by passing variables directly instead of filenames of .mat file #101

Closed ds7711 closed 6 years ago

ds7711 commented 6 years ago

Hi, I am trying to use wave_clus to batch process my data. The ideal workflow is like the following:

  1. In Matlab, read the waveform (data) and sr from .smr (Spike2) file.
  2. Call get_spikes(data, sr) to detect spikes.
  3. Call do_clustering(spikes) to obtain spikes, classes, times.
  4. Write the clustering results back to .smr (Spike2) file.

For the 2nd and 3rd step, I would like to directly pass the variables rather than saving a temporary .mat file and then load it.

Do you have any ideas/suggestions about how I could do this?

Saving data & sr as .mat file and then call the GUI seems to be slow and uses a lot of memory.

ferchaure commented 6 years ago

Hi, if you have enough ram is possible to do something like that. A way to load the file for the get_spikes is making a new reader in the folder _Raw_datareaders . From get_spikes you have to return the index of the spikes and the spikes matrix (see the function get_spikes_single inside that file). Finally give that variables to Do_clustering (in this case you will have to use mainly the function do_clustering_single inside that file).

ds7711 commented 6 years ago

@ferchaure Thanks for the suggestions. Will try that.