-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jooc: why are some values in stream meta-data lists of dicts and some just dicts? #77
Comments
I think it's just due to the _xml2dict implementation that treats every level like a list: Lines 490 to 496 in 5384490
The same thing happens whenever you use scipy.io.loadmat to load a matlab .mat file. THAT function, however, has an option that you can set #74 is a PR that I haven't had time to get back to but changes a lot of the pyxdf code. One of the things I do in that PR is flatten the stream header, exactly as you'd expect. Lines 759 to 762 in c037ae5
If you have time to test the PR then maybe we can get it merged in sooner. |
Let's hope I can bring this from "confusing" to "straightforward but entirely unsatisfying". Your
The answer from the XML enthusiast community is "Use an XML schema" (like this), that says "There has to be exactly one
From what I've seen, the Matlab XML reader is already at its limits with the simple task of converting an XML string to a dictionary, and even if we were to drop it, adding new elements to the schema that were previously not there will break code that assumed its in a dictionary (something like So, instead of a hugely complex mess where just getting a field from the info differs between all loaders, its simply "everythings a list of dicts, get used to sprinkling |
I find this rather confusing. For example, if I want to look at channel labels for a stream I need something like:
In what scenario would there ever be more than one label, desc, or (for that matter) list of channel dictionaries in info? It makes sense that 'channels' contains a list of 'channel' dicts, but that its value itself be a list of one list of 'channel' dicts.
Whenever I work with this I find myself constantly having to remind which values are lists and which are simply values. Especially confusing to me is the fact that nominal_srate is a list (again, there will only ever be one so why?) but effective_srate is not a list.
I am sure there is a perfectly good explanation for this but I can't work out what it could be.
The text was updated successfully, but these errors were encountered: