Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment error in clusterSingleBatches for very few channel data #128

Closed
Jialiang-Lu opened this issue Nov 3, 2019 · 1 comment · Fixed by #595
Closed

Assignment error in clusterSingleBatches for very few channel data #128

Jialiang-Lu opened this issue Nov 3, 2019 · 1 comment · Fixed by #595

Comments

@Jialiang-Lu
Copy link

Jialiang-Lu commented Nov 3, 2019

Hi,

I need to spike sort my single channel recordings. Following the advice on the website, I am running Kilosort2 on four channels (i.e. only four channels have connected==true) where three of them are just noise. Unfortunately, preprocessDataSub believes that two channels are bad and my ops.Nchan becomes 1, which lead to Nfilt==1 in clusterSingleBatches and the error:

Error using gpuArray/subsasgn
Assignment has more non-singleton rhs dimensions than non-singleton subscripts.
Error in clusterSingleBatches (line 93)
        Whs(:, ibatch)     = int32(Wheights);

The error happens because Wheights is 1x2 array and ibatch is a scalar. Wheights is caculated here:

(72)      W = dWU./(1e-5 + mu);
(73)      
(74)      W = reshape(W, nPCs, Nchan, Nfilt);
(75)      nW = sq(sum(W(1, :, :).^2,1));
(76)      W = reshape(W, Nchan * nPCs, Nfilt);
(77)       
(78)      [~, Wheights] = max(nW,[], 1);

My questions is, what does the sum on the first dimension do on line 75 if W(1, :, :) has size 1 along the first dimension? If W is nPCs x Nchan x Nfilt on line 74, then nW would be an Nchan x Nfilt array (if Nfilt>1) or 1 x Nchan array (if Nfilt==1 in my case). Wheights would have the same dimension as nW and would never have the second dimension==1, therefore cannot be assigned to Whs(:, ibatch).

Am I missing something important, or is it the case that only two good channels simply wouldn't work?

@Jialiang-Lu
Copy link
Author

Ok, making ops.minfr_goodchannels = 0 solves the problem, at least for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants