mne.export.export_raw#
- mne.export.export_raw(fname, raw, fmt='auto', *, physical_range='auto', digital_range='auto', add_ch_type=False, overwrite=False, verbose=None)[source]#
Export Raw to external formats.
Supported formats:
Warning
Since we are exporting to external formats, there’s no guarantee that all the info will be preserved in the external format. See Notes for details.
Warning
When exporting
Rawwith annotations,raw.info["meas_date"]must be the same asraw.annotations.orig_time. This guarantees that the annotations are in the same reference frame as the samples. WhenRaw.first_timeis not zero (e.g., after cropping), the onsets are automatically corrected so that onsets are always relative to the first sample.- Parameters:
- fname
str Name of the output file.
- rawinstance of
Raw The raw instance to export.
- fmt‘auto’ | ‘brainvision’ | ‘edf’ | ‘eeglab’
Format of the export. Defaults to
'auto', which will infer the format from the filename extension. See supported formats above for more information.- physical_range
str|tuple The physical range of the data. If ‘auto’ (default), the physical range is inferred from the data: if the data came from and EDF/BDF/GDF file, the physical range of the original file will be preserved (with a warning if clipping will occur). If the data did not originate from an EDF/BDF/GDF file,
"auto"will set the physical range as the minimum and maximum values per channel type. If'channelwise', the range will be defined per channel. If a tuple of minimum and maximum, that manually-specified physical range will be used for all channels. Only used for exporting EDF files.- digital_range“auto” | “orig”
For EDF/BDF files, this controls the amplitude resolution of the signals. “auto” uses the maximum available (16-bit for EDF, 24-bit for BDF). If the
Rawobject was originally read from and EDF or BDF file, “orig” will use the digital range that was present in that file. ForRawobjects that did not originate from EDF/BDF files, “orig” falls back to the behavior of “auto”.New in v1.13.1.
- 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.- overwritebool
If True (default False), overwrite the destination file if it exists.
New in v0.24.1.
- verbosebool |
str|int|None Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- fname
Notes
New in v0.24.
Export to external format may not preserve all the information from the instance. To save in native MNE format (
.fif) without information loss, usemne.io.Raw.save()instead. Export does not apply projector(s). Unapplied projector(s) will be lost. Consider applying projector(s) before exporting withmne.io.Raw.apply_proj().For EEGLAB exports, channel locations are expanded to full EEGLAB format. For more details see
eeglabio.utils.cart_to_eeglab().Although this function supports storing channel types in the signal label (e.g.
EEG FzorMISC E), other software may not support this (optional) feature of the EDF standard.If
add_ch_typeis 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 callmne.io.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
mne.io.Raw.set_montage().The physical range of the signals is determined by signal type by default (
physical_range="auto"). However, if individual channel ranges vary significantly due to the presence of e.g. drifts/offsets/biases, settingphysical_range="channelwise"might be more appropriate. This will ensure a maximum resolution for each individual channel, but some tools might not be able to handle this appropriately (even though channel-wise ranges are covered by the EDF standard).