Diff for "AnalyzingData/MNE_CovarianceMatrix" - Meg Wiki
location: Diff for "AnalyzingData/MNE_CovarianceMatrix"
Differences between revisions 3 and 4
Revision 3 as of 2010-06-09 16:32:15
Size: 1742
Editor: YaaraErez
Comment:
Revision 4 as of 2010-06-09 16:34:30
Size: 1874
Editor: YaaraErez
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Computing the Noise Covariance Matrix =

The noise covariance matrix is needed for the computation of the inverse operator.

Computing the Noise Covariance Matrix

The noise covariance matrix is needed for the computation of the inverse operator.

#


## Your variables:

path='<myrawMEGdatapath>'    # where your raw MEG fiff-files are

# 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`


for m in `seq 0 ${lastsubj}`
do
  echo " "
  echo " Computing covariance matrix for SUBJECT  ${subjects[m]}"
  echo " "

  mne_process_raw  \
                --raw ${path}/${subj_pre[m]}/${subj_dir[m]}/rawMEGfile_raw1.fif \
                --raw ${path}/${subj_pre[m]}/${subj_dir[m]}/rawMEGfile_raw2.fif \
                --raw ${path}/${subj_pre[m]}/${subj_dir[m]}/rawMEGfile_raw3.fif \
                --eventsout ${path}/${subj_pre[m]}/${subj_dir[m]}/rawMEGfile_raw1-eve.txt \
                --eventsout ${path}/${subj_pre[m]}/${subj_dir[m]}/rawMEGfile_raw2-eve.txt \
                --eventsout ${path}/${subj_pre[m]}/${subj_dir[m]}/rawMEGfile_raw3-eve.txt \             
                --projoff \
                --cov cov_desc1.cov \
                --cov cov_desc2.cov \
                --cov cov_desc3.cov \
                --savecovtag -cov \
                --gcov ${path}/${subj_pre[m]}/${subj_dir[m]}/covmat-cov.fif


done # subjects

where the covariance description files cov_desc?.cov are of the form

cov {
        gradReject      2000e-13
        magReject       3e-12
        eegReject       120e-6
        eogReject       150e-6

        def {
                event   1
                tmin    -0.2
                tmax    0
                basemin -0.2
                basemax 0.0
        }
        
}

If the parameters are the same for all input files, you only have to specify one description file. For more details and options see the MNE manual.

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