Hi Francois,
I have a question regarding importing an EDF with different sampling frequencies. In the image below, we can view the different sample frequencies in hdr.signal. First, to be sure, in brainstorm you can only import signals from one sample frequency, either type EEG or the signals corresponding to the first sample frequency?
Digging dipper in the function, “in _fread_edf” the calculation of the variable nTimes uses the first sample frequency (in this case 500Hz), and then the channel range is established (in this case [3,10], basically the EEG signals).
The first calculation of the variable nTimes is used to establish different inputs of the function “edf_read_epoch” and seems to be causing my issue. (Despite being recalculated at the beginning of the function).
Shouldn’t nTimes be computed after the channelsRange is established to base itself on the appropriate sample frequency from EEG signal ( in this case, 200Hz)?
Yes, Brainstorm can not handle channels from an EDF file with multiple sampling rates. When reviewing the raw EDF, the default sampling frequency is taken as the sampling frequency of the first EEG signal, and all the channels that have different sampling frequency are labelled as bad.
Yes, nTimes should be computed with the sampling frequency of the first good channel, which should correspond to the one of the first EEG channel.
Moreover, also iTimes need to be adjusted accordingly to the sampling frequency of the channel to be displayed. This would be useful for the cases when a signal different of EEG needs to be displayed. For example, in the data you shared, if you want to plot the EKG channel, this can be done by changing the EKG channel to good, then right-click on the Link to raw file > EKG > Display time series
It was causing a lot of trouble in reading the EDF annotations.
See the discussion at the end of the github commit for more information.
See this other thread: Importing. Index exceeds the number of array elements