CINPLA / expipe-plugin-cinpla

Plugins for expipe command line interface
http://expipe-plugin-cinpla.readthedocs.io/en/latest/
GNU General Public License v3.0
1 stars 3 forks source link

loading leds gives bad timestamps #73

Open lepmik opened 1 month ago

lepmik commented 1 month ago

x1, y1, t1, x2, y2, t2, stop_time = dl.load_leds('/projects/ec109/maria/novel-env-nwb/actions/003-010821-6/data/main.nwb')
t1[:10]
array([3909.3781351, 3909.4032681, 3909.4258424, 3909.450175 ,
       3909.4737373, 3909.497492 , 3909.5247655, 3909.545199 ,
       3909.5699786, 3909.5924168])
``
alejoe91 commented 1 month ago

No that's correct. It uses the actual open ephys timestamps, which are not zeroed ;)

lepmik commented 1 month ago

We need to zero timestamps for both tracking and spike times, for spike times its essential to subtract the actual start time

alejoe91 commented 1 month ago

@lepmik you can use the nwbfile.session_start_time. All times in the NWB file (units, tracking, trials) are relative to this start time

lepmik commented 1 month ago

fixed in https://github.com/CINPLA/expipe-plugin-cinpla/commit/991f7fdeadcf806a17e6e194eb1c4410c947f0c9

lepmik commented 1 month ago

nwbfile.session_start_time is a datetime, using the .timestamp() seems to give wildly wrong times. Can you please provide the right format to subtract the session_start_time from the times obtained from spikeinterface?

alejoe91 commented 1 month ago

I see. So the session_start_time is taken from the action.datetime..

Then you should use the starting time of nwbfile["acquisition/EelctricalSeries"].starting_time

If you have the spikeinterface Recording, you can do: recording.get_times()[0]