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

Error in bc_removeDuplicateSpikes. #253

Open
abisi opened this issue Dec 22, 2024 · 5 comments
Open

Error in bc_removeDuplicateSpikes. #253

abisi opened this issue Dec 22, 2024 · 5 comments

Comments

@abisi
Copy link

abisi commented Dec 22, 2024

Hi,

I recently got the following error:

The logical indices in position 1 contain a true value outside of the array bounds.

Error in bc_removeDuplicateSpikes (line 83)
        rawWaveformsFull = rawWaveformsFull(~emptyUnits_idx, :, :);

Error in bc_loadMetricsForGUI (line 57)
    bc_removeDuplicateSpikes(ephysData.spike_times_samples, ephysData.spike_templates, 
ephysData.template_amplitudes,...

Error in run_bombcell (line 70)
bc_loadMetricsForGUI;

I used to run bombcell without issues and this is new to me.
I imagine the rawWaveformsFull is empty after selection of the emptyUnits.

  • What are these emptyUnits?
  • In this recording, I saw quite a few clusters with one (or very few) spikes. Perhaps that is related.
  • Furthermore, have you assessed the effect of performing the removal of spike duplicates before and after running the kilosort implementation of that function? I currently use both.

Any idea what could cause this failure? Thanks!

Best,
Axel

@Julie-Fabre
Copy link
Owner

Julie-Fabre commented Dec 22, 2024

Hi Axel,

Thank you very mcuh for your message and sorry about that! This is probably due to a previous version of bombcell not handling well when users have manually curated in phy (did you do that on this dataset?) Are you using the latest version of bombcell? If you aren't, update and this problem should go away.

Regarding redundancy with kilosort's implementation: indeed the implementations are very similar and, now that kilosort have implemented their own version, you could do without bombcell's. You can set param.removeDuplicateSpikes = false; to disable this step. It should not affect your results. :)

@abisi
Copy link
Author

abisi commented Dec 22, 2024

Hi! Thanks for your quick answer. :)
Indeed, I wasn't using the latest version, I'll update this. I was surprised to see this change of behaviour, though.
I did not curate in Phy, however when checking in Phy I noticed 1/6th clusters had no bombcell label. First I thought that the error I got above was an in-between steps before all cluster got a new label, but then I realized at this stage they should all have a label. Maybe this is related too. These clusters shared nothing in particular.

I am using KS2 at this stage with duplicate spikes removal so I'll try to just disable the feature for now!

Thanks,
Axel

@Julie-Fabre
Copy link
Owner

Hi Axel,

Thanks for the information! That sounds good - running bombcell without removing the duplicate spikes (I don't think you need it).

On my end, I would like to check what happened and that all edge cases are covered. If you hadn't curated the dataset, it's a little odd that you got an error. Would you be able to send the following files of dataset that errored out:

  • spike_times.npy,
  • spike_clusters.npy,
  • spike_templates.npy,
  • templates.npy
  • (from bombcell) templates._bc_rawWaveforms.npy
  • (From bombcell, if you have it) templates._bc_rawWaveformPeakChannels.npy
    You can send them by email to [email protected]

Thanks a lot and happy holidays!

@Julie-Fabre
Copy link
Owner

Julie-Fabre commented Jan 7, 2025

Sorry for getting back to you late. I am taking a look now and it looks like your templates._bc_rawWaveforms.npy is not the size I would expect. It is 197 x timepoints x channels but based on your spikeTemplates/spikeClusters file it should be 226 (the number of unique clusters) x timepoints x channels. Are you sure this is the right file for this dataset?

Thanks a lot and happy new year!

@abisi
Copy link
Author

abisi commented Jan 7, 2025

Hello, no worries at all. Holiday time. 🙂
I was thinking this was the reason I got the error originally, but I will double check that what I sent is correct.

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

No branches or pull requests

2 participants