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

Removing bad channels not working in Kilosort 2.5? #315

Closed
HiroyukiKato7 opened this issue Feb 1, 2021 · 6 comments · Fixed by #595
Closed

Removing bad channels not working in Kilosort 2.5? #315

HiroyukiKato7 opened this issue Feb 1, 2021 · 6 comments · Fixed by #595

Comments

@HiroyukiKato7
Copy link

Hi,

I think this relates to what was discussed but unsolved in #279, but I'm wondering if there is a way to remove bad channels from sorting in Kilosort 2.5. I'm using Cambridge 64ch linear probe, and I'm trying to exclude ch1-10, for example.

When I tried setting connected = 0 for ch1-10 in the chanMap file, datashift2 throws an error:

rez = datashift2(rez, 1); % last input is for shifting data
pitch is 20 um
Index in position 1 exceeds array bounds (must not exceed 95).

Error in getClosestChannels2 (line 15)
iC= isort(1:NchanClosest, :);

Error in standalone_detector (line 40)
[iC2, dist2] = getClosestChannels2(ycup, xcup, ycup, xcup, NchanNearUp);

Error in datashift2 (line 31)
[st3, rez] = standalone_detector(rez, spkTh);

Alternatively, I also tried right-clicking the channels in the GUI, but in this case I got a different error:

Unable to perform assignment because the left and right sides have a different
number of elements.

Error in ksGUI/updateDataView (line 893)
chListW(q) = find(cmconn==chList(q),1);

Error in ksGUI/probeClickCB (line 1374)
obj.updateDataView;

Error in ksGUI>@(f,k)obj.probeClickCB(f,k) (line 364)
set(obj.H.probeAx, 'ButtonDownFcn', @(f,k)obj.probeClickCB(f, k));

Error while evaluating Axes ButtonDownFcn.

Is there anything I'm missing? Back in Kilosort 1, changing chanMap file as well as ops.Nchan was enough to exclude channels, but I don't see ops.Nchan in Kilosort 2.5.

I would appreciate your help.

Thanks!

@marius10p
Copy link
Contributor

Something isn't right here, could you please double check your configuration file? I am running it fine with several channels disabled via connected(k) = 0.

NchanClosest should be 10, so that index should certainly not exceed 95. You could stop in debugger there and see what the different parameters are and what are the sizes of different variables.

@HiroyukiKato7
Copy link
Author

In standalone_detector.m, getClosestChannels2 is called twice, in line 28 and 40.
In line 28, NchanNear = 10 and it does not cause an error. However, in line 40, NchanNearUp is 100 and that causes an error. It looks like this part does not depend on configurations, since NchanNear and NchanNerarUp are just defined within standalone_detector.
Capture

@marius10p
Copy link
Contributor

I see now, thanks. It has to do with the lower number of channels then when you remove those 10. We are in the process of patching the code so it works for lower channel counts, should be some time today.

@HiroyukiKato7
Copy link
Author

That would be awesome. Thanks!

@HiroyukiKato7
Copy link
Author

I am wondering if this has been already done. Or, is it now updated on Kilosort 3 and not 2.5?

@jamespherman
Copy link

I am wondering if this has been already done. Or, is it now updated on Kilosort 3 and not 2.5?

I think that's correct. I just got around this by modifying "standalone_detector.m" in Kilosort 2.5. I copied this line of code from "standalone_detector.m" in Kilosort 3:

NchanNearUp = min(numel(xcup), 10*NchanNear);

and replaced this line of code in "standalone_detector.m" in Kilosort 2.5:

NchanNearUp = 10*NchanNear

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.

3 participants