Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MNE for conversion Volts to uV #70

Merged
merged 5 commits into from
Jun 3, 2022
Merged

Use MNE for conversion Volts to uV #70

merged 5 commits into from
Jun 3, 2022

Conversation

raphaelvallat
Copy link
Owner

Closes #59

MNE automatically scales EEG (and EOG, EMG, ECG data) to Volts. YASA however expect the data to be in micro-Volts. The current behavior of YASA is to manually scale the data by 1e6 to convert from Volts to uV:

data = raw.get_data() * 1e6

With this PR, the conversion is now performed directly within the mne.Raw.get_data() function, using the units argument (added in MNE 0.23.0):

data = raw.get_data(units=dict(eeg="uV", emg="uV", eog="uV", ecg="uV"))

This converts the EEG, EMG, EOG and ECG data to uV, while leaving the other channel types in their original MNE units.

Can someone please review this PR before June 20, 2022?

PS: I'll update the changelog once #68 is merged.

Thank you,
Raphael

@raphaelvallat raphaelvallat added the enhancement 🚧 New feature or request label Jun 2, 2022
@raphaelvallat raphaelvallat self-assigned this Jun 2, 2022
Copy link
Collaborator

@remrama remrama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looked easy enough! I didn't run any code, but visually the swapping looks good. If you want me to run tests let me know and I will.

This is a nice adjustment, since the V / mV thing seemed to be a minor headache at times and this alleviates most (if not all) anxieties.

notebooks/08_bandpower.ipynb Show resolved Hide resolved
@raphaelvallat raphaelvallat merged commit a192252 into master Jun 3, 2022
@raphaelvallat raphaelvallat deleted the mne_units branch June 3, 2022 20:55
@raphaelvallat raphaelvallat restored the mne_units branch June 3, 2022 20:56
@raphaelvallat raphaelvallat mentioned this pull request Jun 19, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚧 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conversion to microvolts
2 participants