xdf-modules / xdf-Matlab

Matlab code for working with xdf files.
BSD 2-Clause "Simplified" License
11 stars 14 forks source link

Set effective_srate to 0 for empty streams when JitterRemoval is off #2

Closed cll008 closed 4 years ago

cll008 commented 5 years ago

Currently empty streams crash load_xdf when opts.HandleJitterRemoval = 0, since temp(k).time_stamps is empty and the index is out of range.

cboulay commented 5 years ago

Please also see https://github.com/sccn/xdf/pull/14

What does this change do when streams have no nominal_rate? (Sorry I don't have Matlab).

cll008 commented 5 years ago

Not sure how it affects other downstream functions, but this change does not affect eeg_load_xdf.m since load_xdf.m is called with default options, where opts.HandleJitterRemoval = 1. This change is only relevant when opts.HandleJitterRemoval = 0.

Regardless of the change, a stream without a nominal_srate should crash eeg_load_xdf.m somewhere here since nominal_srate is empty (and effective_srate == 0).

sccn/xdf#14 is actually better though since Jérémy added some warning messages.

cboulay commented 5 years ago

Do you mind testing those changes for me and seeing if it (a) works and (b) fixes your problem? I'd like to merge it but unfortunately I can't test. Actually merging in that repo won't work since we split up the repos, so a new pull request is needed here.

cll008 commented 5 years ago

I used xdfBrowser to change a 'healthy' stream's nominal_srate to 0. This file actually did not crash eeg_load_xdf.m since division by 0 in MATLAB results in Inf. eeg_checkset.m addresses nominal_srate ==0 here by changing the sampling rate to 1 and recomputing the timestamps.

I'm not sure the proper git workflow for copying someone's commit when a repo has been split...