Using these plugins from the command line¶
The three plugins take the same parameters — only the --run name and, for EEG/sEEG, the extra PSD
band parameters, differ. None of them currently support --use_markers/--skip_markers to restrict
the analyzed portion of the file: the whole recording is always analyzed.
| option | type | description/value |
|---|---|---|
| --run "MEG Artifact Detector" / "EEG Artifact Detector" / "SEEG Artifact Detector" | MANDATORY | name of the plugin (quote it — the name contains spaces) |
| --window_length_s value | optional (default 5.0) | analysis window length, in seconds |
| --zscore_threshold value | optional (default 5.0) | robust z-score threshold for criteria 1/2/5 |
| --global_bad_ratio value | optional (default 0.8) | fraction of flagged windows above which a channel is treated as persistently bad |
| --neighbor_count value | optional (default 5, sEEG: 2) | number of neighbors used by criteria 2/3 |
| --psd_pair_zscore_threshold value | optional (default 3.0) | robust z-score threshold, criterion 3 |
| --psd_peak_zscore_threshold value | optional (default 3.0) | robust z-score threshold, criterion 4 |
| --psd_band_low_hz / --psd_band_high_hz value | optional, EEG/sEEG only (default 20/70) | criterion 3 broadband range, in Hz |
| --psd_peak_low_hz / --psd_peak_high_hz value | optional, EEG/sEEG only (default 2/100) | criterion 4 peak-search range, in Hz |
MEG only (these options are not declared by the EEG and sEEG plugins):
| option | type | description/value |
|---|---|---|
| --psd_array_zscore_threshold value | optional (default 2.0) | criterion 3 also requires the channel to stand out from the whole sensor array, not only from its own neighbors: robust z-score threshold of that extra condition. 0 switches it off |
| --lowfreq_array_zscore_threshold value | optional (default 4.0) | persistent low-frequency noise: the median 2–8 Hz level of the channel must be this many robust z-scores above the array (and above most of its neighbors). 0 switches the criterion off |
| --global_artifact_k value | optional (default 3.0) | global temporal criterion, for events that lift many channels together (head movement, muscle bursts, SQUID jumps): Tukey fence Q3 + k·IQR on the level of the whole array. 0 switches the criterion off |
| --global_artifact_margin_s value | optional (default 1.0) | margin added on each side of each global artifact segment, in seconds (from 0 to 30) |
See the shared methodology page for what each parameter actually controls.
This plugin also supports the following common options:
| option | type |
|---|---|
| --input_file | MANDATORY |
| --output_dir | optional |
| --output_file | optional |
Bad channels
By default the channels listed in the .bad sidecar of the file are not analyzed. Add --skip_bad_channels false to analyze them too,
for instance to review channels that are already marked bad.
Output¶
Each run writes one .mrk file to --output_dir (defaults to the input file's own directory)
containing the transient (criterion 5) markers, labeled "artifact". Channels flagged by any
criterion are colored red directly in the montage when run from the GUI; from the command line
there is no view to color, so check the log for the list of flagged channels instead.
Default output file name, if --output_file isn't given: <input file base name>_megartifact.mrk
/ _eegartifact.mrk / _seegartifact.mrk.
Examples¶
MEG, default parameters¶
anywave --run "MEG Artifact Detector" --input_file d:\data\myfile.meg4
EEG, custom analysis window and threshold¶
anywave --run "EEG Artifact Detector" --input_file d:\data\myfile.edf --window_length_s 4 --zscore_threshold 4.5
sEEG, custom output location¶
anywave --run "SEEG Artifact Detector" --input_file d:\data\myfile.trc --output_dir d:\results --output_file myfile_seeg_review.mrk