sigviewer
sigviewer copied to clipboard
The order of the streams in XDF file seems to be random
I know this is not a SigViewer problem but I thought it's easier to discuss it here.
Also currently the way libxdf loads the streams don't follow the exact stream number (well, when I was writing libxdf I basically modeled libxdf on the load_xdf function in MatLab, and that's the approach in the MatLab code).
Is there a natural order of the streams? If so, it would be nice if libxdf returned the streams in that order.
It's rather complicated. First of all, labrecorder generated the streams order totally randomly: every time it records the same content, it will put the streams in different order

Then, each stream technically still has a stream ID. They are not in order, so you will see something like [4,7,2,6,1,8].
However, in the MatLab load_xdf, the way it assigns each stream number is depending on their position in the XDF file, rather than their stream ID.
streamid = fread(f,1,'uint32');
id = length(streams)+1;
idmap(streamid) = id;
Hm. So the order libxdf loads and stores the streams is not really random but actually follows the order in which the streams are stored in the XDF file. That's fine with me, but if we have time to spare later on it would certainly be nice to order the streams with respect to their IDs.
@Yida-Lin this is a libxdf issue right? If so, let's close this here and create a new issue in the libxdf repo. I think retaining the original stream IDs would be nice.