Skip to content

Passing a folder_path that ends with the Record Node does not correctly load timestamps #4496

@bparks13

Description

@bparks13

When loading data from the Open Ephys GUI (via spikeinterface.extractors.read_openephys), if I give it a folder path that ends with a record node (e.g., /path/to/Record Node 101) then it does not load the timestamps correctly. I noticed this when loading data from the ONIX Source plugin, as the data streams there are hardware timestamped. Instead of relying on a start time and extrapolating based on the assumed sampling frequency, some of the data streams must have their timestamps loaded explicitly to ensure the times are synchronized across streams. For a 32 minute recording, the difference between the two approaches led to a 3.6 second difference between the real timestamps and the assumed timestamps, which caused confusion during post-processing analysis.

The offending line is here:

recording_folder = Path(folder_path) / record_node

The current behavior is to create a recording_folder that becomes /path/to/Record Node 101/Record Node 101, which does not contain the requisite sample_numbers.npy file to correctly load the timestamps.

My proposed fix is simple, as seen below:

if not str(folder_path).endswith(record_node):
    recording_folder = Path(folder_path) / record_node
else:
    recording_folder = Path(folder_path)

I wanted to be more comprehensive and add a unit test to confirm that this works, now and in the future. However, as far as I know there are no existing datasets in the datalad project that contain hardware timestamped data, and I am not sure how to contribute a new file to datalad. I would be happy to provide an example recording session that contains the hardware timestamped data, so that a unit test can be added that loads the data and asserts that the end time (or total time) is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingextractorsRelated to extractors module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions