[Mne_analysis] EEG Data Conversion

Denis-Alexander Engemann denis.engemann at gmail.com
Thu Aug 28 18:44:31 EDT 2014
Search archives:

Hello Isaiah,


2014-08-29 0:07 GMT+02:00 Isaiah C. Smith <Isaiah.C.Smith.17 at dartmouth.edu>:

>  Hello Denis,
>
>  I am trying to use the python that you posted to Github, and I have a
> few questions concerning the parameters. Am I correct in my assumptions
> below? And where do I place the file strings to be read?
>
>
you mean how to read the matfiles?

import scipy.io

mat = io.loadmat('mymatfile.mat')

but be careful, matfiles are often very nested. It can take while to access
everything that's in there.
It's usually represented as python dictionary and numpy structured array,
just to give you some buzz words you can google.

sfreq = 1e3   % sampling rate
>
>
yes


> ch_types = ['misc'] * 248    % "248" to “64” channels and ‘misc’ to ‘eeg'
>
>
>
> yes, put 'eeg' here and your channel number.


> ch_names = ['MISC {:03d}'.format(i + 1) for i in range(len(ch_type))]   % This one I think you can directly copy
>
>
yes


>
>
> info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)   % Directly copy
>
>
yes



>
>
> raw = mne.io.RawArray(data, info)   % data is the a N*M matrix (N is the number of channel, M is the number of timepoints
>
>
exactly


>
> raw.save('misc.fif')   % directly copy
>
>
yes, chose an approrpiate name, e.g. 'subject-1-raw.fif'


>
>  <cfg.mat>
>   <data.mat>
>   <elec.mat>
>
> https://drive.google.com/file/d/0B2VQnrnlkkKETl9jUDVtb3JyNlk/edit?usp=sharing
>
> https://drive.google.com/file/d/0B2VQnrnlkkKEWEJGT1JpaHd3SW8/edit?usp=sharing
>
> https://drive.google.com/file/d/0B2VQnrnlkkKEWms0S0ozdTgxLTg/edit?usp=sharing
>
>    These are the data set that I am working with. Do they correspond?
>
>
what do you mean by 'correspond'?

basically anything goes as long as you know how to access the actual data
arrays.


>  Sorry, I have been trying to do this for while. Once the data is
> changed, I can get the forward model and the gain matrix since I already
> have the bems?
>
>
yes. sounds like it. but you also need to add a montage / the channel
positions you might have measured using a polhemus device.

here's a pull request on that which I abandond. Will be back on this around
October.

https://github.com/mne-tools/mne-python/pull/1390

This code hopefully gives you an idea about what's to do for adding channel
posiitons.

https://github.com/dengemann/mne-python/blob/montage/mne/montages/montage.py#L148


HTH,
Denis


>  Thanks,
> Isaiah
>  On Aug 25, 2014, at 3:52 PM, Isaiah C. Smith <
> Isaiah.C.Smith.17 at dartmouth.edu> wrote:
>
>  Thanks Denis,
>
>  I will tell you how it goes.
>
>  Isaiah
>  On Aug 25, 2014, at 3:47 PM, Denis-Alexander Engemann <
> denis.engemann at gmail.com> wrote:
>
>  Dear Isaiah,
>
>  Here's an example of how to do it:
>
>  https://gist.github.com/dengemann/e9b45f2ff3e3380907d3
>
>  I hope this helps.
>
>  -Denis
>
> 2014-08-26 0:10 GMT+02:00 Denis A. Engemann <denis.engemann at gmail.com>:
>
>> Hi Isaiah,
>>
>> yes this is correct.
>> Take look at the documentation string to get an idea how to use it,
>> basically you pass the data matrix, the sampling rate, a list of channel
>> types, like ['eeg'] * 128 for 128 EEG channels and that's it for
>> constructing a Raw object whose .save method you can then use to create a
>> fiff file.
>>
>> Please let me know how it goes.
>>
>> HTH,
>> Denis
>>
>>
>>
>> > On 25 Aug 2014, at 23:53, "Isaiah C. Smith" <
>> Isaiah.C.Smith.17 at dartmouth.edu> wrote:
>> >
>> > Thanks Denis for the response,
>> >
>> > Do you mean that we can use Evoked Array to Convert the data into the
>> .fiff? We are able to extract the EEG data & electrode location data
>> information using matlab. Also, we know the sampling rate information. So
>> can we use some tools (e.g. mne.io.RawArray, mne.EpochsArray and mne) to
>> convert into fiff format?
>> >
>> > Isaiah
>> >
>> >> On Aug 25, 2014, at 12:19 PM, Denis A. Engemann <
>> denis.engemann at gmail.com> wrote:
>> >>
>> >> We have mne.io.RawArray, mne.EpochsArray and mne. EvokedArray for such
>> cases.
>> >> Once you can extract the data and some info on sampling rate it's
>> trivial to construct fiff compatible data-structures..
>> >> Unfortunately we still don't have an example for that in MNE-Python ...
>> >>
>> >> --Denis
>> >>
>> >>> On 25 Aug 2014, at 20:25, dgwakeman at gmail.com wrote:
>> >>>
>> >>> Hi Isaiah,
>> >>>
>> >>> You provided the suffixes of the files not the name of the file
>> types. The first thin I would try to do is look for a file converter or
>> reader. If you cannot find a converter for whatever file types these are,
>> but you are able to read the files with some toolbox: you could read in
>> those data files and replace all of the fields in the raw sample data set
>> with your data. This is something I only recommend for advanced users as
>> there are a lot of details you need to keep track of.
>> >>>
>> >>> HTH
>> >>> D
>> >>>
>> >>> Sent from my phone
>> >>>
>> >>>> On Aug 25, 2014, at 14:23, "Isaiah C. Smith" <
>> Isaiah.C.Smith.17 at dartmouth.edu> wrote:
>> >>>>
>> >>>> Hello Experts,
>> >>>>
>> >>>> I need to get the gain matrix using MNE. I have made my bem models,
>> but I need help with the EEG conversion data. Could someone help me through
>> this process so that I can view the matrix?
>> >>>>
>> >>>> These are the formats of the electrode location files that I have.
>> >>>> <Screen Shot 2014-08-24 at 12.33.11 PM.png>
>> >>>>
>> >>>>
>> >>>> And these are the formats of the EEG data that I have.
>> >>>>
>> >>>> <Screen Shot 2014-08-24 at 12.33.27 PM.png>
>> >>>>
>> >>>>
>> >>>> Thank you,
>> >>>> Isaiah Smith
>> >>>> _______________________________________________
>> >>>> Mne_analysis mailing list
>> >>>> Mne_analysis at nmr.mgh.harvard.edu
>> >>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>> >>>>
>> >>>>
>> >>>> The information in this e-mail is intended only for the person to
>> whom it is
>> >>>> addressed. If you believe this e-mail was sent to you in error and
>> the e-mail
>> >>>> contains patient information, please contact the Partners Compliance
>> HelpLine at
>> >>>> http://www.partners.org/complianceline . If the e-mail was sent to
>> you in error
>> >>>> but does not contain patient information, please contact the sender
>> and properly
>> >>>> dispose of the e-mail.
>> >>>
>> >>> _______________________________________________
>> >>> Mne_analysis mailing list
>> >>> Mne_analysis at nmr.mgh.harvard.edu
>> >>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>> >>
>> >> _______________________________________________
>> >> Mne_analysis mailing list
>> >> Mne_analysis at nmr.mgh.harvard.edu
>> >> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>> >
>> >
>> > _______________________________________________
>> > Mne_analysis mailing list
>> > Mne_analysis at nmr.mgh.harvard.edu
>> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>
>  _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
>  _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140829/b0c6e9ef/attachment.html 


More information about the Mne_analysis mailing list