SpikeInterface / spikeinterface

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

How to select only wideband channels in Plexon #3196

Open h-mayorquin opened 1 month ago

h-mayorquin commented 1 month ago

This question arose in neo but it has a clear solution in spikeinterface.

The problem is that neo has both wide band and filtered signals in the same stream but users usually want the stream band. I am writing the solution here for @AbhiSwamiUConn as this is a proper spikeinterface issue:

from pathlib import Path
from spikeinterface.extractors import read_plexon

file_path = f"your_plexon_file_path"
stream_id = "0" # This corresponds to wideband and filtered signals
recording = read_plexon(file_path=file_path, stream_id="0")
channel_ids = recording.get_channel_ids()
wide_band_channel_ids = [id for id in channel_ids if "WB"  in id]
wide_band_recording = recording.select_channels(channel_ids=wide_band_channel_ids)
wide_band_recording

This will give you the solution.

AbhiSwamiUConn commented 1 month ago

Thank you.

h-mayorquin commented 1 month ago

Note that you will need to update spikeinterface for a version where this is merge: https://github.com/SpikeInterface/spikeinterface/pull/3193

That right now is main but should be included in our next 0.101 that will be coming in a week or two.

h-mayorquin commented 3 weeks ago

Closing this as #3193 was merged.

h-mayorquin commented 3 weeks ago

Re-opening this as I have realized that stream-ids are not stable on neo:

https://github.com/NeuralEnsemble/python-neo/issues/1523