Import Muse file into Brainstorm - Format request

Hi, i'm trying to import File from Muse into Brainstorm, i found that forum thread

And is quite confusing and long, and i think that adding the support for new file format will be easier and it will simplify the whole process.
Muse stream data to devices over udp (also muse monitor, an unofficial app for mobile that support the 2nd version of muse - 2016) and his own program can output proprietary file (.muse) but also other

EEGLAB has an import plugin that allow to import .csv file recorded with musemonitor (that is shown in the video in the other thread)

Brainstorm look amazing to read those signal but now is really hard to import correctly and witouth error auto-preparated data.

Is possible to have a plugin or something? thanks,

Mario

Hello,

We could add a support for the .csv files easily. I looked at the EEGLAB plugin, and it looks like a very simple file format. Please send me and example .csv file if you are interested in reading such files in Brainstorm.

About the .muse files: I don’t know what they are. If you have Matlab code for reading them, we could also add support for them in Brainstorm.

Cheers,
Francois

Hello Francois

Thanks for answering fast :slight_smile:

Those are 2 session lasting 320 second .csv from musemonitor

https://drive.google.com/open?id=1DlMGdJUxVzxmK4VGeekdyKxxsk1GfpD3
https://drive.google.com/open?id=1DlMGdJUxVzxmK4VGeekdyKxxsk1GfpD3

But EEGlab doesn’t import correctly sensor’s position, it usually “read” TP10 as a_TP10 so it must be corrected manually at every import, i don’t know if is musemonitor’s fault or just EEGlab bug

But there is also a more interesting aspect, that is the marked event during the registration, EEGlab isn’t able to import those…
Here is a short session with some random marks if you want to check

https://drive.google.com/open?id=1IHjPW63WANW93pgurzPQjAdr47CBmqCj

they also write on the last column of .csv if the headset is properly “sensing” or if is not, if there is some way to import those information it would be easier to clean the signal :slight_smile:

Thanks :slight_smile:

Hello

Sorry for the response delay.
I finally added an option to read the Muse CSV files you sent.
https://github.com/brainstorm-tools/brainstorm3/commit/bcf84eaa8070b8a9bb3b624fb0d0b4c18740eb1e#diff-c0728a0900c7577ff35a2ed6883ebd95

I did something completely different from the EEGLAB’s plugin. EEGLAB assumes that all samples are recorded linearly in the correct order, which is not true. The sampling is quite irregular and the samples are not even the correct order.
So I added a step of reinterpolation of the signals on a linear time axis. I’m not sure this was the best way of proceeding but I didn’t have any other idea.

Please update Brainstorm and try loading your files, make sure the shape of the signals, timing and event latencies are correct.

@jeremym: do you have any suggestion? If you still have some of your test files, could you try loading them in Brainstorm?

Thanks
Francois

No, sorry. I haven’t used the Muse in the past 2 years or so…

Hi, I have an error when I try to launch the muse.csv file. ''Timestamp not found'', my excel file is separated with '';'' and not '','', could it be the problem? I tried to changed it to '','' but my excel don't seem to have the option.

Thanks

Caroline

Can you please upload an example file somewhere are post the download link here?

Alternatively, you can try to fix the file reader yourself.
Edit file brainstorm3/toolbox/io/in_data_muse_csv.m, replace line 51 with:
Labels = strtrim(str_split(Labels, ',;'));
to enable splitting the values based on both the , and ; separator.

If this work for you, I could directly push this modification to the Brainstorm distribution.

https://drive.google.com/open?id=1DtKp02DTsDN44gaOqrnTd2kuStALyBXp

I will also try to do the modification you suggested!

Thank you

Caroline

it's working. Also need to change : RecMat = textscan(fid, strFormat, 'Delimiter', ',;'); on line 72 ! However, I think the units are not the right one, on the Muse website it's microV and not mV (http://developer.choosemuse.com/tools/windows-tools/available-data-muse-direct)

Thanks again
Caroline

Have you been opening/editing this file with Excel?
It contains a weird mix of commas (,) and dots (.) to separate the decimal and fractional parts of the values... Matlab cannot read values with commas easily. And no one does, these files should be reconverted.

If this is a file directly generated by the Muse software, this should be reported as a bug.
If someone after acquisition opened this file with Excel or any other program: tell that person to change the settings of the program to use only dots and no commas.

I will fix the Muse reader in Brainstorm to work with a mix of . and , but think about revising your acquisition procedure and/or report this as a bug to Muse customer support.

I ended up fixing more things in the reader:
Bug fixes: Muse EEG reader · brainstorm-tools/brainstorm3@a2b6312 · GitHub
Bug fix: Muse EEG reader (more fixes...) · brainstorm-tools/brainstorm3@eebf072 · GitHub

Let me know it works for all your recordings now

Hello
When i try to import a csv file generate by dedicated aplication i get the following error

the file I try to use is this: https://drive.google.com/file/d/1Vnnm9A6wQxSi7J2TssMu0cL97stTxKsf/view?usp=sharing
In application Brainstorm i use de following option
image

Please can you help ?
I don't understand from were is error since the comma is separator

Thank you very much
Valy

I think this bug was already recently:

Please update Brainstorm and try again.

Hi Francois, just found this older post - sorry for bringing it up again. I have used the Muse (1 and 2) for quite some while now but only now got into brainstorm and would love to use the Muse data with it. You mention the problem with the timeing information and that you tried to interpolate. I guess that the time in the csv is just the storing/processing time but not the time of recording the data point. Sampling time seems to be very precise (220 for muse 2014, 256 for later models). See also here. Thus i would suppose you can just ignore the time stamp and take 220/256 Hz as a given. Thank you, Ben

@bgodde We have no expertise with the Muse EEG systems, and I can't give any recommendation on whether to trust or not the timestamps in the .csv files.

I added an option to the Muse .csv reader, so that you have the choice to resample the signals or not.
Then this is up to you to decide what is the best approach, maybe after contacting the Muse company.

Update Brainstorm to get this fix:
https://github.com/brainstorm-tools/brainstorm3/commit/2070b86363862418b3e4afa51f0627339472884c

Great. Thank you!

Hi, I'm writing this to all those who where wondering too, whether "Resample" or "Ignore" would be the better option when importing Muse data recorded via the Mind-Monitor-App.

image

According to the Mind-Monitor Creator it would be "Ignore" and setting the sample rate to 256Hz.
image

Thanks to the Brainstorm-Team for implementing the "Ignore" option.


https://mind-monitor.com/forums/viewtopic.php?t=1447

best regards, Martin

Thanks for the info!