mne.export.export_raw

mne.export.export_raw(fname, raw, fmt='auto', physical_range='auto', add_ch_type=False, verbose=None)[source]

Export Raw to external formats.

Supported formats:
  • EEGLAB (.set, uses eeglabio)

  • EDF (.edf, uses EDFlib-Python)

Warning

Since we are exporting to external formats, there’s no guarantee that all the info will be preserved in the external format. To save in native MNE format (.fif) without information loss, use mne.io.Raw.save() instead.

Parameters
fnamestr

Name of the output file.

rawinstance of Raw

The raw instance to export.

fmt‘auto’ | ‘eeglab’ | ‘edf’

Format of the export. Defaults to 'auto', which will infer the format from the filename extension. See supported formats above for more information.

physical_rangestr | tuple

The physical range of the data. If ‘auto’ (default), then it will infer the physical min and max from the data itself, taking the minimum and maximum values per channel type. If it is a 2-tuple of minimum and maximum limit, then those physical ranges will be used. Only used for exporting EDF files.

add_ch_typebool

Whether to incorporate the channel type into the signal label (e.g. whether to store channel “Fz” as “EEG Fz”). Only used for EDF format. Default is False.

verbosebool | str | int | None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). If used, it should be passed as a keyword-argument only.

Notes

For EEGLAB exports, channel locations are expanded to full EEGLAB format. For more details see eeglabio.utils.cart_to_eeglab().

For EDF exports, only channels measured in Volts are allowed; in MNE-Python this means channel types ‘eeg’, ‘ecog’, ‘seeg’, ‘emg’, ‘eog’, ‘ecg’, ‘dbs’, ‘bio’, and ‘misc’. ‘stim’ channels are dropped. Although this function supports storing channel types in the signal label (e.g. EEG Fz or MISC E), other software may not support this (optional) feature of the EDF standard.

If add_ch_type is True, then channel types are written based on what they are currently set in MNE-Python. One should double check that all their channels are set correctly. You can call raw.set_channel_types to set channel types.

In addition, EDF does not support storing a montage. You will need to store the montage separately and call raw.set_montage().