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

Selecting specific (non-random) spikes for waveform calculations #3568

Open
Sietse-k opened this issue Dec 4, 2024 Discussed in #3560 · 3 comments
Open

Selecting specific (non-random) spikes for waveform calculations #3568

Sietse-k opened this issue Dec 4, 2024 Discussed in #3560 · 3 comments
Labels
question General question regarding SI

Comments

@Sietse-k
Copy link

Sietse-k commented Dec 4, 2024

Discussed in #3560

Originally posted by Sietse-k December 2, 2024
Hi,

I want to compare the waveforms of units in different periods of the recording. Basically, do the waveforms of the same unit look similar during optogenic stimulation periods vs. outside these windows.

Instead of selecting spikes "randomly" in the recording, is there a way to specify which spikes you want to select (based on time intervals)? Or would I always need to slice the recording first into a smaller "sub recording" and then select all spikes within this sub recording, and then use this to compute the waveforms?

analyzer.compute(
    "random_spikes",
    method="uniform",
    max_spikes_per_unit=500,
)
analyzer.compute("waveforms", ms_before=1.0, ms_after=2.0)
analyzer.compute("templates", operators=["average", "median", "std"])

Any help would be much appreciated,

Sietse

@zm711
Copy link
Collaborator

zm711 commented Dec 4, 2024

Hey @Sietse-k,

currently the options are method="uniform" or method='all'. The plan was to extend these methods so users could choose other methods of selecting spikes but we haven't finished it yet. Maybe @samuelgarcia or @alejoe91 have a decent strategy you could try in the mean time, but this is on our todo list (just not sure how high up it is for now).

@zm711 zm711 added the question General question regarding SI label Dec 4, 2024
@alejoe91
Copy link
Member

alejoe91 commented Dec 4, 2024

@Sietse-k there are 2 strategies:

  1. Create multiple sorting objects filtering the spikes inside/outside of your intervales. You can do it easily with the sorting.to_spike_vector() function! Then create multiple analyzers and use all random spikes method.
  2. Create a single sorting object with to spike trains per unit. One woul be {unit_id}_inside, the second {unit_id}_outside. then you can create a single analyzer since templates and extensions are computed per unit.

Let me know if it's clear!!

@Sietse-k
Copy link
Author

Sietse-k commented Dec 4, 2024

Hi @zm711 & @alejoe91. Thanks a lot for the quick replies, I will try both strategies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question regarding SI
Projects
None yet
Development

No branches or pull requests

3 participants