SpikeInterface / spikeinterface

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

error with OpenEphys recording with disabled probes #3539

Closed vigji closed 1 day ago

vigji commented 1 week ago

I have the following issue. I am recording with OpenEphys v0.7 signal from one probe. However, I have two probes connected in the PXIe board, of which one was disabled.

This edge case seem to break the read_openephys reader. I get the following error in probeinterface:

File "/.../code/spikeinterface/src/spikeinterface/extractors/neoextractors/openephys.py", line 350, in read_openephys
    recording = OpenEphysBinaryRecordingExtractor(folder_path, **kwargs)
  File "/.../code/spikeinterface/src/spikeinterface/extractors/neoextractors/openephys.py", line 192, in __init__
    probe = probeinterface.read_openephys(
  File "/.../miniconda3/envs/lab-env/lib/python3.10/site-packages/probeinterface/io.py", line 1597, in read_openephys
    name = probe_names_used[probe_idx]
IndexError: index 1 is out of bounds for axis 0 with size 1

Indeed, when reading the probes here:

    editor = neuropix_pxi.find("EDITOR")
    np_probes = editor.findall("NP_PROBE")

There is no check of whether they are enabled or not, even if disabled probes will not result in a stream and cause the indexing error.

If that is ok I would send a PR to probeinterface address this!

alejoe91 commented 1 day ago

Fixed by https://github.com/SpikeInterface/probeinterface/pull/308

Will be fixed in SI too when probeinterface is released