Skip to content

Commit

Permalink
Add warning and more explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrnr committed Dec 11, 2024
1 parent 7cb3af8 commit 6644469
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions mne/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,12 @@ def resample(
def rescale(self, scale, *, verbose=None):
"""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
----------
scale : int | float | dict
Expand All @@ -1520,11 +1526,16 @@ def rescale(self, scale, *, verbose=None):
Examples
--------
To rescale all channels from µV to V, you can do::
A common use case for EEG data is to convert from µV to V, since many EE
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) # doctest: +SKIP
To rescale only EEG channels from µV to V, you can do::
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}) # doctest: +SKIP
"""
Expand Down

0 comments on commit 6644469

Please sign in to comment.