spikeinterface icon indicating copy to clipboard operation
spikeinterface copied to clipboard

Adding new random spike selection methods

Open tayheau opened this issue 1 month ago • 8 comments

ref to this, Is maximum_rate intended as an ISI based sampling method, or does it simply favor neurons with higher firing rates ?

tayheau avatar Dec 09 '25 17:12 tayheau

@tayheau are you looking through TODO comments in the codebase?! You should join us for a maintainers meeting sometime!

With regard to the actual issue, I have no idea...

chrishalcrow avatar Dec 09 '25 17:12 chrishalcrow

This is because maybe one can have other clever ideas on the spikes you want to select, from every neurons, to get meaningful statistics. By percent would be a percentage of spikes instead of a fixzd number, maximum_rate is I think an absolute clip (given recording duration and spikes found)... But you are welcome to propose any method you want to select a subset of spikes, from units, to compute statistics!

yger avatar Dec 09 '25 17:12 yger

A silly question, should we implement a Strategy pattern for the different sampling algorithms or is it "overkill" and we should stay with the current format and a bunch of if-else statement ?

tayheau avatar Dec 15 '25 10:12 tayheau

A silly question, should we implement a Strategy pattern for the different sampling algorithms or is it "overkill" and we should stay with the current format and a bunch of if-else statement ?

I think that atm it might be an overkill. If we see in the future that we need to add many more and it makes it much more complicated, we can either switch to a Strategy pattern or to a dict[name: Callable] pattern (probably easier!)

Then each sampling function could simply be:

random_spike_indices = _sample_my_spikes(spikes, **kwargs)

alejoe91 avatar Dec 15 '25 12:12 alejoe91

I was thinking of having a base strategy class that also implement a Registry so that why indeed end up with a dict[name, Class] that is automaticly feeded with each defined strategy as a subclass of the base one.

tayheau avatar Dec 15 '25 12:12 tayheau

To be honest, here, I think this is an overkill, as @alejoe91 said. What would be the sampling scheme for such an anaylzer ? I.e. what would be the exotic way of selecting spikes to display Waveforms and compute Templates? The only one I can think of would be to sample spikes only during a certain period of time, but then we should better think about frame_slice() as in #4147 for the SortingAnalyzer. Otherwise, just random spikes or by_percent should be enough, don't you think?

yger avatar Dec 15 '25 13:12 yger

I was thinking of temporal bin sampling and maybe isi stratified sampling ? But yeah as you said, at the end of the road it's just for computing templates and plotting waveforms so definitly overkill.

tayheau avatar Dec 15 '25 13:12 tayheau

I think that another "interesting" option would be to sample spikes based on the actual distribution over the recording. Basically to make sure we keep have a good estimate of the temporal profile. @yger @tayheau what do you think?

alejoe91 avatar Dec 15 '25 14:12 alejoe91

@tayheau are you looking through TODO comments in the codebase?! You should join us for a maintainers meeting sometime!

With regard to the actual issue, I have no idea...

Hey! I want to join the meeting, but not sure where is it...

MGAMZ avatar Dec 19 '25 18:12 MGAMZ

@tayheau are you looking through TODO comments in the codebase?! You should join us for a maintainers meeting sometime! With regard to the actual issue, I have no idea...

Hey! I want to join the meeting, but not sure where is it...

Hi @MGAMZ

We have some rolling biweekly maintenance meetings (which will restart in January). You're welcome to join if you plan to keep contributing to the project! Can you send us an email so we can chat offline about this?

alejoe91 avatar Dec 23 '25 13:12 alejoe91