sccn / xdf

BSD 2-Clause "Simplified" License
87 stars 34 forks source link

Issue with importing 2 streams #20

Closed rschmaelzle closed 6 years ago

rschmaelzle commented 6 years ago

Hello, I've been running into an issue repeatedly, but haven't been able to fix it. By now I've tried almost everything I could find (xdf for matlab, sigviewer, python, the reader in lsl, eeglab, various versions of xdf, and suggestions in lsl, eeglab, git issues), so this is my last resort: I am trying to load an XDF file that has 2 eeg datastreams in it. I can load the first, but not the second one. Here is the Xdffile and this is my code (on eeglab using the plugin, with Matlab2016b and eeglab13.6.5

 EEG = pop_loadxdf('/Users/Ralf/Desktop/2sigsTest2.xdf' , 'streamname', 'EEG115'); EEG.setname='t';
Now importing...done.
EEG checkset note for expert users: Noze direction now set to default +X in EEG.chanlocs and EEG.dipfit.
>> EEG = pop_loadxdf('/Users/Ralf/Desktop/2sigsTest2.xdf' , 'streamname', 'EEG114'); EEG.setname='t';
Now importing...Reference to non-existent field 'effective_srate'.

Error in eeg_load_xdf (line 66)
if args.effective_rate && isfinite(stream.info.effective_srate) && stream.info.effective_srate>0

I've also tried to load the stream with python, and can also access the data for the first one, but not for the second. I also tried to change the code or the file to overcome the effective_srate issue, but didn't succeed. I admit my understanding of the xdf format and the loading functions is limited, but I get the gist. The issue is that I don't fully understand if it might be an system issue (working on Mac), the functions have a bug, or the format/file might not be correct. Any help is appreciated.

Best, Ralf.

cboulay commented 6 years ago

I don't have Matlab handy so I can't test there. I opened the file with pyxdf. Both streams load, and appear to be formatted somewhat correctly, but EEG114 is devoid of any data. It has data chunks for the stream header, for clockoffsets, and the streamfooter, but it doesn't have any data chunks with actual samples.

Here is what I get in the console when I try to read it (note, this is using an updated version of pyxdf that I haven't pushed yet. I'm still working out one issue before I push it).

INFO:pyxdf.pyxdf:Importing XDF file /home/chad/Downloads/2sigsTest2.xdf...
DEBUG:pyxdf.pyxdf: Read tag: 1 at 8 bytes, length=58
DEBUG:pyxdf.pyxdf: Read tag: 2 at 71 bytes, length=4116, StreamId=1
DEBUG:pyxdf.pyxdf:  found stream EEG115
DEBUG:pyxdf.pyxdf: Read tag: 3 at 4192 bytes, length=323, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,3]
DEBUG:pyxdf.pyxdf: Read tag: 2 at 4520 bytes, length=4120, StreamId=2
DEBUG:pyxdf.pyxdf:  found stream EEG114
DEBUG:pyxdf.pyxdf: Read tag: 5 at 8642 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 4 at 8662 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 8686 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 8713 bytes, length=104381, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,994]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 113099 bytes, length=111731, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1064]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 224832 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 224856 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 224883 bytes, length=109316, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1041]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 334204 bytes, length=108896, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1037]
DEBUG:pyxdf.pyxdf: Read tag: 5 at 443102 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 3 at 443125 bytes, length=109211, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1040]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 552338 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 552362 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 552389 bytes, length=109631, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1044]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 662025 bytes, length=110051, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1048]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 772078 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 772102 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 772129 bytes, length=108056, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1029]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 880190 bytes, length=111731, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1064]
DEBUG:pyxdf.pyxdf: Read tag: 5 at 991923 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 4 at 991943 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 991967 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 991994 bytes, length=107426, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1023]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1099425 bytes, length=103436, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,985]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1202866 bytes, length=112781, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1074]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 1315649 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 1315673 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1315700 bytes, length=102281, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,974]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1417986 bytes, length=110156, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1049]
DEBUG:pyxdf.pyxdf: Read tag: 5 at 1528144 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 4 at 1528164 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 1528188 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1528215 bytes, length=109001, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1038]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1637221 bytes, length=103436, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,985]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1740662 bytes, length=114776, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1093]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 1855440 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 1855464 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1855491 bytes, length=107531, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1024]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 1963027 bytes, length=108266, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1031]
DEBUG:pyxdf.pyxdf: Read tag: 5 at 2071295 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2071315 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2071339 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2071366 bytes, length=111416, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1061]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2182787 bytes, length=109946, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1047]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2292735 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2292762 bytes, length=109841, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1046]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2402605 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2402632 bytes, length=108161, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1030]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2510798 bytes, length=108686, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1035]
DEBUG:pyxdf.pyxdf: Read tag: 5 at 2619486 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2619506 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2619530 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2619557 bytes, length=110471, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1052]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2730033 bytes, length=108581, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1034]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2838616 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 2838640 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2838667 bytes, length=111416, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1061]
DEBUG:pyxdf.pyxdf: Read tag: 3 at 2950088 bytes, length=108161, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1030]
DEBUG:pyxdf.pyxdf: Read tag: 5 at 3058251 bytes, length=18
DEBUG:pyxdf.pyxdf: Read tag: 3 at 3058274 bytes, length=110576, StreamId=1
DEBUG:pyxdf.pyxdf:  reading [24,1053]
DEBUG:pyxdf.pyxdf: Read tag: 4 at 3168852 bytes, length=22, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 4 at 3168876 bytes, length=22, StreamId=2
DEBUG:pyxdf.pyxdf: Read tag: 6 at 3168903 bytes, length=1046, StreamId=1
DEBUG:pyxdf.pyxdf: Read tag: 6 at 3169954 bytes, length=1023, StreamId=2
INFO:pyxdf.pyxdf:  reached end of file.
INFO:pyxdf.pyxdf:  performing clock synchronization...
INFO:pyxdf.pyxdf:  performing jitter removal...
Found 2 streams:
Stream 1: EEG114 - type EEG - uid 36938bd7-e6eb-4690-8623-44c5e40b3cbf - shape (24, 0) at 500 Hz (effective 0 Hz)
Stream 2: EEG115 - type EEG - uid 06d7ca32-a4bc-4f30-bc35-00dce1b44bbf - shape (24, 30089) at 500 Hz (effective 5.522854077200489e-07 Hz)
    Duration: 60.17652998027825 s
Done.
dmedine commented 6 years ago

I loaded it into Matlab without error using load_xdf and saw the same thing as Chadwick, i.e. an empty stream for EEG114.

The error is thrown by EEGLab. This has nothing to do with xdf or LSL per se. Your EEG114 stream has no effective sampling rate because that is just the inverse of the average time between the post-processed data points' timestamps. Your stream has no data whatsoever, so no such value can be calculated and subsequently the data structure holding all the information about the stream doesn't have this field.

What might be an LSL issue is the fact that one of your streams is empty. This could be a problem with the device itself, the LSL implementation by mbraintrain (which I doubt because I've never encountered an issue like this from a smarting device before, but one never knows), or a network configuration issue. Try recording one stream at a time and see if that helps you to isolate the issue.

You should also be aware of XDFBrowser (ftp://sccn.ucsd.edu/pub/software/LSL/Apps/XDFBrowser-1.10.zip) which is a utility to help peer inside of an xdf file.

On 8/4/2018 4:55 PM, rschmaelzle wrote:

Hello, I've been running into an issue repeatedly, but haven't been able to fix it. By now I've tried almost everything I could find (xdf for matlab, sigviewer, python, the reader in lsl, eeglab, various versions of xdf, and suggestions in lsl, eeglab, git issues), so this is my last resort: I am trying to load an XDF file that has 2 eeg datastreams in it. I can load the first, but not the second one. Here is the Xdffile https://drive.google.com/open?id=1i1ZhvjHms7tR8pnz76st2dYPNDOzpEDY and this is my code (on eeglab using the plugin, with Matlab2016b and eeglab13.6.5

|EEG = pop_loadxdf('/Users/Ralf/Desktop/2sigsTest2.xdf' , 'streamname', 'EEG115'); EEG.setname='t'; Now importing...done. EEG checkset note for expert users: Noze direction now set to default +X in EEG.chanlocs and EEG.dipfit. >> EEG = pop_loadxdf('/Users/Ralf/Desktop/2sigsTest2.xdf' , 'streamname', 'EEG114'); EEG.setname='t'; Now importing...Reference to non-existent field 'effective_srate'. Error in eeg_load_xdf (line 66) if args.effective_rate && isfinite(stream.info.effective_srate) && stream.info.effective_srate>0 |

I've also tried to load the stream with python, and can also access the data for the first one, but not for the second. I also tried to change the code or the file to overcome the effective_srate issue, but didn't succeed. I admit my understanding of the xdf format and the loading functions is limited, but I get the gist. The issue is that I don't fully understand if it might be an system issue (working on Mac), the functions have a bug, or the format/file might not be correct. Any help is appreciated.

Best, Ralf.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sccn/xdf/issues/20, or mute the thread https://github.com/notifications/unsubscribe-auth/ADch7u_oz9xZ8nmCB2uEt2UZdvJdtXzcks5uNbXSgaJpZM4VvBdB.

rschmaelzle commented 6 years ago

Hi dmedine and cboulay. thanks so much for the reply. both helped me a lot and I've lookked more into xdfbrowser and it is good to know that pyxdf is under active development. My issue has been tentatively resolved (the file recording did not record the stream, so the missing data is "normal") and your comments helped spot the reason. Thanks and best, r