[FieldTrip] OpenVibe XDF

Julian Keil julian.keil at gmail.com
Tue Mar 16 19:01:07 CET 2021


Dear all,

I have a problem with the timestamps of EEG data acquired in openvibe.

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.

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“):

name: 'openvibeSignal'
               type: 'signal'
      channel_count: '32'
      nominal_srate: '1000'
     channel_format: 'float32'
          source_id: '(0x4e97a72c, 0x01f9e774)'
            version: '1.1000000000000001'
         created_at: '235805.639196'
                uid: 'ec4655c1-9974-4253-875c-943ce39d8a94'
         session_id: 'default'
           hostname: 'DESKTOP-Q8JPPQS'
          v4address: [1×1 struct]
        v4data_port: '16572'
     v4service_port: '16572'
          v6address: [1×1 struct]
        v6data_port: '16572'
     v6service_port: '16572'
               desc: [1×1 struct]
      clock_offsets: [1×1 struct]
    first_timestamp: '13.47199995373376'
     last_timestamp: '2406.046991737028'
       sample_count: '2392575'
    effective_srate: 1.0000e+03

name: 'trigger_stream'
               type: 'Markers'
      channel_count: '1'
      nominal_srate: '0'
     channel_format: 'string'
          source_id: 'trigger_stream1'
            version: '1.1000000000000001'
         created_at: '234884.27523130001'
                uid: 'c433e664-bf05-4e03-a5ac-2373c4484121'
         session_id: 'default'
           hostname: 'LAPTOP-U8UG7I7S'
          v4address: [1×1 struct]
        v4data_port: '16572'
     v4service_port: '16572'
          v6address: [1×1 struct]
        v6data_port: '16572'
     v6service_port: '16572'
               desc: [1×1 struct]
      clock_offsets: [1×1 struct]
    first_timestamp: '236044.9602928'
     last_timestamp: '237813.1065359'
       sample_count: ‚635'

Apparently, openvibe uses a different clock than LSL, but I could not find any reliable information on how to align the different clocks. 

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.

cfg = [];
cfg.dataset = 'sub-PEEL18_ses-S001_task-Default_run-001_eeg.xdf';
xdfdata = xdf2fieldtrip(cfg.dataset);
xdfdata.time{1} = xdfdata.time{1} + str2num(xdfdata.hdr.orig.clock_offsets(1).offset{1}.time);
 
cfg=[]; 
cfg.dataset='sub-PEEL18_ses-S001_task-Default_run-001_eeg.xdf'; 
cfg.trialdef.eventtype = 'Markers';
cfg.trialdef.prestim=1; 
cfg.trialdef.poststim=1; 
 
cfg=ft_definetrial(cfg); 
 
trldat = ft_redefinetrial(cfg,xdfdata);

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.

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?

Thanks a lot,

Julian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210316/0c9364c4/attachment.htm>


More information about the fieldtrip mailing list