sccn / lsl_archived

Multi-modal time-synched data transmission over local network
242 stars 134 forks source link

load_xdf.m not working for EEG data #322

Closed wjbrainco closed 5 years ago

wjbrainco commented 5 years ago

I have been recording data using the Enobio and LSL. When I try to load the .xdf file using load_xdf.m I get the following error.

Error using chol Matrix must be positive definite.

Error in load_xdf>robust_fit (line 639)
L = sparse(chol(A'*A,'lower')); U = L';

Error in load_xdf (line 398)
                    mappings{r} = robust_fit([ones(idx(2)-idx(1)+1,1)
                    clock_times(idx(1):idx(2))']/opts.WinsorThreshold,
                    clock_values(idx(1):idx(2))'/opts.WinsorThreshold);

I tried to test the same function with the MouseButton App and the function works.

Attached are my .xdf files recorded by LSLrecorder

Files.zip

dmedine commented 5 years ago

The problem is not with load_xdf, it is a problem with your xdf file. Something appears to be wrong with how the time stamps are recorded. This line of code is dealing with clock synchronization, but typically if there is a problem there, there is also a problem with the data itself. Something to try is to call load_xdf.m with the arguments ('HandleClockSynchronization', false) and see what happens. You won't get this error (because the routine will get skipped) but you might get other problems.

There might be a problem with the Enobio app itself. I myself have never used it. I note that the readme says that it is untested which means Christian wrote it years ago according to the instructions in the API, but without ever having hardware on hand with which to test it.

On 7/24/2018 9:49 PM, wjbrainco wrote:

I have been recording data using the Enobio and LSL. When I try to load the .xdf file using load_xdf.m I get the following error.

Error using chol Matrix must be positive definite.

|Error in load_xdf>robust_fit (line 639) L = sparse(chol(A'*A,'lower')); U = L'; Error in load_xdf (line 398) mappings{r} = robust_fit([ones(idx(2)-idx(1)+1,1) clock_times(idx(1):idx(2))']/opts.WinsorThreshold, clock_values(idx(1):idx(2))'/opts.WinsorThreshold); |

I tried to test the same function with the MouseButton App and the function works.

Attached are my .xdf files recorded by LSLrecorder

Files.zip https://github.com/sccn/labstreaminglayer/files/2225112/Files.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sccn/labstreaminglayer/issues/322, or mute the thread https://github.com/notifications/unsubscribe-auth/ADch7twS3-1a-O1ys3Y9ZGFsJSGins1Lks5uJ3pkgaJpZM4VdYHp.

sahin-ozsoy commented 5 years ago

This can happen when there are no clock synchronization chunks in the xdf file. And in the EEGLAB e.t.c the default setting for HandleClockSynchronization in load_xdf() is true. Therefore, robust_fit function fails because there is no data.

VincentTD commented 5 years ago

I have the same problem with an xdf file created using Lab Recorder. When I use ('HandleClockSynchronization', false), Matlab crashes. I include the error message below. Does anyone have an idea how to include clock synchronization chunks when using Lab Recorder? Thanks!


   Segmentation violation detected at Mon Apr 15 18:06:41 2019

Abnormal termination: Segmentation violation

Register State (from fault): RAX = 0000000000000002 RBX = 0000000000000001 RCX = 90f10a471e8700c3 RDX = 000000012a934020 RSP = 000070001089f920 RBP = 000000013134e200 RSI = 000000013134eda0 RDI = 00007f8ad1cc9ea0

R8 = 000070001089f820 R9 = 0000000103b1de0c R10 = 0000000000005f2f R11 = 000000012a934020 R12 = 000070001089f9a0 R13 = 00000001286a1d25 R14 = 00000001280fa020 R15 = 000070001089f928

RIP = 00000001280fa020 RFL = 000070001089f920

CS = 00007f8ad1cc8ba0 FS = 000070001089f958 GS = 000070001089f960

Stack Trace (from fault): [ 0] 0x00000001038a3874 /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00030836 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+00000052 [ 1] 0x00000001038a72aa /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00045738 _ZN2fl4test17terminate_handledEv+00000906 [ 2] 0x00000001038a6cf5 /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00044277 _ZN2fl4diag13terminate_logEPKcPK17__darwin_ucontext+00000117 [ 3] 0x0000000103414d07 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00269575 _Z32mnRunPathDependentInitializationv+00003127 [ 4] 0x0000000103414ff8 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00270328 _Z32mnRunPathDependentInitializationv+00003880 [ 5] 0x000000010341281a /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00260122 mnFatalSignalHandler+00000298 [ 6] 0x00007fff6fc4ff5a /usr/lib/system/libsystem_platform.dylib+00008026 _sigtramp+00000026 [ 7] 0x00007f8ad1cd5d60 +00000000 [ 8] 0x000000012869fe6b /Applications/MATLAB_R2014a.app/bin/maci64/libmwmathlinalg.dylib+00405099 _Z19fullMldivideSolverTIdEP11mxArray_tagS1_S1_b+00000363 [ 9] 0x00000001286a6629 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmathlinalg.dylib+00431657 _Z16MatrixLeftDivideP11mxArraytagS0+00000185 [ 10] 0x00000001286a6993 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmathlinalg.dylib+00432531 _Z21mathlinalgMldivideFcniPP11mxArraytagiS1+00000211 [ 11] 0x00000001072e93e4 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_dispatcher.dylib+00078820 _ZN11Mfh_builtin11dispatch_mfEiPP11mxArraytagiS2+00000084 [ 12] 0x00000001072d868f /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_dispatcher.dylib+00009871 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArraytagiS2+00000335 [ 13] 0x00000001286a7a53 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmathlinalg.dylib+00436819 _Z30mathlinalgMldivideTransposeFcniPP11mxArraytagiS1+00003555 [ 14] 0x00000001286a8033 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmathlinalg.dylib+00438323 _Z21mathlinalgMrdivideFcniPP11mxArraytagiS1+00000291 [ 15] 0x00000001072e93e4 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_dispatcher.dylib+00078820 _ZN11Mfh_builtin11dispatch_mfEiPP11mxArraytagiS2+00000084 [ 16] 0x00000001072d868f /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_dispatcher.dylib+00009871 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArraytagiS2+00000335 [ 17] 0x0000000107ae796c /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+02128236 _Z35inJitCallMatlabFunctionPtrNoDestroyP13Mfh_MATLAB_fniiPP11mxArraytagiS3+00000124 [ 18] 0x0000000107a36d15 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+01404181 _ZN9accelImpl13MatfcnMxArrayEv+00000325 [ 19] 0x0000000107a23fa8 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+01327016 _ZN9accelImpl10ExecInlineEv+00000248 [ 20] 0x0000000107a23db8 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+01326520 _ZN9accelImpl4ExecEv+00000104 [ 21] 0x0000000107a23b6e /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+01325934 _ZNK9accelCode4CallEP13inMarshalTypePi+00000094 [ 22] 0x0000000107b526c8 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+02565832 _ZN5inJit17ExecuteHotSegmentEP15_inJitAccelInfoP7opcodesPiPl+00002488 [ 23] 0x0000000107984ab1 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00674481 inPcodeWalker+00000961 [ 24] 0x0000000107982097 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00663703 inInterPcode+00000871 [ 25] 0x0000000107983310 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00668432 _Z26inExecuteMFunctionOrScriptP6Mfh_mpb+00000896 [ 26] 0x00000001079f7f9b /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+01146779 _Z10inRunMfileiPP11mxArray_tagiS1_P6Mfh_mpP15inWorkSpace_tag+00003163 [ 27] 0x0000000107327a9a /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_dispatcher.dylib+00334490 _ZN8Mfh_file11dispatch_fhEiPP11mxArraytagiS2+00000602 [ 28] 0x00000001079d1b62 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00990050 _Z19inDispatchFromStackiPKcii+00001522 [ 29] 0x000000010795ca90 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00510608 inCallFcnFromReference+00000768 [ 30] 0x0000000107986291 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00680593 inPcodeWalker+00007073 [ 31] 0x0000000107982097 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00663703 inInterPcode+00000871 [ 32] 0x0000000107983310 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00668432 _Z26inExecuteMFunctionOrScriptP6Mfh_mpb+00000896 [ 33] 0x00000001079f7f9b /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+01146779 _Z10inRunMfileiPP11mxArray_tagiS1_P6Mfh_mpP15inWorkSpace_tag+00003163 [ 34] 0x0000000107327ac7 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_dispatcher.dylib+00334535 _ZN8Mfh_file11dispatch_fhEiPP11mxArraytagiS2+00000647 [ 35] 0x00000001079be95c /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00911708 _Z23inEvalPcodeHeaderToWordP15_memory_contextiPP11mxArray_tagP12_pcodeheaderP6Mfh_mpj+00000220 [ 36] 0x000000010797d5bb /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00644539 _Z25in_local_call_with_setjmpIN5boost3_bi6bind_tIvPFvP15_memory_contextPiPP11mxArray_tagP12_pcodeheaderjENS1_5list5INS1_5valueIS4_EENS0_3argILi1EEENSG_ILi2EEENSE_ISA_EENSE_IiEEEEEEEN6mlutil14cmddistributor17inExecutionStatusET_S5_S8_b+00000171 [ 37] 0x00000001079789d9 /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00625113 _Z12inEvalStringP15_memory_contextRKSbItSt11char_traitsItESaItEE8EvalTypeiPP11mxArray_tag12inDebugCheckP12_pcodeheaderPib+00002713 [ 38] 0x0000000107978f5d /Applications/MATLAB_R2014a.app/bin/maci64/libmwm_interpreter.dylib+00626525 _ZN12InterpBridge22EvalCmdWithLocalReturnERKSbItSt11char_traitsItESaItEEPibb+00000141 [ 39] 0x000000010726f8ad /Applications/MATLAB_R2014a.app/bin/maci64/libmwbridge.dylib+00051373 _Z28evalCommandWithLongjmpSafetyRKSbItSt11char_traitsItESaItEE+00000093 [ 40] 0x000000010726ff5d /Applications/MATLAB_R2014a.app/bin/maci64/libmwbridge.dylib+00053085 _Z8mnParserv+00000717 [ 41] 0x0000000103400d22 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00187682 _ZN11mcrInstance30mnParser_on_interpreter_threadEv+00000034 [ 42] 0x00000001033db5ba /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00034234 _ZN3mcr7runtime17InterpreterThread4Impl26invocation_request_handlerEl+00000058 [ 43] 0x0000000102fca395 /Applications/MATLAB_R2014a.app/bin/maci64/libmwservices.dylib+00127893 _ZN10eventqueue18UserEventQueueImpl5flushEv+00001269 [ 44] 0x00000001081df2d5 /Applications/MATLAB_R2014a.app/bin/maci64/libmwuix.dylib+00037589 _Z25isHandleUserEventCallbackPFvPvE+00000485 [ 45] 0x000000010306c565 /Applications/MATLAB_R2014a.app/bin/maci64/libmwservices.dylib+00791909 _Z21svWS_ProcessCallbacksv+00016261 [ 46] 0x0000000103067e42 /Applications/MATLAB_R2014a.app/bin/maci64/libmwservices.dylib+00773698 _Z25svWS_ProcessPendingEventsiib+00000834 [ 47] 0x0000000103067b4e /Applications/MATLAB_R2014a.app/bin/maci64/libmwservices.dylib+00772942 _Z25svWS_ProcessPendingEventsiib+00000078 [ 48] 0x00000001033db7ff /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00034815 _ZN3mcr7runtime17InterpreterThread4Impl14process_eventsERKN5boost10shared_ptrIS2_EE+00000095 [ 49] 0x00000001033dbb03 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00035587 _ZN3mcr7runtime17InterpreterThread4Impl3runERKN5boost10shared_ptrIS2_EEPNS2_12init_contextE+00000323 [ 50] 0x00000001033d6b68 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00015208 _Z26run_init_and_handle_eventsPv+00000056 [ 51] 0x00007fff6fc59661 /usr/lib/system/libsystem_pthread.dylib+00013921 _pthread_body+00000340 [ 52] 0x00007fff6fc5950d /usr/lib/system/libsystem_pthread.dylib+00013581 _pthread_body+00000000 [ 53] 0x00007fff6fc58bf9 /usr/lib/system/libsystem_pthread.dylib+00011257 thread_start+00000013

sahin-ozsoy commented 5 years ago

I have solved the issue by re-compiling the labrecorder and adding dummy clock offset chunks to the xdf file if there are none.

mgrivich commented 5 years ago

This issue is fixed in master (as sahin-ozsoy noted) and available in liblsl-1.13.0 at https://github.com/sccn/liblsl/releases and LabRecorder-1.13.0-b3 at https://github.com/labstreaminglayer/App-LabRecorder/releases.