-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Can't load raw nirx data, due to encoding issue #7313
Comments
Do the |
All I can say is that I could not found any way to change the encoding of the |
Yeah, that's not unexpected. On which platform do you record? Is it a Windows machine? Are other platforms (macOS, Linux) also supported by the recording software? I could imagine that they just use the (default) platform encoding, which is UTF8 on macOS and Linux, and Latin-1 on Windows. If their encoding differs from platform to platform (or even depends on the actual locale), then it won't be easily possible to find a simple solution. One possible option is to make an educated guess with https://pypi.org/project/chardet/ to choose a suitable encoding when opening the file. |
I did the recording on a Windows platform. It seems that there is no alternative (MacOS, linux) NirStar distribution. What seems strange to me, is that only the |
The other text files are ASCII-encoded, which is a subset of Latin-1. This just means that they don't contain any special characters because the first 128 character encodings are identical in ASCII and Latin-1. |
So we have to ensure what format encoding is used by NirStar 15.2. Other users inputs would be great. If format encoding is varying from one version to another (15.0 vs 15.2, or windows 7 vs windows 10 ?), then, only a |
The safest solution would be to use |
Agreed let's just go with |
Thanks for fixing this so quickly @larsoner I checked files from multiple nirx machines that I have access to and they all have the same encoding as the test set I uploaded. I also can’t see any settings in nirstar that would change the encoding. I don’t know much about windows, but could the locale change the encoding? I am based in Australia, where are you @benoitvalery . It seems this is sorted now, but I’m just curious as to what might have caused this issue. |
The locale almost certainly affects the encoding. If you don't specify an encoding, the system default will be used. This is CP-1252 (~ Latin-1) for many western languages, but something else on a lot of other systems. Therefore, if a Windows user in e.g. Russia records nirx files, these will likely be encoded as CP-1251 (assuming that's the Windows default). We might get away if only characters with identical encodings are used, or decode the wrong characters. If this really happens, we can add an |
Sounds reasonable but let's wait until we have suitable test files to work on this |
I tested another older (recorded 8 monthes ago) dataset this morning and all the files, including the ./Motor-2019-07-19_001.dat -- text/plain; charset=us-ascii
./Motor-2019-07-19_001_config.txt -- text/plain; charset=us-ascii
./Motor-2019-07-19_001_probeInfo.mat -- application/octet-stream; charset=binary
./Motor-2019-07-19_001.avg -- application/octet-stream; charset=binary
./Motor-2019-07-19_001.tpl -- text/plain; charset=us-ascii
./Motor-2019-07-19_001.evt -- text/plain; charset=us-ascii
./Motor-2019-07-19_001.set -- text/plain; charset=us-ascii
./Motor-2019-07-19_001.hdr -- application/x-wine-extension-ini; charset=us-ascii
./Motor-2019-07-19_001.wl1 -- text/plain; charset=us-ascii
./Motor-2019-07-19_001.nirs -- application/octet-stream; charset=binary
./Motor-2019-07-19_001.inf -- text/plain; charset=us-ascii
./Motor-2019-07-19_001.wl2 -- text/plain; charset=us-ascii How is this possible ? |
This is possible because maybe you didn't include any special non-ASCII characters in the header, then Latin-1 is identical to ASCII. |
Sorry to reopen this but @benoitvalery I am trying to fix date reading for French files over in #7891 But I can't download the small file you linked above #7313 (comment). Are you able to reupload this small file somewhere so I can grab it and ensure I don't break the support we added here. Thanks |
Fantastic! Thanks so much @benoitvalery FYI: I don't think we have fully fixed the French date coding, so there is an issue here if you have any more feedback #8219 |
When I try to load NirX data with the
mne.io.read_raw_nirx
function, I'm facing encoding issue with the.hdr
file. For now, I'm solving this manually by converting the.hdr
toutf8
with a simple text file editor likegeany
.MWE
I recorded a test dataset (in a
test_github
folder), which is composed of the following files :These informations were obtained with the following command (linux) :
On python side, here is the code that I intend to use to load the data. I'm using the last version of MNE (0.20.dev0).
As mentioned here, I should obtain this kind of output :
But actually, the
read_raw_nirx
command raises the following Traceback :The test dataset is available here (
.zip
). It is a ten-seconds recording, fromNirStar 15.2
. It should contain noise only (headless record).The text was updated successfully, but these errors were encountered: