SpikeInterface / spikeinterface

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

Sortingcomponent visualization #1290

Open PicniCat opened 1 year ago

PicniCat commented 1 year ago

Hello,

When I was using spikeinterface.sortingcomponents, it was really hard to visualize some of the outcomes. This is because the functions, like peak_detection or peak_localization only return an ndarray instead of a sorting object. This makes it hard to be used in spikeinterface.widgets. Could you let some of the functions in spikeinterface.widgets like sw.plot_rasters to be compatible with ndarray objects instead of only sorting objects?

Also, it is hard to extract waveforms from the outcome of peak_detection. Are there any methods to manually pack up the outcome of spikeinterface.sortingcomponents into a sorting object?

Many thanks!

samuelgarcia commented 1 year ago

Hi. thanks for the feeback. Yes by design sortingcomponents return low level buffer generaly numpy array or numpy with multi fields.

All the end user machinery on top on sorting and waveformextractor do not work here. peaks are not spike yet because they do not have "label"

If you consider the channel as the label in the peak vector you can do stuff like this:

sorting = NumpySorting.from_times_labels(peaks['sample_ind'], peak['channel_ind'], sampling_rate)

But we plan to make some widgets on top of this sortingcomponents vector but at the moment the best to make standard matplotlib and check these examples https://spikeinterface.github.io/