Skip to content

OpenEphysRawIO unequal signal lengths after clipping #1336

Closed
@weiglszonja

Description

@weiglszonja

Raised in catalystneuro/tye-lab-to-nwb#40, we have ephys data in OpenEphys legacy format that could not be parsed with OpenEphysRawIO.

The traceback is:

Continuous files do not have aligned timestamps; clipping to make them aligned.
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1500, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/weian/Library/Mobile Documents/com~apple~CloudDocs/catalystneuro/tye-lab-to-nwb/src/tye_lab_to_nwb/neurotensin_valence/try_openephys.py", line 8, in <module>
    interface = OpenEphysRecordingInterface(
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/neuroconv/datainterfaces/ecephys/openephys/openephysdatainterface.py", line 45, in __new__
    return OpenEphysLegacyRecordingInterface(
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py", line 56, in __init__
    available_streams = self.get_stream_names(
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/neuroconv/datainterfaces/ecephys/openephys/openephyslegacydatainterface.py", line 17, in get_stream_names
    stream_names, _ = OpenEphysLegacyRecordingExtractor.get_streams(
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 71, in get_streams
    neo_reader = cls.get_neo_io_reader(cls.NeoRawIOClass, **neo_kwargs)
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 64, in get_neo_io_reader
    neo_reader.parse_header()
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/neo/rawio/baserawio.py", line 178, in parse_header
    self._parse_header()
  File "/Users/weian/anaconda3/envs/neuropixels39/lib/python3.9/site-packages/neo/rawio/openephysrawio.py", line 164, in _parse_header
    assert all(all_sigs_length[0] == e for e in all_sigs_length),\
AssertionError: Not all signals have the same length

@samuelgarcia I checked and the timestamps have equal length, its the signals that don't have equal length (they can be shorter and longer by 1024 'header_bytes').
@CodyCBakerPhD suggested a solution here to force equal signal length by clipping.

Environment:

  • OS: macOS
  • Python version: 3.9
  • Neo version: 0.13.0.dev0
  • NumPy version: 1.25.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions