Calculation Module (CLI)#
Running the calculation module#
Now, we’re ready to run MEGqc! First, ensure that your environment is activated by checking the terminal prompt. It should look like this:
(<your_environment_name>) user_name:
Once the environment is activated, execute the script from the terminal and not from the command panel. The command requires 2 inputs:
inputdata: path to the root of your BIDS MEG dataset.
subs: ID code to the subject you want to analyze: - If you want more than one subject, the ID codes should be separated by a space. - If you want to analyze all the subjects of your dataset, you may write
all
. - If the subjects files are just placeholder, you will get the following ValueError: (“Unsupported file format or file does not exist. The pipeline works with CTF data directories and FIF files.”)
Your command line might look something like this:
run-megqc --inputdata /path/to/your/dataset/ --subs <ID>
For example, if you want to analyze only subject 009
of the dataset ds003483
, the command line might look like:
run-megqc --inputdata /path/to/ds003483/ --subs 009
For an alternative explanation, check run-megqc -h
on your terminal.
Settings#
The Setting allows you to customize your analysis. If you want a detailed explanation of all the settings available, visit the settings page.
Settings overview
The settings are grouped into categories:
The basic settings group allows you to select the channel types (
mag
orgrad
or both), and the specific metric to compute (e.g. STD, PSD or PTP). You can also apply your analysis to a smaller snippet of data (withdata_crop_tmin
anddata_crop_tmax
).The Filtering and Epoching groups of settings allow you to edit how the filtering and epoching should be applied (such as high-pass / low-pass cut-offs frequencies and time windows).
Metric-specfic settings: every metric includes their own editable group of settings, such as how many standard deviations from the mean to use as a threshold, the edge frequencies for PSD calculation, or the minimun PTP amplitude to count as a peak.
Default settings#
When you enter the command, a terminal-based GUI will prompt you with the question: Do you want to proceed with the default settings? (y/n)
. A hyperlink in the terminal will direct you to the setting explanation page, where each parameter is described with more detail.
If you enter y
, the program will use the default values for the parameters of each metric. The default values are designed to be compatible with a broad variety of datasets.
Customized Settings#
If you enter n
, you will be instructed to use the following command line to specify a path to your target directory
where a copy of the config file (setting.ini
) will be created:
get-megqc-config --target_directory /path/to/your/target/directory
Now you can open your copy of settings.ini
and adjust them. Once you are done, you can run MEGqc including the option config
and the path to your customized settings file
. Make sure to include “settings.ini” in the command line:
run-megqc --inputdata </path/to/your/dataset/> --subs 009 --config /path/to/modified/settings.ini
“There are already config files used for this data set”#
If you have already processed the dataset, MEGqc will be able to find the already used config file(s) and will prompt you if Do you want to use any of them again?
.
The terminal will display a numbered list of paths to previous config files used for the data set.
Then it will ask you to Enter the number of the config file you want to use, or press Enter to use the default one
.
Enter the corresponding number of the config file path you want to reuse. The terminal will ask you to confirm if you want to RERUN these subject with the same config parameters.
If you don’t want to use any previous config file, just press Enter to continue with your default setting.
Next section#
With the calculation module successfully executed, let’s explore how to generate the HTML report!