FR: Add "unit" parameter to get_data method for Epochs
See original GitHub issueUPDATE: https://github.com/mne-tools/mne-python/pull/9136 implements this for “raw” … we still need it for “epochs”
I often find myself doing things like this:
# get EEG data and scale to micro volts
# ntrials x nchannels x ntimes
eeg_data_uV = epochs.get_data() * 1e6
… just to do different kinds of analyses with custom functions.
I think we should add a "unit" parameter to .get_data():
"""
Parameters
----------
unit : str, one of ["nV, uV, mV, V"]
    The unit in which the data will be returned. Defaults to "V".
"""
This would make it more transparent for users what units the data are in they are receiving, and also offer a chance for customization.
I have a complete déjà vu writing up this issue, but I couldn’t find existing threads on this.
Issue Analytics
- State:
 - Created 3 years ago
 - Comments:16 (16 by maintainers)
 
Top Results From Across the Web
how to update a parameter (at each epoch based on the input ...
Suppose, at each epoch, lambda = lambda + valX. I am new with customization of keras layer. Can anyone help me to get...
Read more >mne-python/epochs.py at main - GitHub
The ``method`` parameter allows e.g. robust averaging. For example, one could do: >>> from scipy.stats import ...
Read more >IGH_DataAccess.GetData(T) Method (String, T)
Retrieve data from an input parameter during GH_Component.SolveInstance(). Namespace: Grasshopper.Kernel Assembly: Grasshopper (in Grasshopper.dll).
Read more >MNE : From raw data to epochs and evoked responses (ERF ...
This tutorial describes how to define epochs-of-interest (trials) from your recorded MEG-data, and how to apply the different preprocessing steps.
Read more >Scripting Guide - cosmos.esa.int
Creating aliases for class and function names . ... Printing the methods available for a variable in the console.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

In some sense all channels are data channels. I think the idea is that the “data channels” in MNE correspond mostly to the channels that record brain data.
I wouldn’t restrict it just to data channels. Any channels with units (which is most of them I think?) should be able to be modified by the
unitparameter.The benefits are (at least) twofold:
epochs.get_data() * 1e6is much more confusing thanepochs.get_data(unit=dict(eeg='uV'))--> where does the magic number1e6come from? They’d need to learn that in MNE all EEG data is represented in Volts, and that 1e6 scales to microVoltsunitwould certainly have cleared up the situation for meBut I agree that this is an issue that requires quite some work, so no worries if you’d rather work on something else.