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

Kilosort3 not working for linear probes #338

Closed
Jialiang-Lu opened this issue Feb 14, 2021 · 3 comments · Fixed by #595
Closed

Kilosort3 not working for linear probes #338

Jialiang-Lu opened this issue Feb 14, 2021 · 3 comments · Fixed by #595

Comments

@Jialiang-Lu
Copy link

It seems that Kilosort3 doesn't consider the situation of linear probes. Naturally, the xcoords in the channel map for a linear probe have the same value, which means that rez.ops.dminx will be 0.

The line

xcenter = (min(rez.xc) + dminx-1):(2*dminx):(max(rez.xc)+dminx+1);

will make xcenter an empty array for linear probes and all following computation cannot be done.

I replaced this line with
if dminx>0 xcenter = (min(rez.xc) + dminx-1):(2*dminx):(max(rez.xc)+dminx+1); else xcenter = rez.xc(1); end
and

xchan = (abs(ycup - y0) < dmin) & (abs(xcup - x0) < dminx);

with
xchan = (abs(ycup - y0) < dmin) & (abs(xcup - x0) <= dminx);

Same for

xcenter = (min(rez.xc) + dminx-1):(2*dminx):(max(rez.xc)+dminx+1);

and
xchan = (abs(ycup - y0) < dmin) & (abs(xcup - x0) < dminx);

I am not sure if this is the right fix but at least that works for my data collected by a linear probe.

@HiroyukiKato7
Copy link

I have the same issue of xcenter becoming blank because of the way xcoords are handled for a linear probe. I'm wondering if there is any update on this.

@shirquinn
Copy link

hi @Jialiang-Lu
i had this error using a 32ch linear probe
Index in position 1 is invalid. Array indices must be positive integers or logical values.

Error in getMeWtW (line 30)
iList = int32(gpuArray(isort(iNear, :))); % return the list of pairs for each template

Error in trackAndSort (line 100)
[WtW, iList] = getMeWtW(single(W), single(U), Nnearest);

Error in ksGUI/runSpikesort (line 792)
[obj.rez, st3, tF] = trackAndSort(obj.rez);

Error in ksGUI/runAll (line 628)
obj.runSpikesort;

Error in ksGUI>@(,)obj.runAll() (line 319)
'Callback', @(,)obj.runAll());

Error while evaluating UIControl Callback.

after trying your fix, the sorting was preformed with no errors
i am not an expert on this so i hope this fix will get the approval of the creators
thank you

@marius10p
Copy link
Contributor

Sorry about that, I pushed a fix now. Re-open this issue if you still have problems.

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.

4 participants