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' in Probe or Data View #371

Closed
jmagnu1 opened this issue Apr 19, 2021 · 5 comments · Fixed by #595
Closed

Removing 'Bad Channels' in Probe or Data View #371

jmagnu1 opened this issue Apr 19, 2021 · 5 comments · Fixed by #595

Comments

@jmagnu1
Copy link

jmagnu1 commented Apr 19, 2021

Greetings! our lab is relatively new to using Kilosort to analyze the data we have acquired using a NeuroNexus 64 channel probe in rats with an Intan RHD2000 recording system. Upon running a few of the amplifier.dat files, we can successfully run the code in Matlab 2019a without issues (using 'Run All' without deselecting any channels). However, once we start trying to delete channels that are clearly un-useful for analysis, either by clicking them in the 'Probe View' or 'Data View', we start getting Error A. Then, if we 'Run All', we get Error B. We suspect the errors are linked in some capacity since the same files will run with zero issues within Kilosort when we refrain from deselecting channels. We would greatly appreciate any direction from more experienced Kilosort users - i.e. could this be a configuration file issue when we set up the channel mapping? Or is this a known bug? If any further info is necessary to help address the issue, please let us know!

Error A
Unable to perform assignment because the left and right sides have a different number of elements.
Error in ksGUI/updateDataView (line 900)
chListW(q) = find(cmconn==chList(q),1);
Error in ksGUI/probeClickCB (line 1381)
obj.updateDataView;
Error in ksGUI>@(f,k)obj.probeClickCB(f,k) (line 366)
set(obj.H.probeAx, 'ButtonDownFcn', @(f,k)obj.probeClickCB(f, k));
Error while evaluating Axes ButtonDownFcn.

Error B
Unable to perform assignment because the left and right sides have a different number of elements.
Error in ksGUI/updateDataView (line 900)
chListW(q) = find(cmconn==chList(q),1);
Error in ksGUI/runPreproc (line 759)
obj.updateDataView();
Error in ksGUI/runAll (line 633)
obj.runPreproc;
Error in ksGUI>@(,)obj.runAll() (line 321)
'Callback', @(,)obj.runAll());
Error while evaluating UIControl Callback.

@nsteinme
Copy link
Collaborator

nsteinme commented Apr 19, 2021 via email

@jmagnu1
Copy link
Author

jmagnu1 commented Apr 20, 2021

Thanks! We're in the process of trying out this as a debugging line in our specific channel map file. It may be something we'll end up needing to do for each individual session (i.e. if we drive the probe and a specific channel ends up with better signal on subsequent sessions). If this doesn't work, we'll reach out!

@jmagnu1
Copy link
Author

jmagnu1 commented Apr 21, 2021

Actually, we just edited our code for the channel mapping and are continuing to have issues with errors etc. Here is our code with the added information for one testing session, taking out known bad channels for that specific session:

Nchannels = 64;

% set connected to false for any bad/noisy channels (so kilosort doesn't
% try to pull spikes from them)
connected = true(Nchannels,1);
bad_channels = [8,16,6,5,13,3,2,1,9];
connected(bad_channels) = false;

chanMap0ind = [53, 50, 52, 51, 55, 48, 54, 49, ...
61, 58, 60, 59, 63, 56, 62, 57, ...
37, 36, 38, 34, 40, 33, 41, 32, ...
47, 46, 43, 45, 39, 44, 35, 42, ...
16, 17, 19, 21, 18, 25, 20, 29, ...
26, 27, 28, 24, 31, 22, 30, 23, ...
04, 03, 05, 02, 06, 01, 07, 00, ...
12, 11, 13, 10, 14, 09, 15, 08];
chanMap = chanMap0ind + 1; % I think this is needed because Intan counts from zero and Matlab starts indexing at 1

xcoords = repmat(50 * (1:8),8,1);
xcoords = xcoords(:)';
ycoords = repmat(200 * (1:8),1,8);
kcoords = repmat(1:8,1,8); % for now, clustering sites along rows because they have 50 um spacing vs 200 um spacing vertically

fs = 20000;
save(....)

We then open the gui, select data for the session, and edit the probe channel map to reflect above. The issue is now a slightly different issue then above, in that we can no long select/deselect probe channels within the 'Probe View' and can no longer use the controls set for the 'Data View'. These files appear to run fine if selecting one of the pre-made channel maps that were downloaded from the Git repository and run fine without selecting for bad channels either in the code or in the gui (i.e. running all the channels irrespective of what appears to be bad sites). The errors we see now are:

Unable to perform assignment because the left and right sides have a different number of
elements.
Error in ksGUI/updateDataView (line 900)
chListW(q) = find(cmconn==chList(q),1);
Error in ksGUI/computeWhitening (line 782)
obj.updateDataView;
Error in ksGUI/updateProbeView (line 1222)
obj.computeWhitening()
Error in ksGUI>@(,)obj.updateProbeView('reset') (line 273)
'Callback', @(,)obj.updateProbeView('reset'));
Error while evaluating UIControl Callback.

Again, we would appreciate any suggestions! Thanks!

@cafalchio
Copy link

Hi, have you found your answer? Would mind to share?

@kermit000000
Copy link

kermit000000 commented Dec 16, 2023

@jmagnu1 @cafalchio have you resolved the issue? Please share if you've figured out how to remove bad channels. Thanks!

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