Export data using the command line¶
The export plugin converts a data file to another format, from a terminal or a script. The general rules of the command line (options, exit code,
JSON jobs) are in Command line.
anywave --run export --input_file <file> --output_format <vhdr|edf|ades|matlab|fiff> --output_dir <folder>
Options of the export¶
| option | type | description/value |
|---|---|---|
| --run export | MANDATORY | name of the plugin |
| --output_format | optional | file format of the result: ades, edf, vhdr, matlab or fiff. Default: ades |
| --decimate_factor value | optional | divides the sampling rate by this integer. Default: no decimation |
This plugin also uses the following common options:
| option | type | description |
|---|---|---|
| --input_file | MANDATORY | the file to convert |
| --output_dir | optional | folder of the result. Created if it does not exist. Default: the folder of the input file |
| --output_file | optional | name of the result, without extension. Default: the name of the input file followed by _exported |
| --hp, --lp, --notch | optional | filters applied to the data before they are written |
| --use_markers, --skip_markers | optional | export only the data covered by these markers, or all but those |
| --marker_file | optional | the .mrk file to use |
| --montage_file | optional | export the channels of this montage |
| --pick_channels | optional | export only these channels |
| --create_montage | optional | build the montage on the fly |
| --skip_bad_channels | optional | false exports the bad channels too |
--output_prefix and --output_suffix have no effect on an export.
File formats¶
--output_format |
files created |
|---|---|
ades |
<name>.ades, <name>.dat and, when the data has markers, <name>.ades.mrk |
edf |
<name>.edf. The markers are stored in the file, as EDF+ annotations |
vhdr |
BrainVision: <name>.vhdr, <name>.eeg and, when the data has markers, <name>.vmrk |
matlab |
<name>.mat. Needs the MATLAB writer, which is not in every AnyWave package: when it is missing, AnyWave stops with an error and the exit code 255 (a job file that names matlab logs Plugin matlab format not found, writes nothing and returns a non zero exit code) |
fiff |
<name>.fif |
The format is case insensitive (EDF and edf are the same).
Montage, channels and data chunks¶
By default the channels are those of the montage saved with the data file (<file>.mtg), or the channels as recorded. Bad channels are left out.
To export a montage of your choice, use --montage_file; to export a few channels only, use --pick_channels "Fp1,Cz".
A bipolar derivation is written with a dash: --pick_channels "Fp1-Cz" exports the difference of the two channels, and the channel is named Fp1-Cz in the file.
You can export only some parts of the recording by marking them first. With the markers of a .mrk file (the one saved with the data, or the one given by --marker_file):
--use_markers goodexports only the data covered by the markers labelledgood;--skip_markers badexports everything except the data covered by the markers labelledbad.
Several labels are separated by commas: --use_markers good,verified.
Examples¶
Convert to ADES (the default format), in the same folder as the file. The result is recording_exported.ades and recording_exported.dat:
anywave --run export --input_file D:\data\eeg\recording.cnt
Convert to BrainVision, with a name and a folder of your choice:
anywave --run export --input_file D:\data\eeg\patient1.cnt --output_format vhdr --output_file patient1 --output_dir d:\converted
Creates patient1.vhdr, patient1.eeg and, when the data has markers, patient1.vmrk in d:\converted.
Convert to EDF and filter the data between 1 and 120 Hz:
anywave --run export --input_file D:\data\eeg\patient1.cnt --output_format edf --output_dir d:\converted --hp 1 --lp 120
Reduce the sampling rate. If patient1.cnt holds data sampled at 1024 Hz, the result is sampled at 512 Hz:
anywave --run export --input_file D:\data\eeg\patient1.cnt --output_format edf --output_dir d:\converted --decimate_factor 2
Export only the segments marked good of a marker file:
anywave --run export --input_file D:\data\eeg\patient1.cnt --marker_file D:\data\eeg\review.mrk --use_markers good --output_format edf --output_dir d:\converted