Kilosort icon indicating copy to clipboard operation
Kilosort copied to clipboard

BUG: <How to assign a better setting based on the probe map>

Open Alchemist-Y opened this issue 1 year ago • 10 comments

Describe the issue:

First: My probe map is a little irregular compared with Neuropixle probe. I want to assign a better settting to fit it. Here is my probe map. Actually I do not know it clearly about the Group Centers and Universal Templates during sorting. And intuitively it seems better to remove the group centers in the middle(about 50 - 150) and reduce the number of the universal templates. image image image

Second: only thess channel I can toggle it to exclude, others are not permitted,I don't know the reason. image

Reproduce the bug:

No response

Error message:

No response

Version information:

Kilosort v4.0.15

Alchemist-Y avatar Sep 10 '24 12:09 Alchemist-Y

Please upload your probe file so I can reproduce the issue, or paste in the output of "Print Probe" from the GUI.

jacobpennington avatar Sep 14 '24 00:09 jacobpennington

hi,jacob, here is my probe file screenshot. Thanks a lot. actually in the acqusition software Intan, I just find 5-6 spike unit, but after the kilosort process, it output more than 50 unit and with about 10 unit with good refractory. image

Alchemist-Y avatar Sep 14 '24 03:09 Alchemist-Y

Please use the "Print Probe" button in the GUI and paste that output here, or upload the .json file for the probe. I can't copy-paste code from an image.

jacobpennington avatar Sep 15 '24 00:09 jacobpennington

sorry,jacob. Here is my .json file. 32 Tetrode 4 shank probe map.json

Alchemist-Y avatar Sep 15 '24 04:09 Alchemist-Y

@jacobpennington hi,jacob. I want to extract the waveform from the .dat file.I have a question: If I have excluded some bad channels, what is the number of channels will be streamed into disk in the .dat file?

Alchemist-Y avatar Oct 15 '24 06:10 Alchemist-Y

@Alchemist-Y As for the template and center placement for your probe, it's being thrown off because you're treating tetrodes as if they were shanks. Unless there's a specific reason for that for the type of tetrode you're using, I would recommend either:

a) Putting all contacts in a single column (i.e. all the same x- position), marked as a single shank, with ~100 micron spacing between contacts. This will essentially sort each contact separately, which is often preferable since the true geometry for tetrodes is not known.

b) Marking each tetrode as a separate shank (i.e. use 8 shanks, not 4). That will restrict template and center placement to keep them within each shank.

As for the number of channels "streamed into disk," I'm not sure exactly what you mean. When you exclude bad channels through the Kilosort4 GUI or API, those channels are simply skipped over when viewing the data. The shape of the data in the .dat file is unchanged. If you want to exclude the same channels when extracting waveforms yourself, you just need to skip those indices when loading the data.

jacobpennington avatar Oct 16 '24 16:10 jacobpennington

@jacobpennington,hi jacob, In my stereotype images, is it necessary to keep the map the same with my actural probe? Here is my real probe channels design. So it is 2 tetrodes in one shank. So in this case, could I do the change according to your adivce? BY the way, in your plan B, is this map json meets your advice(this new map json)? But it also seems to obey the origin design of the probe. image 32 Tetrode 8 shank probe map.json

Alchemist-Y avatar Oct 17 '24 06:10 Alchemist-Y

I see. In that case, suggestion a) would not make sense since the contacts do have a fixed geometry. Yes, please try that 8-shank probe map you uploaded. You should also update to the latest version of kilosort4, since I recently fixed the placement of the grouping centers for layouts like this.

jacobpennington avatar Oct 17 '24 16:10 jacobpennington

@jacobpennington Bravo. Excellent work! Thanks for your advice! but I seems to meet a new problem, is it due to my new probe design submitted above or just for my exclueded channels? Or is the waring important to be paid attention? Here is my sort parameters file and warning log. sorted setting 2version.json warning log: C:\Users\alche\anaconda3\envs\kilosort\lib\site-packages\scipy\sparse_index.py:151: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient. self._set_arrayXarray(i, j, x) image

Alchemist-Y avatar Oct 18 '24 04:10 Alchemist-Y

Follow with the above, I try to restart the kilosort and clear the Cache, and the warning is missing but another error occurs, which is about the CUDA memory. Acutually I have run this data sucessfully before with the kilosort version of 4.0.17. Here is my log. So I just think is there any imcompatibility in this new version of 4.0.18? CUDA out of memory kilosort4 4.0.18 Log.log

Alchemist-Y avatar Oct 18 '24 08:10 Alchemist-Y

@Alchemist-Y sorry for the trouble, can you please try updating to v4.0.19? There was a bug in the way templates were generated for multi-shank probes which may have caused the memory issue here.

jacobpennington avatar Oct 25 '24 18:10 jacobpennington