braindecode.preprocessing.Rescale#
- class braindecode.preprocessing.Rescale(scalings, *, verbose=None)[source]#
Braindecode preprocessor wrapper for
rescale().Rescale channels.
Warning
MNE-Python assumes data are stored in SI base units. This function should typically only be used to fix an incorrect scaling factor in the data to get it to be in SI base units, otherwise unintended problems (e.g., incorrect source imaging results) and analysis errors can occur.
- Parameters:
- scalingsint | float | dict
The scaling factor(s) by which to multiply the data. If a float, the same scaling factor is applied to all channels (this works only if all channels are of the same type). If a dict, the keys must be valid channel types and the values the scaling factors to apply to the corresponding channels.
- 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.
- Returns:
- rawRaw
The raw object with rescaled data (modified in-place).
Examples
A common use case for EEG data is to convert from µV to V, since many EEG systems store data in µV, but MNE-Python expects the data to be in V. Therefore, the data needs to be rescaled by a factor of 1e-6. To rescale all channels from µV to V, you can do:
>>> raw.rescale(1e-6)
Note that the previous example only works if all channels are of the same type. If there are multiple channel types, you can pass a dict with the individual scaling factors. For example, to rescale only EEG channels, you can do:
>>> raw.rescale({"eeg": 1e-6})