-
Notifications
You must be signed in to change notification settings - Fork 33
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
Adjusting bin size in percSpikesMissing for burst units #179
Comments
Hi Ryan, Thanks for your message! I can't really see the amplitudes in this plot (it looks like the plotting default is not working great in this case). Would you be able to zoom in a little on these two plots (or open the unit in phy and screenshot things there) ? I don't intuitively see why the % of missing spikes would fail in this way (over-estimating) for bursty units - it should usually under-estimate the percentage of missing spikes because the spike distribution is non-Gaussian and has a heavy tail toward the lower amplitudes. |
Interesting! What bin size / number of bins did you end up setting it to? |
Setting the bin size to 500 was working. However, I have actually figured out what the issue was. There were outlier spikes from adverse noise events happening for multiple sessions and multiple rodents at the end of each session across all channels affecting every unit (amplitude >1000). This then affected the distribution of bin locations. Because there were so few (<50 each), they weren't appearing in any of the windows in Phy. If you look at the original GUI output you can see them in the amplitude presence window. If anyone else runs into this issue, install the phy2 plugins here and remove outliers using the Mahalanobis distance plugin to avoid spending two weeks down a rabbit hole like me. Science :') |
Yes, good catch. I can see the spikes aren't displayed properly in bombcell because of these outliers (and then the histogram bins are not the correct size/ values to capture any meaningful amplitude variations to fit a Gaussian to). |
Hi Ryan, I am playing around with how to get bombcell dto deal with amplitude outliers. I am curious to see if it works on your data (and also to look a bit more into what outliers look like). Would you be able to send the kilosort output (.npy) files to me? You can send them using email: [email protected] |
Hi Julie! Just shared a folder with you let me know if you didn't get it. |
If you still get the bug, could you also send me your parameter file (or the script or the parquet file, whichever) to see if I can reproduce it that way? |
So that is the other thing, I am currently unable to get the other summary plots to appear along and the gui sometimes won't appear at all (which maybe a kilosort issue haven't fully looked into it yet.) %% calculating quality metrics parameters % saving parameters % duplicate spikes parameters % amplitude / raw waveform parameters % signal to noise ratio % refractory period parameters % percentage spikes missing parameters % presence ratio % drift estimate % waveform parameters % recording parameters % distance metric parameters %% classifying units into good/mua/noise parameters % waveform % distance metrics % other classification params end |
Thanks for sending that over, Ryan! Running bombcell with that file, I still don't get any errors. Could you please double check you've updated all bombcell files fully (the easiest is just re-downloading / cloning so that everything is sure to be up-to-date) |
Hi again, I sadly can't reproduce any of these bugs. Can you confirm that you've updated all bombcell files? It might be easiest to completely delete your current bombcell folder re-download or re-clone it. |
Hi Julie! So I was able to resolve these issues, however, the processing speed has slowed down quite a bit. I've tried using both the live editor and copying over the bombcell_pipeline script but both seem to be processing quite a bit slower. Is this expected with the time chunking in the percSpikesMissing script? |
Sorry, I missed your reply. That's odd, I don't see any speed changed on my end. |
Hi Julie! No worries, I'm also working on setting up UnitMatch so I've got plenty to work on! I reverted back to the previous version I was working with and was able to get it to work (<1min) with the only adjustment being the percMissingSpikes script. I'm testing on the most recent version with the only adjustment being the qualityParams file and ensured that all of these are set to zero and it's taking ~7 minutes for the same file. Despite setting the loadRawTraces to 0, it is still loading raw traces in the GUI. However, this version of the GUI does appear without any issue despite being on a landscape monitor and will be used for publication purposes :) |
Ah interesting that it has slowed down your machine. Sorry about that! In that case, the culprit must be an addition I made to function to prevent extreme outliers. If you comment out the current lines 46-53 does that speed things up again? If it does I will refactor that code / make an option to not slow down everything. About the loadRawTraces, this was to load chunks of raw data in (that I've now disabled because it was slow and clunky). You can safely ignore that and thanks for flagging I've cleaned that up now :) |
Just to add - if you do want to disable showing the raw waveforms, you can set param.extractRaw = 0 before loading the GUI. Glad you like the GUI :) |
I'm still experiencing anywhere from 7-12 minutes of processing time even with the updates. I was unable to comment out 46-51 in the percMissingSpikes without disrupting the rest of the script but I am able to integrate the updated script into the previous version I used which seems to work at recognizing the outliers and ignoring them while not sacrificing processing speed, so I don't believe that is what's slowing it down. I also noticed a couple of bugs in the new version namely that some of the variables are going unrecognized during the GUI visualization step (namely minPeakTroughRatio_nonSomatic). I'll be playing with it some more this week so I'll let you know if there's anything else I can find |
Sorry about that bug - should be fixed now About the slow speed - could you run the main function with the MATLAB profiler? So run this:
and show me the output. |
No need to apologize this has already saved me eons of script writing and analysis 😄 I started the profiler this morning but has surpassed the two-hour mark, so I'll start it again later today and let it run overnight. |
It crashed at some point overnight and here are the errors I got: Missing param fields filled in with default values Error in [bc.qm.removeDuplicateSpikes](matlab:matlab.lang.internal.introspective.errorDocCallback('bc.qm.removeDuplicateSpikes', 'C:\Users\rylash\bombcell-main4\bombcell-main+bc+qm\removeDuplicateSpikes.m', 71)) ([line 71](matlab: opentoline('C:\Users\rylash\bombcell-main4\bombcell-main+bc+qm\removeDuplicateSpikes.m',71,0))) Error in [bc.qm.runAllQualityMetrics](matlab:matlab.lang.internal.introspective.errorDocCallback('bc.qm.runAllQualityMetrics', 'C:\Users\rylash\bombcell-main4\bombcell-main+bc+qm\runAllQualityMetrics.m', 95)) ([line 95](matlab: opentoline('C:\Users\rylash\bombcell-main4\bombcell-main+bc+qm\runAllQualityMetrics.m',95,0))) |
Hi Ryan, Is this with the same dataset as above?
|
Hi Julie! Check your email, I just sent over a couple of versions of bombcell and a sample file. Let me know if you have any issues getting access to the folders :) |
Great, thanks! I'll take a look at all of this Monday morning |
Hi Ryan, thanks for sending those over! I have taken a look and your dataset runs fine for me. I have not tried running with your bombcell versions. Could please double-check that you have the latest bombcell - I would recommend copying your parameter file somewhere safe and then completely deleting the bombcell folder and re-installing it. |
Hi Ryan how are things going? Let me know if there is anything I can help with :) |
Hi Julie! I was able to get bombcell to run correctly again and it works great! Currently, I'm trying to figure out how to run UnitMatch(and by proxy Bombcell) while incorporating the info.rhd meta file that is spit out when recording from Intan amplifiers. I have code to read in .rhd files, however, this likely will be more headache than it's worth trying to incorporate it. My initial thoughts are to just figure out a way to replace instances of reading the cbin files with rhd files or possibly creating copies of the info.rhd files and replace them with the format that can be read in by bombcell. Any thoughts/suggestions? |
Hi Julie!
I was wondering if you had any suggestions/recommendations for handling burst units with regards to the calculation of the percentage of missing spikes? Basically, most of our units are being mistakenly marked as MUA since amplitudes decay and the maxBin value is for the most part always equal to 1. I was thinking of adjusting to calculate bin size using a friedman-diaconis method but unsure of its utility in this scenario. Thoughts?
The text was updated successfully, but these errors were encountered: