Pipeline Description

General overview

general_pipeline.drawio.html

Data preparation

overview_diagram.html

Head surface scan generates: - _basic.txt - _points.txt - .fsn

MEGLab acquisition generates: - .con file - _NR.con file (after analysing noise reduction) - .mrk : an experiment will produce atleast 2 .mrk files, they contain the markers data

All data generated from KIT or OPM are saved on NYU Box Data access

Note

The link is invitation based only and not publicly available.

Installation

To use MEG-Pipeline, first install it using pip:

(.venv) $ pip install megpipeline

Reading the Raw Data

The kind parameter should be either "raw", "fif", or "fll".


#Import raw MEG files from the KIT machine
#Saves as .fif
#Lead author: Hadi Zaatiti


import mne

SUBJECTS_ID = ['Y0409', 'Y0440']

experiments = ['01','02']

for experiment in experiments:
    for subject in SUBJECTS_ID:

        DIR = '../MEG_DATA/' + subject + '/'
        MEG_DATA_DIR = DIR + subject + '_'+experiment+'.con'
        HSP_DIR = DIR + subject + '_basic.txt' #Head Shape DIR
        STYLUS_DIR = DIR + subject + '_points_no_grad.txt'
        MARKERS = [subject + '-1.mrk', subject + '-2.mrk', subject + '-3.mrk']

        MARKERS_DIRS = [DIR + marker_path for marker_path in MARKERS]


        RAW_DATA = mne.io.read_raw_kit(input_fname=MEG_DATA_DIR,
                            mrk= MARKERS_DIRS,
                            elp = STYLUS_DIR,
                            hsp = HSP_DIR)


        RAW_DATA.save('../output/' + subject + '/' + subject +'_'+experiment+'_meg.fif')

The above script will later be implemented as part of the following class MEGpipeline and function megpipeline.get_raw_data().

megpipeline.MEGpipeline.get_raw_data(self, file_name)

Return a list of random as strings.

Parameters:

kind (list[str] or None) – Optional “kind” .

Returns:

the converted data list.

Return type:

list[str]

The kind parameter should be either "raw", "fif", or "fll". Otherwise, megpipeline.get_raw_data() will raise an exception.

For example:

>>> import megpipeline
>>> megpipeline.get_raw_data()
['a', 'b', 'c']