Skip to content

Analyzing MEG data: Example

Noam Peled edited this page Apr 6, 2017 · 6 revisions

In the following example, we'll run the full MEG analysis pipeline. The data is task data (MSIT). It was cleaned using nTSSS (native temporal signal space separation). We're planning to load the MEG and MRI data in the near future (morphed to a template brain).

Preprocessing

Most files will be read and created in the subject's MEG folder /links/meg/task-name/subject (meg-folder). The files needed for MMVT will be created in the subject's MMVT folder: /links/mmvt/mri-subject-name (mmvt-folder) The first step will be calculating the evoked responses in the sensors level. For that, you need to have two files in the meg-folder:

  1. Raw data file: meg-subject-name_msit_nTSSS-raw.fif
  2. Events file: meg-subject-name_msit_nTSSS_interference-eve.txt

Then, run the following command:

python -m src.preproc.meg -s meg-subject-name -m mri-subject-name -a laus250 -f calc_epochs,calc_evokes,read_sensors_layout -t MSIT --contrast interference --t_max 2 --t_min -0.5 --data_per_task True --read_events_from_file True --events_file_name {subject}_msit_nTSSS_interference-eve.txt --cleaning_method nTSSS

There is also an example written for MSIT task:

python -m src.preproc.examples.meg -s meg-subject-name -m mri-subject-name -f calc_msit -r calc_epochs,calc_evokes,read_sensors_layout

As a result, the following files will be created in the meg-folder:

  1. The raw info data: meg-subject-name_msit_nTSSS_interference-raw-info.pkl
  2. Epochs file: meg-subject-name_msit_nTSSS_interference-epo.fif
  3. Evokes file: meg-subject-name_msit_nTSSS_interference-ave.fif

And in the mmvt-folder/meg

  1. The evoked data in numpy format: meg_sensors_evoked_data.npy
  2. The evoked meta data (names, conditions and dt): meg_sensors_evoked_data_meta.npz
  3. The sensors positions (pos and names): meg_sensors_positions.npz

Importing the data into MMVT

To import the sensors evoked data, call the following command:

python -m src.mmvt_addon.scripts.import_meg_sensors -s mri-subject-name -a laus250