Diff for "AnalyzingData/MNE_Averaging" - Meg Wiki
location: Diff for "AnalyzingData/MNE_Averaging"
Differences between revisions 2 and 4 (spanning 2 versions)
Revision 2 as of 2010-06-10 11:53:13
Size: 1506
Editor: YaaraErez
Comment:
Revision 4 as of 2010-06-10 12:01:51
Size: 2431
Editor: YaaraErez
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
The following script is an example for a standard averaging procedure. Obviously, you may want to use different parameters - have a look at the manual for details and more options.

You should have processed your raw data using [http://imaging.mrc-cbu.cam.ac.uk/meg/Maxfilter Maxfilter].

The end result will be fiff-files with averages for each condition defined in the specification file (see below). They can be read into Matlab using fiff_read_evoked.

{{{
Line 58: Line 65:
}}}

The specification file YourSpecificationFile.ave should be of the form:

{{{
average {
# Rejection values
#
 gradReject 2000e-13
 magReject 3e-12
 eegReject 120e-6
 eogReject 150e-6
 logfile ave_logfile.txt

# Category specifications
#
 category {
  name "Cond1"
  event 1
  tmin -0.1
  tmax 1.0
  bmin -0.1
  bmax 0.0
 }
 category {
  name "Cond2"
  event 2
  tmin -0.1
  tmax 1.0
  bmin -0.1
  bmax 0.0
 }
}

}}}

The following script is an example for a standard averaging procedure. Obviously, you may want to use different parameters - have a look at the manual for details and more options.

You should have processed your raw data using [http://imaging.mrc-cbu.cam.ac.uk/meg/Maxfilter Maxfilter].

The end result will be fiff-files with averages for each condition defined in the specification file (see below). They can be read into Matlab using fiff_read_evoked.

#

## Your variables

datapath='<myMEGdatapath>'       # where your MEG fiff-files are

# path to event files
eventpath='/group/erp/data/olaf.hauk/Others/Miozzo/Stimuli/Event_Files/MNE'

# MEG IDs (your directory structure may differ)
subj_pre=(\
        'meg10_0001' \
        'meg10_0002' \
        'meg10_0003' \
        )

# MEG subdirectories (your directory structure may differ)      
subj_dir=(\
         '100001' \
         '100002' \
         '100003' \
        )
        

## Processing:

nsubjects=${#subjects[*]}
lastsubj=`expr $nsubjects - 1`


# REPORT number of files to be processed:

for m in `seq 0 ${lastsubj}`
do
  echo " "
  echo " Averaging SUBJECT  ${subjects[m]}"
  echo " "
 
  inpath=${path}'/'${subj_dir[m]}'/'${subjects[m]}
  
  echo ${inpath}

  mne_process_raw \
        --raw ${datapath}/${subj_dir[m]}/${subjects[m]}/yourrawMEGfile1.fif \
        --raw ${datapath}/${subj_dir[m]}/${subjects[m]}/yourrawMEGfile2.fif \
        --raw ${datapath}/${subj_dir[m]}/${subjects[m]}/yourrawMEGfile3.fif \
        --eventsout ${datapath}/${subj_dir[m]}/${subjects[m]}/yourrawMEGfile1-eve.txt \
        --eventsout ${datapath}/${subj_dir[m]}/${subjects[m]}/yourrawMEGfile2-eve.txt \
        --eventsout ${datapath}/${subj_dir[m]}/${subjects[m]}/yourrawMEGfile3-eve.txt \
        --ave YourSpecificationFile.ave \
        --gave ${datapath}/${subj_dir[m]}/${subjects[m]}/gave.fif \
        --saveavetag _avg \
        --highpass 0.1 \
        --projoff 

done # subjects

The specification file YourSpecificationFile.ave should be of the form:

average {
#       Rejection values
#
        gradReject      2000e-13
        magReject       3e-12
        eegReject       120e-6
        eogReject       150e-6
        logfile         ave_logfile.txt

#       Category specifications
#
        category {
                name    "Cond1"
                event   1
                tmin    -0.1
                tmax    1.0
                bmin    -0.1
                bmax    0.0
        }
        category {
                name    "Cond2"
                event   2
                tmin    -0.1
                tmax    1.0
                bmin    -0.1
                bmax    0.0
        }       
}

CbuMeg: AnalyzingData/MNE_Averaging (last edited 2013-03-08 10:02:27 by localhost)