-
Notifications
You must be signed in to change notification settings - Fork 253
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
BUG: ValueError : Found array with 0 sample(s) (shape=(0, 41)) while a minimum of 1 is required by TruncatedSVD. #606
Comments
Hello, The first part of that traceback, I'll have to do some more poking around to figure out where that other error is coming from. Are you able to post a screenshot of what the gui looks like after you've loaded your data & probe? Separately, based on the probe configuration you've posted, it's not likely that drift correction will work well. It looks like there are only a handful of contacts on each shank, which is not going to give enough spread or sampling density along the depth of the probe to get a reliable drift estimate. So, you should probably just set |
Hi Jacob, thanks for getting back to me. I've just run it through the GUI with
(I've run this recording through Kilosort 2.5 previously and detected lots of spikes!) Here's a screenshot of the GUI with the datafile loaded: |
Sorry, what does the data look like if you you click on 'whitened' at the bottom right of the plot area? I'm just trying to make sure it looks like the data loaded correctly, which is hard to tell from the raw view. If it does look like everything loaded in correctly, you could try reducing |
No problem, here's the whitened data. :) I got the same error again using 6 and 5 for the thresholds. I assume this isn't relevant because I am using Windows not Linux, but I also get this warning earlier on:
|
Yeah that's a known warning, we haven't seen any problems from it. |
I may have stumbled upon the same issue as well (and a solution). I'm working with a 30 channel probe and saw the same error about no spikes being detected. On line 150 of spikedetect.py, |
That's helpful, thanks! I'll take a look at that. The software has worked fine on other datasets that 32 or 64 channels, so it's not just a channel count issue, but that narrows it down at least. I also can't reproduce the error by increasing |
Hi, thanks for the input Radu. I extracted a short section from my dat file to send, and I just tried running it with 100 nearest_templates and 50 nearest_templates. With 50, I do detect some spikes, but then run into this error:
With 100 templates, I get the same error as before. Here's a link to the 10 minute section of data if you want to try: |
That's interesting. It's worth noting that I never encountered the error with TruncatedSVD() in the first place, so there might be several differences between our datasets that are causing the issue. I've uploaded a segment of the data I'm working on at the link below: https://drive.google.com/drive/folders/1JMHhmmHRH6OTHXtbrxgOXzBTpfIUS-WM?usp=sharing By the way, @jacobpennington, should I expect sorting results to be comparable between KiloSort3 and KiloSort4? I'm finding that they agree in the case of really large units, but KS4 overall finds fewer units on the same dataset. I can start a separate issue with some examples if that's helpful. |
@rdarie In general no, they may not be comparable especially if there's a lot of drift. You can check out the bioarxiv preprint for an overview (Table 1 and Table 2 in particular). |
@jacobpennington @rdarie To be clear, Kilosort4 should usually work better and has the same pipeline backbone as Kilosort3 and the same drift correction, so the same thresholds should produce roughly the same number of spikes and units. What is different is the clustering algorithm, which should result in more well-isolated units / better refractory periods. |
Hi, we are using a 32 channel probe and had the same issue of 0 samples for TruncatedSVD. By lowering the Is there a rule of thumb for picking different values, for |
Thanks for the clarification! With that in mind, it looks to me that, at least on my dataset, everything else seems to work just fine after lowering n_nearest_templates. |
@j-moore94 It looks like the second issue you ran into after changing I got reasonable-looking results for your data by increasing If you're not satisfied with the results from that, you can try artificially rearranging your probe file to vertically stack contacts from different shanks, though it's not clear to me what the best way to do that is with your staggered probe arrangement, so I would try tweaking |
Great thanks, this seems to have worked for the full recording too! Any advice on how to choose the value of (EDIT: You can ignore the following, as I reinstalled again and got it working!): Also, when I tried to check the results in phy, I get the issue mentioned in #601. I then tried reinstalling using the command
|
Just as a follow-up to the question about choosing the values, I am now getting some good clusters, but some of the channels of neighbouring shanks are included in certain clusters - e.g. in the below example, channels 30 and 1 are not part of the same shank that the spike is on. I guess I just need to optimise |
Hi @j-moore94 The first problem you mentioned about the As for channels from different shanks being compared, currently that can happen because we are not using shank information for sorting. That's on the to-do list as well, but @marius10p might have some suggestions for how to avoid that in the meantime. |
Hi @jacobpennington, Thanks, I actually don't have the pyqt problem anymore after reinstalling through the other method so it's all good. Okay, it seems to be working pretty well even with comparing shanks, so I'll have a play around with some of the settings to see what works best. Thanks again for your help! :) |
With plexon S-probe 32 data, lowering the |
Hi @NirvikNU, it was |
It sounds like the original issue has been resolved more or less (and a separate one has been opened for the latter comments), so I'm closing this out for now. Please let us know if you run into more problems related to this. |
Hi all! |
@FlyingFordAnglia Can you please tell me what version of Kilosort4 you're using and include a screenshot of the "Extra Settings" window? Also, what is the horizontal spacing of contacts on the same shank? It looks like they're staggered a bit. |
@jacobpennington I'm using version 4.0.7. I've attached a screenshot of the extra settings I used in the last attempt. Contacts on the same shank are 40 microns apart in x direction. I've attached a probeinterface layout of the probe as well. |
@FlyingFordAnglia You should be setting However, the synthetic data you're using is likely to cause all sorts of problems on its own. If all channels have identical waveforms, many of the pipeline steps will not behave as expected and errors are not surprising. So, trying to debug based on this recording is not going to be very helpful. |
@mberns-ru Please try setting |
@jacobpennington Thank you for the quick response! I tried that but it's still producing the same error. |
Can you attach the |
@jacobpennington It's not present. I will try to run it without SI and let you know how it goes. |
@jacobpennington I've attached the log! |
Thanks, unfortunately not very helpful hah. Are you able to share the data and probe file so that I can try running it myself? |
@jacobpennington Sure! Here is a folder with the .prb and .raw file. Let me know if you need anything else! |
@mberns-ru This is what I see when I load the data in the Kilosort4 GUI, the entire recording is like this (i.e. it just looks like white noise with no neural activity). So it's not surprising that an error occurred, and no settings changes will help with that. Assuming that gets fixed, I would leave Or, visually: your current settings result in this placement (templates are white dots, contacts are green squares): Changing to my recommendation ( |
@jacobpennington Hi again! I found out that the raw data was in float32, so I created a new binary file using KS4's io:
This generated data that I thought looked better (albeit, this is my first time with neural data ever, so I don't have much context): Do you have any suggestions? I've uploaded the new file, the int16-binary version (unscaled), and the .prb file here. |
I think this is a bug with how we're handling float32 data, I will look into it. |
@mberns-ru I added a fix for this in the latest version (v4.0.11). In short, your data is scaled so differently from what KS4 expects for int16 data that it was causing some steps to fail. I added new "shift" and "scale" parameters to address this (you can find these in the "Extra settings" window in the GUI). I found that setting I'm going to close this for now since this is getting pretty far off from the original issue topic, and this should fix your particular problem. If you encounter any more issues after trying that change, please open a new issue. |
Describe the issue:
Hi,
(Sorry if this is just me not setting things up properly - I'm not very experienced with Kilosort.)
Every time I try to run kilosort (both from the GUI or using a notebook), I get this error. From doing some debugging, it seems like the whitening/drift correction steps results in the data becoming only zeros. I also seem to get no drift at all, which seems unlikely.
I first thought it was an issue with the way I was setting up the probe. I am using the same .mat file we used for Kilosort 2 but it seems like it is loading correctly so I'm not sure.
Any help would be very much appreciated! :)
Maybe it's helpful to add my probe variable that I get when I load my channel map file:
probe
{'xc': array([ 580., 580., 620., 420., 620., 420., 620., 180., 180.,
180., 380., 220., 380., 220., 380., 220., 620., 820.,
420., 580., 180., 180., 220., 380., 220., 380., 420.,
380., 420., 620., 580., 580., 820., 820., 780., 980.,
780., 1180., 1020., 1220., 980., 1180., 1020., 1220., 780.,
780., 980., 820., 1180., 1020., 1180., 1020., 1180., 1020.,
1220., 1220., 980., 1220., 980., 780., 980., 780., 580.,
820.], dtype=float32),
'yc': array([ -20., -180., -40., -160., -160., -40., -120., -20., -140.,
-60., -60., -200., -100., -120., -180., -80., -200., -80.,
-80., -140., -180., -100., -160., -20., -40., -140., -200.,
-220., -120., -80., -220., -100., -160., -200., -20., -60.,
-140., -140., -80., -200., -220., -60., -160., -80., -60.,
-220., -140., -40., -100., -40., -180., -200., -20., -120.,
-40., -120., -20., -160., -180., -100., -100., -180., -60.,
-120.], dtype=float32),
'kcoords': array([3., 3., 3., 2., 3., 2., 3., 1., 1., 1., 2., 1., 2., 1., 2., 1., 3.,
4., 2., 3., 1., 1., 1., 2., 1., 2., 2., 2., 2., 3., 3., 3., 4., 4.,
4., 5., 4., 6., 5., 6., 5., 6., 5., 6., 4., 4., 5., 4., 6., 5., 6.,
5., 6., 5., 6., 6., 5., 6., 5., 4., 5., 4., 3., 4., 8., 7., 7., 7.,
9.], dtype=float32),
'chanMap': array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]),
'n_chan': 69}
Reproduce the bug:
Error message:
Version information:
Windows 10, Python 3.9, CUDA 11.8
Context for the issue:
No response
Experiment information:
64-channel silicon probe, plus 5 non-ephys channels included in the binary file (total 69 channels). Recorded in Intan at 20000 samples/s.
The text was updated successfully, but these errors were encountered: