You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're running into an issue where the timestamps become unstable at the end of each of our recordings in the last second or so. This is crashing our spike sorting pipeline due the inconsistencies in the timestamps.
Is there a way to trim the end off a recording and all of the associated files (e.g. CH, ADC, AUX)?
Hi there -- it's probably easier to fix the timestamps. We just added the ability to ignore certain intervals when calculating timestamps offline, see instructions here and here. If you're using the Binary format, you can just overwrite the timestamps.npy files with the new values.
Also, what does your synchronization signal look like? Do you know what's causing the timestamps to become unstable at the end of the recording?
Thanks for the response. We're not looking to synchronize the data to any other sources currently. We just want to ignore the last second of the recording. In the image below, you can see the large jump in the sample interval time. We've discovered this in several of our data sets. Not sure what's causing it.
I see...so it's just one data stream from an acquisition board? Is there a discontinuity in the continuous data (CH, ADC, AUX) at the same sample at which the timestamps jump?
Ok, then trimming these files is the right way to go. What version of the GUI did you use to record this data?
It looks like there is one empty "record" (1024 samples) at the end of the file. Each record is 2070 bytes (documented here). So you can trim the files with the following code:
Thank you for your advice on how to trim the recording! (I'm a postdoc in the Lapish Lab.) I have a clarification/follow-up question.
We're feeding these data into spike interface for spike sorting and this weird discontinuity is causing an error (see our spike interface issue here: SpikeInterface/spikeinterface#2107). I see how you are cutting the data in the code you posted above, but I'm not sure how to carry these trimmed data into spike interface. Is there a way to save the trimmed open ephys data into a new set of .continuous files that can then be fed into spike interface? Thank you!
Hi Nick – the last line in the example above will write a new file with the trimmed data. I'd recommend first backing up the original files, and then writing a new set of trimmed files with the same names. Then you can load the new files exactly as you would the original ones.
Thank you for that clarification! I'm not super familiar with python and I missed that part of the code you posted.
We're happy to report that trimming the .continuous files in this way resolved the error in spike interface and allowed spike sorting to progress. We have one follow-up question, though. How will this trimming impact the other support files (all_channels.events, Continuous_Data.openephys, messages.events, and settings.xml)? Do we need to modify these files in any way to make sure they agree with the trimmed .continuous files?
Activity
jsiegle commentedon Oct 16, 2023
Hi there -- it's probably easier to fix the timestamps. We just added the ability to ignore certain intervals when calculating timestamps offline, see instructions here and here. If you're using the Binary format, you can just overwrite the
timestamps.npyfiles with the new values.Also, what does your synchronization signal look like? Do you know what's causing the timestamps to become unstable at the end of the recording?
LapishPersonal commentedon Oct 16, 2023
Thanks for the response. We're not looking to synchronize the data to any other sources currently. We just want to ignore the last second of the recording. In the image below, you can see the large jump in the sample interval time. We've discovered this in several of our data sets. Not sure what's causing it.
jsiegle commentedon Oct 16, 2023
I see...so it's just one data stream from an acquisition board? Is there a discontinuity in the continuous data (CH, ADC, AUX) at the same sample at which the timestamps jump?
LapishPersonal commentedon Oct 16, 2023
After the time of the "jump" in the timestamps the data are all zeros after that:

LapishPersonal commentedon Oct 16, 2023
Note that above is the voltage trace from 100_CH1.continuous
jsiegle commentedon Oct 16, 2023
Ok, then trimming these files is the right way to go. What version of the GUI did you use to record this data?
It looks like there is one empty "record" (1024 samples) at the end of the file. Each record is 2070 bytes (documented here). So you can trim the files with the following code:
Let me know if that works!
LapishPersonal commentedon Oct 16, 2023
Thanks for the code. I'll let you know if it works.
These data were acquired with Open Ephys Version 0.4.3.3.
Thanks again!
nmtimme commentedon Oct 16, 2023
Hi @jsiegle ,
Thank you for your advice on how to trim the recording! (I'm a postdoc in the Lapish Lab.) I have a clarification/follow-up question.
We're feeding these data into spike interface for spike sorting and this weird discontinuity is causing an error (see our spike interface issue here: SpikeInterface/spikeinterface#2107). I see how you are cutting the data in the code you posted above, but I'm not sure how to carry these trimmed data into spike interface. Is there a way to save the trimmed open ephys data into a new set of .continuous files that can then be fed into spike interface? Thank you!
~Nick
jsiegle commentedon Oct 17, 2023
Hi Nick – the last line in the example above will write a new file with the trimmed data. I'd recommend first backing up the original files, and then writing a new set of trimmed files with the same names. Then you can load the new files exactly as you would the original ones.
nmtimme commentedon Oct 17, 2023
Hi @jsiegle,
Thank you for that clarification! I'm not super familiar with python and I missed that part of the code you posted.
We're happy to report that trimming the .continuous files in this way resolved the error in spike interface and allowed spike sorting to progress. We have one follow-up question, though. How will this trimming impact the other support files (all_channels.events, Continuous_Data.openephys, messages.events, and settings.xml)? Do we need to modify these files in any way to make sure they agree with the trimmed .continuous files?
Thank you!
~Nick
jsiegle commentedon Oct 17, 2023
Given that you're only trimming the last 1024 samples (34 ms at 30 kHz), you don't need to worry about modifying any of these other files.
LapishPersonal commentedon Oct 18, 2023
@jsiegle this fix works well for us- thanks for the help.