-
Notifications
You must be signed in to change notification settings - Fork 249
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
Whitening filter removing spikes #815
Comments
Hi @gjin239, I think you can still see spikes in the lower figure, just with a much smaller amplitude. Can you z-score the signals in time? Whitening removes the correlation between the channels, so the spikes will only remain in whichever channel had the highest amplitude for that spike. Whitening also drastically reduces the amplitude of the whole signal (but not necesarily the ratio between noise and spikes) |
Hi @morales-gregorio, thank you for the information on whitening. We're more accustomed to using the trace view of KS2, which appears to show that good spikes are sometimes ignored after pre-processing. Not quite sure how to go about z-scoring signals yet: we're trying to reproduce data outputs in KS4, but keep running into a TruncatedSVD ValueError. |
@gjin239 Can you please upload |
@jacobpennington Nothing is saved to the results directory yet, but I can copy-paste the log straight from the message logbox:
Just in case they're important, here are the settings I'm currently using, While there are only 4 active channels, as a carry-over from KS2 I've fitted on 12 blank dummy channels such that the data could be read as a Linear x16 probe. |
@gjin239 Unfortunately I will need to see the full log, there is a lot more information in there. Please upload it when you are able. |
@jacobpennington Turns out I was using an old version of KS4; here's the error log now that I've updated it. |
I just noticed your comment about concatenating dummy channels. That can cause all sorts of unexpected behavior for Kilosort4. If whitening is removing spikes that are occurring across all channels, the best solution is to concatenate multiple tetrode recordings to be sorted simultaenously, i.e. sort 4 recordings together for 16 channels total (or more). |
@jacobpennington Huh, interesting! Is there any chance that 4 recordings would influence each other's sorting outputs? |
I'm not sure about earlier versions of Kilosort. We're not providing support for those anymore, but you could try asking another user that has sorted tetrode data on previous versions. As for KS4, sorting the recordings together should not influence sorting results provided that the probe layout is set up correctly. On that note, you sould not use the 16-channel linear probe that gets included by default. We use that for some testing, but the contacts for that probe are only spaced 1um apart, which will result in some strange behavior for sorting real data. You should create your own probe map, with channels on the same tetrode spaced close together on the y-axis (maybe ~20um or so) and a gap of at least ~100um between tetrodes so that they're sorted separately. This is different from previous versions of Kilosort, for which only the relative spacing of contacts mattered. For KS4, the absolute distances between channels make a difference. |
@jacobpennington Sounds good, I'll give that a go. |
There is a parameter for very basic artifact removal, |
@jacobpennington I've created the new file and probe, and now I'm getting a different error: |
@gjin239 your batch size is set to the entire duration of the recording, which is going to cause all sorts of problems. As a general rule, you should start by running KS4 without changing any of the parameters from their defaults, except for the sampling rate and number of channels. The default batch size of |
As for your other question, I don't see any reason why you would need to disable CMR. |
@jacobpennington KS4 can run through the entirety of spike sorting now, and the phy outputs are consistent with individual files. Thank you! |
I'm not sure what you mean about the inconsistent output. You should only click run once for each sorting job. It's possible there's a bug related to running multiple jobs back to back in the same GUI session (i.e. without closing the GUI and then launching it again), but it's hard to say without seeing what outputs (or lack of outputs) you're referring to. If you're trying to sort many recordings in sequence, it would be simpler to use the API. I.e. something like:
You can see more details about that here: https://kilosort.readthedocs.io/en/latest/tutorials/basic_example.html |
@jacobpennington I solved this issue, looks like it just takes a while longer to generate all the phy files because of the data size. Thank you for this information nonetheless, it is useful. KS4 is currently generating a total of ~12 clusters for a combined dataset, with each cluster clearly consisting of several different merged cells- e.g. these spikes from the same initial identified clusters. |
Changes to |
@jacobpennington I see, thank you. However, it doesn't really seem like tweaking ccg_threshold changes much on my end- would it be because their features are too similar? Another query I have is whether KS4 has trouble with certain chunks of data: you can see clearly here that there are two sections where spikes were not detected in any part of the recordings. |
Hi all,
I know Kilosort/Phy is specialised for data with large channel counts, but currently we are only running 4-channel tetrode recordings through this software. As such, the whitening filter appears to be nullifying our valid spikes, even while using low whitening ranges:
(raw VS whitened)
Is there a way to somehow disable the whitening filter or minimise its effects on our data? Thank you!
The text was updated successfully, but these errors were encountered: