Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

data and timestamp length unequal using load_open_ephys_binary #106

Open
crewl2 opened this issue Jun 1, 2023 · 4 comments
Open

data and timestamp length unequal using load_open_ephys_binary #106

crewl2 opened this issue Jun 1, 2023 · 4 comments

Comments

@crewl2
Copy link

crewl2 commented Jun 1, 2023

Trying to process binary.dat data using load_open_ephys_binary.

I'm given unequal timestamps and data (i.e. 35553218 ts and 36001201 data)

Additionally, I'm not sure what the timestamps actually mean as it doesn't represent time. It seems as though it might be an index, but the max index is larger than the max length of data.

Please clarify this for me. Thank you.

@medengineer
Copy link
Member

The timestamps are 64-bit integers that represent the sample numbers relative to the start of acquisition. If you are acquiring data at 40kHz and start recording 10 seconds after starting acquisition, the first timestamp written to disk would be 10 seconds x 40,000 samples / second = 400,000. If you then record for a total of 5 seconds, the final timestamp would be 400,000 + 5 * 40,000 = 600,000. This is why the final timestamp can be greater than the duration of the recording.

The unequal timestamps vs. data is due to using independent buffers to process the different data types (int64 and int16 respectively). The timestamps buffer can stop buffering faster than the data buffer at the end of recording resulting in a few extra data samples. If you have N total recorded timestamps at the end of recording and the first recorded timestamp is exactly the last recorded timestamp minus N, then the N recorded timestamps map directly to the first N samples recorded. If you have any gaps in the timestamps larger than 1 this suggests your computer was not able to keep up with the data processing during recording.

@crewl2
Copy link
Author

crewl2 commented Jun 6, 2023

Thank you. I think I understand the timestamps, however, how am I to match the length of data with the length of timestamps? Is the data also int64 or int16? I apologize for the questions, I'm just trying to preprocess my open ephys.dat file and have been struggling to do this via matlab. Any assistance would be appreciated. Thank you!

@medengineer
Copy link
Member

The timestamps are int64 and the data is int16. Depending on your recording device there will be a bitVolts value to convert the data from int16 to float representing voltage. To match the timestamps length with the data length, simply discard the extra data samples.

Which version of the GUI was used for these recordings and which device did you record from? (ex: Neuropixels, OpenEphys Acquisition board, etc.). If possible can you attach the settings.xml file from your recording?

@crewl2
Copy link
Author

crewl2 commented Jun 6, 2023

Open Ephys v0.5.4 recorded on an Intan Acquisition board.

settings.xml file https://drive.google.com/file/d/1K9TcWSIItE1wfXiAPB211nyhh23HKI7e/view?usp=sharing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants