Initial processing¶
UML diagrams presenting the flow of the analysis for each module are available here: https://github.com/ANCPLabOldenburg/MEG-QC-code/tree/main/diagrams
- meg_qc.calculation.initial_meg_qc.Epoch_meg(epoching_params, data: Raw)[source]¶
Epoch MEG data based on the parameters provided in the config file.
- Parameters:
epoching_params (dict) – Dictionary with parameters for epoching.
data (mne.io.Raw) – MEG data to be epoch.
- Returns:
dict_epochs_mg – Dictionary with epochs for each channel type: mag, grad.
- Return type:
dict
- meg_qc.calculation.initial_meg_qc.get_all_config_params(config_file_name: str)[source]¶
Parse all the parameters from config and put into a python dictionary divided by sections. Parsing approach can be changed here, which will not affect working of other fucntions.
- Parameters:
config_file_name (str) – The name of the config file.
- Returns:
all_qc_params – A dictionary with all the parameters from the config file.
- Return type:
dict
- meg_qc.calculation.initial_meg_qc.get_internal_config_params(config_file_name: str)[source]¶
Parse all the parameters from config and put into a python dictionary divided by sections. Parsing approach can be changed here, which will not affect working of other fucntions. These are interanl parameters, NOT to be changed by the user.
- Parameters:
config_file_name (str) – The name of the config file.
- Returns:
internal_qc_params – A dictionary with all the parameters.
- Return type:
dict
- meg_qc.calculation.initial_meg_qc.initial_processing(default_settings: dict, filtering_settings: dict, epoching_params: dict, data_file: str)[source]¶
Here all the initial actions needed to analyse MEG data are done:
read fif file,
separate mags and grads names into 2 lists,
crop the data if needed,
filter and downsample the data,
epoch the data.
- Parameters:
default_settings (dict) – Dictionary with default settings for MEG QC.
filtering_settings (dict) – Dictionary with parameters for filtering.
epoching_params (dict) – Dictionary with parameters for epoching.
data_file (str) – Path to the fif file with MEG data.
- Returns:
dict_epochs_mg (dict) – Dictionary with epochs for each channel type: mag, grad.
chs_by_lobe (dict) – Dictionary with channel objects for each channel type: mag, grad. And by lobe. Each obj hold info about the channel name, lobe area and color code, locations and (in the future) pther info, like: if it has noise of any sort.
raw_crop_filtered (mne.io.Raw) – Filtered and cropped MEG data.
raw_crop_filtered_resampled (mne.io.Raw) – Filtered, cropped and resampled MEG data.
raw_cropped (mne.io.Raw) – Cropped MEG data.
raw (mne.io.Raw) – MEG data.
active_shielding_used (bool) – True if active shielding was used during recording.
epoching_str (str) – String with information about epoching.
- meg_qc.calculation.initial_meg_qc.sanity_check(m_or_g_chosen, channels_objs)[source]¶
Check if the channels which the user gave in config file to analize actually present in the data set.
- Parameters:
m_or_g_chosen (list) – List with channel types to analize: mag, grad. These are theones the user chose.
channels_objs (dict) – Dictionary with channel names for each channel type: mag, grad. These are the ones present in the data set.
- Returns:
channels_objs (dict) – Dictionary with channel objects for each channel type: mag, grad.
m_or_g_chosen (list) – List with channel types to analize: mag, grad.
m_or_g_skipped_str (str) – String with information about which channel types were skipped.