SpikeInterface / spikeinterface

A Python-based module for creating flexible and robust spike sorting pipelines.
https://spikeinterface.readthedocs.io
MIT License
533 stars 187 forks source link

preprocessing and spykingcircus2 #2534

Closed sofiapuvogelvittini closed 9 months ago

sofiapuvogelvittini commented 9 months ago

Hi, thank you very much for this package! I am working with Maxwell data and sorting with spikeinterface , sorter_name="spykingcircus2". According to my understanding, spikyng circus should receive unfiltered data as input, becuase it will do the filtering steps internally. Therefore, I've skipped the filtering steps suggested in the SpikeInterface tutorial. However, I am doubting now if this is the correct approach when using spykingcircus2 inside spikeinterface.

I've encountered an issue when attempting to "extract waveforms" using si.extract_waveforms(). The exception message indicates that the recording is not filtered and advises using 'bandpass_filter()'. Do you have more specific guidelines or advice on this matter, especially when sorting with with spykingcircus2?

Thanks for your help!

zm711 commented 9 months ago

Howdy @sofiapuvogelvittini,

So when extracting waveforms you should extract on filtered data. So even if you don't filter the data for a particular sorter once you get the sorting data, you should do the extraction of the preprocessed recording instead (a typical workflow would be bandpass + CMR/CAR). If you really want the raw unfiltered data you would need to extract with allow_unfiltered=True instead.

Again a normal workflow would do extraction on preprocessed data, but it depends on your purposes if you want to not do this.

Does that make sense?

sofiapuvogelvittini commented 9 months ago

Than you very much for this information. Just to corroborate, Is spyking circus inside spikeinterface behaving as the same if we would run it separately? Specifically, does spyking circus filters the data when run inside spikeinterface? Thanks!

On Mon, Mar 4, 2024, 2:30 PM Zach McKenzie @.***> wrote:

Howdy @sofiapuvogelvittini https://github.com/sofiapuvogelvittini,

So when extracting waveforms you should extract on filtered data. So even if you don't filter the data for a particular sorter once you get the sorting data, you should do the extraction of the preprocessed recording instead (a typical workflow would be bandpass + CMR/CAR). If you really want the raw unfiltered data you would need to extract with allow_unfiltered=True instead.

Again a normal workflow would do extraction on preprocessed data, but it depends on your purposes if you want to not do this.

Does that make sense?

— Reply to this email directly, view it on GitHub https://github.com/SpikeInterface/spikeinterface/issues/2534#issuecomment-1976586564, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVQP3X5Q6PH5V4HK6EE7A3YWRZOZAVCNFSM6AAAAABEFDTBVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWGU4DMNJWGQ . You are receiving this because you were mentioned.Message ID: @.***>

zm711 commented 9 months ago

There are two spyking circuses. SC2 is built inside of SpikeInterface. It can't be run separately. SC1 is a separate package that can be run from SpikeInterface, but is separate. As far as filtering @yger created SC1 & SC2 so he can respond what filtering occurs internal to SC2.

yger commented 9 months ago

Hi. I'm on holidays so I ll be quick. Internally, SC2 does a highpass (150Hz), then a common reference, and a zscore if apply_preprocessing is set to True. But this does not modify the recording given to SC2 , so if you want to extract waveforms after, you need to redo a similar preprocessing. Bypassing the preprocessing if meant to be for users that would have special steps, such as moron correction for example.

sofiapuvogelvittini commented 9 months ago

Thanks yger for this explanation! enjoy the holidays

zm711 commented 9 months ago

Great we will close this then. But feel free to open new issues if new questions come up :)