[Mne_analysis] averaging in MNE
Matti Hamalainen
msh at nmr.mgh.harvard.edu
Tue Apr 14 06:44:45 EDT 2009
HI Gustavo,
On Apr 13, 2009, at 10:39 AM, Gustavo Sudre wrote:
> Hello,
>
> I have a couple questions regarding averaging MEG data with MNE and
> I was wondering if you could help me.
>
> 1) Is it possible to average a certain event only if something else
> happened after it? For example, let's say I have conditions 1 and 2.
> I want to average each condition, but only when the trigger happened
> and I received a response from the subject, which is coded as a 3 in
> the trigger line. In other words, average all the occurrences of 1
> or 2 only when there's a 3 after them. I wrote a script to do that
> in Matlab using the MNE toolbox, but since then lots of people have
> joined the lab and they are not very familiar with matlab, so I was
> wondering if there was a way to do such average within MNE, either
> by using the GUI or a combination of .ave and .eve files.
Unfortunately, there is no direct way to do conditional averaging in
mne_process_raw/mne_browse_raw (yet). However, the easiest way around
this is to output a text format event file a and manipulate this file
so that new event numbers are assigned to the events meeting the
requested combinations. I guess such a script could be even written in
Excel.
> 2) Something else my script does is to average conditions across
> different fif files. In the example above, I could have several fif
> files with such events, and the final .fif averaged file would
> represent the averages across all files. I imagine this is possible
> to do with the MNE software by using the global average parameter.
> Is that correct? Is there a different way to do it besides
> specifying a different .ave file for each of my raw .fif files? It's
> usually not a problem to do that for only a couple .fif files, but
> when there're about 10 different .fif files to be averaged, it
> starts to get a little cumbersome to keep track of all the .ave
> files, which look very similar except for the output parameter.
You can, indeed, make a grand average file using mne_process_raw. You
can use the --saveavetag option to create the output file names
automatically. Also, if mne_process_raw runs out of ave file name
names when processing the raw files, the last one available will be
used. If you use custom event files, you can specify them on the
command line (in version 2.6).
Let's assume
my.ave is your averaging file
my1_raw.fif and my2_raw.fif are your raw data files
my1.eve and my2.eve are your event files
You can do
mne_process_raw <other options> --raw my1_raw.fif --raw my2_raw.fif --
eve my1.eve --eve my2.eve --ave my.ave --saveavetag -ave --gave my-
gave.fif
This will produce the averages in my1-ave.fif and my2-ave.fif and log
files my1-ave.log and my2-ave.log independent of what is specifie in
my.ave. Also, the my1.eve and my2.eve override the event file
specification (if any) in my.ave.
Similarly, the --savecovtag option can be used to generate the noise-
covariance calculation output file names.
I hope this helps.
- Matti
-------------
Matti Hamalainen, Ph.D.
Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Building 149, 13th Street, Mailcode 149-2301
Charlestown, MA 02129-2060
USA
e-mail msh at nmr.mgh.harvard.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20090414/291ac729/attachment.html
More information about the Mne_analysis
mailing list