csn-le / wave_clus

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

data_handler processing changed? #192

Closed aboharbf closed 2 years ago

aboharbf commented 3 years ago

I've recently re-cloned the waveClus repo for fear that the repo I've long been changing has some bug which hasn't been fixed in light of the commits which have occured since. the majority of the changes I made were focused on filepaths - I'm running things in parallel and changing the directory messes up other workers.

None of my old files are on the path, and I run into the following. Upon downloading the most recent waveClus repo, I run 'wave_Clus' and open up an NC5 file for a specific channel (with the '_TimeStamps' in the folder. and I run into the following issue.

I get the "Less than 15 spikes" error for every channel, which is definitely not the case. After looking at the code around the error, it seems like the loop across "n = 1:data_handler.max_segments" doesn't run because max_segments is empty.

In my version of waveClus 3, the data_handler looks like this: image

In the recently downloaded one, this is what it looks like image

Again, there is no cross talk here b/t repos, so I don't know whats going on. Thanks a lot.

ferchaure commented 3 years ago

Hi, the issue is previous than that. It looks like wave_clus don't recognize the filetype (with_raw=0); did you change it? You have to look at Batch_files/readInData.m around line 110 because the code isn't calling the function nc5_wc_reader.m

aboharbf commented 3 years ago

Good catch. It seems like the nc5_wc_reader is properly called, but it runs into a problem w/ the first expression

stamps_name = [raw_filename(1:regexp(raw_filename,'_\d*.NC5')) '_TimeStamps.mat'];

in my code, the raw_filename is 20201115Mo002_NSX_Ch1.NC5 and the expression regexp(raw_filename,'_\d*.NC5') evaluates to empty. in my old NS5 reader, I updated this region to this:

`[tmpPath, filename_end, ~] = fileparts(raw_filename);

 filesplit = split(filename_end, '_');

 stamps_name = fullfile(tmpPath, [filesplit{1} '_NSX_TimeStamps.mat']);`

So I guess this has to do with my previously processed files having an unusual naming structure (Having add 'Ch' before the number. Glad at least I've now merged the master branch. Is there any plans or openness to changing how file path management, and not having any calls to cd()?

ferchaure commented 3 years ago

I'm not actively developing Wave_clus any more. But you can make a pull request and I will check if the change is small enough to don't break anything else.