<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear all,<div class=""><br class=""></div><div class="">I have a problem with the timestamps of EEG data acquired in openvibe.</div><div class=""><br class=""></div><div class="">In short, the experiment consists of a stimulation via PsychoPy, an EEG connected to openvibe and a collection of the PsychoPy markers and the openvibe EEG data in the labstreaminglayer LSL recorder.</div><div class=""><br class=""></div><div class="">When reading the XDF-data from this, I get two data streams, one with the continuous EEG and one with the discontinuous markers. However, these two data streams are not aligned in time, as you can see in the stream information (see „first_timestamp“):</div><div class=""><br class=""></div><div class=""><div class="">name: 'openvibeSignal'</div><div class="">               type: 'signal'</div><div class="">      channel_count: '32'</div><div class="">      nominal_srate: '1000'</div><div class="">     channel_format: 'float32'</div><div class="">          source_id: '(0x4e97a72c, 0x01f9e774)'</div><div class="">            version: '1.1000000000000001'</div><div class="">         created_at: '235805.639196'</div><div class="">                uid: 'ec4655c1-9974-4253-875c-943ce39d8a94'</div><div class="">         session_id: 'default'</div><div class="">           hostname: 'DESKTOP-Q8JPPQS'</div><div class="">          v4address: [1×1 struct]</div><div class="">        v4data_port: '16572'</div><div class="">     v4service_port: '16572'</div><div class="">          v6address: [1×1 struct]</div><div class="">        v6data_port: '16572'</div><div class="">     v6service_port: '16572'</div><div class="">               desc: [1×1 struct]</div><div class="">      clock_offsets: [1×1 struct]</div><div class="">    first_timestamp: '13.47199995373376'</div><div class="">     last_timestamp: '2406.046991737028'</div><div class="">       sample_count: '2392575'</div><div class="">    effective_srate: 1.0000e+03</div></div><div class=""><br class=""></div><div class=""><div class="">name: 'trigger_stream'</div><div class="">               type: 'Markers'</div><div class="">      channel_count: '1'</div><div class="">      nominal_srate: '0'</div><div class="">     channel_format: 'string'</div><div class="">          source_id: 'trigger_stream1'</div><div class="">            version: '1.1000000000000001'</div><div class="">         created_at: '234884.27523130001'</div><div class="">                uid: 'c433e664-bf05-4e03-a5ac-2373c4484121'</div><div class="">         session_id: 'default'</div><div class="">           hostname: 'LAPTOP-U8UG7I7S'</div><div class="">          v4address: [1×1 struct]</div><div class="">        v4data_port: '16572'</div><div class="">     v4service_port: '16572'</div><div class="">          v6address: [1×1 struct]</div><div class="">        v6data_port: '16572'</div><div class="">     v6service_port: '16572'</div><div class="">               desc: [1×1 struct]</div><div class="">      clock_offsets: [1×1 struct]</div><div class="">    first_timestamp: '236044.9602928'</div><div class="">     last_timestamp: '237813.1065359'</div><div class="">       sample_count: ‚635'</div></div><div class=""><br class=""></div><div class="">Apparently, openvibe uses a different clock than LSL, but I could not find any reliable information on how to align the different clocks. </div><div class=""><br class=""></div><div class="">This is the code I used to read in the data - I used the xdf2fieldtrip-function as ft_preprocessing takes ages to read the raw XDF data.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">cfg = [];</div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(160, 32, 240);" class=""><span style="color: #000000" class="">cfg.dataset = </span>'sub-PEEL18_ses-S001_task-Default_run-001_eeg.xdf'<span style="color: #000000" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">xdfdata = xdf2fieldtrip(cfg.dataset);</div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">xdfdata.time{1} = xdfdata.time{1} + str2num(xdfdata.hdr.orig.clock_offsets(1).offset{1}.time);</div><p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34); min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34);" class=""><span style="color: #000000" class="">cfg=[]; </span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(160, 32, 240);" class=""><span style="color: #000000" class="">cfg.dataset=</span>'sub-PEEL18_ses-S001_task-Default_run-001_eeg.xdf'<span style="color: #000000" class="">; </span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">cfg.trialdef.eventtype = <span style="color: #a020f0" class="">'Markers'</span>;</div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34);" class=""><span style="color: #000000" class="">cfg.trialdef.prestim=1; </span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34);" class=""><span style="color: #000000" class="">cfg.trialdef.poststim=1; </span></div><p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34); min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34);" class=""><span style="color: #000000" class="">cfg=ft_definetrial(cfg); </span></div><p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34); min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">trldat = ft_redefinetrial(cfg,xdfdata);</div></div><div class=""><br class=""></div><div class="">As you can see, so far, I tried shifting the EEG timestamps by the clock_offset (which gets both streams in the same ballpark), but I’m not sure whether this is correct.</div><div class=""><br class=""></div><div class="">So, in summary: Has anyone ever tried to get openvibe data into FieldTrip and can anyone tell me how to align these two data streams?</div><div class=""><br class=""></div><div class="">Thanks a lot,</div><div class=""><br class=""></div><div class="">Julian</div><div class=""><br class=""></div></body></html>