I am having problems with the scaling of some channels in .edf files that I created in brainstorm. If I open these .edf-files with different eeg-viewers e.g. AnyWave. It looks like some channels are scaled in mV and others in µV. I am not sure what causes this problem. Do you know what causes these problems?
The unit and gain chosen per channel is based on its maximum value, and this can indeed change from channel per channel. This was chosen in order to keep as much precision as possible per channel due to the small precision of the EDF format. See relevant code segment here:
Whether this is an issue or not I do not know. I feel like a good viewer should scale them appropriately such that this is seamless to the user. But I am fine with changing this if you have a better solution in mind. @Francois what do you think?
after discussing it briefly with the Matthias Dümpelmann in Freiburg we suggest to change the script in brainstorm that creates the edf files so that all channels have the same scaling and the same unit. Is that possible?
Indeed, it would be more intuitive if all the EEG channels where scaled with the same units.
(but leave alone all the other channels)
But same scaling: no, this is not the way this file format is supposed to work.
@mheers Please report these display issues to the developers of the viewers you are using. Mixed units in a single EDF file are valid according to the EDF+ specification, and actually common in many recording contexts (eg. EMG+EEG, O2+EEG, eyetracker+EEG...). If Anywave cannot display this correctly, then Anywave needs to be fixed.
Note that exporting signals processed in Matlab (floating point double precision) back to EDF (integer 16bits) is not a good idea. You are enforcing a useless destructive resampling operation.
EDF is not a good exchange format for processed data, always prefer using the BrainVision .eeg format because it can store correctly floating point values, as recommended in the BIDS specifications for EEG and iEEG.