I’m looking into a way to describe an LSL stream fully using an MNE Info instead of a StreamInfo. One aspects I would like to retain is the unit provided in the description of the stream. For example: an EEG channel streamed in uVolts.
unit_mul is always 0 (no exponent) and does not seem to be used in MNE. To me, it looks like an attribute that describes the unit measurement; and is “ignored” since MNE expects data in a given unit for a given channel anyway.
cal seems to be different. Running a debugger through the data loading of a FIFF file, it impacts the loaded data with this coefficient, and not only the data description (it’s also stored in the info["chs"] field). Out of curiosity, do you know what this cal factor represents in MEGIN systems? Calibration for?
One way would be to make info['chs'][ii]['unit_mul'] be used/respected across MNE… but it’s not currently. This would be a lot of work.
In practice you could use cal and range as suggested by @agramfort:
But these would just tell you the relationship between your stream values and the SI unit for the channel. You’d need to put this in your own BaseRaw-derived subclass overriding _read_segment_file that would do the multiplication (this IIRC is what our FIF reader actually does). In other words, you couldn’t set this in info, put it in a RawArray with your data and expect it to work…
Ok, thank you, now I understand better what cal represents.
For my case, I will leave the responsibility to convert to SI in the hand of the user. My only goal is to attempt to read the (human-readable, non standardize) unit from the stream description, and provide it as an hint to the user that he needs to add a conversion step. Thus, the relation between the stream values and the SI unit is not that important.
Since 'unit_mul' is not used/respected across MNE, the risk to break any MNE-function on an object that uses a modified info with an altered 'unit_mul' seems low, which is great