open-ephys / open-ephys-python-tools

Python code for interacting with the Open Ephys GUI
MIT License
29 stars 18 forks source link

Negative event timestamps #32

Closed MarinManuel closed 3 months ago

MarinManuel commented 3 months ago

Apologies if I am missing something obvious. I am analyzing a recording with a NPX 2.0 probe and signals recorded on a PXIe-6341 ADC. I have a sync pulse going to both and I am synchronizing the streams in Open Ephys GUI (both markers green during the recording). I am using Open Ephys GUI v0.6.7.

I am using SpikeInterface to analyze the data, but I am having some issues with the TTL markers that I send to the PXIe card not lining up with the events recorded in the continuous stream. to double check the times, I loaded the file using open-ephys-python-tools (v0.1.10) and I am seeing that some of the recordings have negative time stamps for the events, but not others

take for instance:

> print(session.recordnodes[0].recordings[3].events.head())

   line  sample_number    timestamp  processor_id  stream_index stream_name  \
0     1       46279507  1542.558200           100             1      ProbeA   
1     8       46289864  1542.558243           105             0   PXIe-6341   
2     8       46291857  1542.624569           105             0   PXIe-6341   
3     1       46281500  1542.624633           100             1      ProbeA   
4     8       46294143  1542.700862           105             0   PXIe-6341   

   state  
0      0  
1      0  
2      1  
3      1  
4      0  

> print(session.recordnodes[0].recordings[4].events.head())

   line  sample_number    timestamp  processor_id  stream_index stream_name  \
0     8         574448 -1567.460258           105             0   PXIe-6341   
1     1         573429 -1567.460200           100             1      ProbeA   
2     1         575568 -1567.389002           100             1      ProbeA   
3     8         576588 -1567.389002           105             0   PXIe-6341   
4     8         578552 -1567.323457           105             0   PXIe-6341   

   state  
0      1  
1      1  
2      0  
3      0  
4      1  

> print(session.recordnodes[0].recordings[5].events.head())

   line  sample_number    timestamp  processor_id  stream_index stream_name  \
0     8      117195544  2319.497431           105             0   PXIe-6341   
1     1      117182165  2319.497667           100             1      ProbeA   
2     8      117198476  2319.595154           105             0   PXIe-6341   
3     1      117185096  2319.595367           100             1      ProbeA   
4     1      117187675  2319.681333           100             1      ProbeA   

   state  
0      1  
1      1  
2      0  
3      0  
4      1  

Is that normal and I am missing a step to get the correct alignment of times?

jsiegle commented 3 months ago

We have also observed this in some of our recordings at the Allen Institute. We are still investigating why this is happening, but in all cases we've seen, the timestamps have been consistent across streams even when they are negative. So it's fine to shift all of the timestamps by the lowest value so they start at zero.

MarinManuel commented 3 months ago

I am having some more issues with this, but the problem seem to lie with the GUI rather than the python tools, so closing this