Skip to content

MRG: Add units parameter to get_data for Raw#9136

Merged
hoechenberger merged 34 commits intomne-tools:mainfrom
HanBnrd:get-data-units-code-sprint
Mar 30, 2021
Merged

MRG: Add units parameter to get_data for Raw#9136
hoechenberger merged 34 commits intomne-tools:mainfrom
HanBnrd:get-data-units-code-sprint

Conversation

@HanBnrd
Copy link
Copy Markdown
Contributor

@HanBnrd HanBnrd commented Mar 17, 2021

Reference issue

Partially addresses #8473:

  • Add units to Raw.get_data
  • Add units to Epochs.get_data

What does this implement/fix?

Adds a units parameter to the get_data() function of base.py.

With units being either None, str or dict.

Additional information

Continuation of #8476.

@HanBnrd
Copy link
Copy Markdown
Contributor Author

HanBnrd commented Mar 18, 2021

Hi @sappelhoff @larsoner,

I ended up with an implementation in base.py, does this look good to you?
Should I copy paste the unit conversion bit to epochs.py?
Also I was wondering where I could write the tests for this? I didn't find any test_get_data().

@HanBnrd HanBnrd marked this pull request as ready for review March 18, 2021 17:52
@larsoner
Copy link
Copy Markdown
Member

I would do it in a new mne/io/tests/test_raw.py:test_get_data_units function.

@HanBnrd HanBnrd changed the title WIP: Add units parameter to get_data Add units parameter to get_data Mar 19, 2021
@HanBnrd HanBnrd changed the title Add units parameter to get_data Add units parameter to get_data for Raw Mar 20, 2021
@HanBnrd HanBnrd requested a review from agramfort March 27, 2021 21:20
Copy link
Copy Markdown
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

some minor comments, but provided that the CIs pass, I am +1 for merging. Thanks a lot @HanBnrd

Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
Copy link
Copy Markdown
Member

@hoechenberger hoechenberger left a comment

Choose a reason for hiding this comment

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

Few nitpicks, otherwise LGTM

HanBnrd and others added 2 commits March 28, 2021 11:06
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
@agramfort
Copy link
Copy Markdown
Member

agramfort commented Mar 28, 2021 via email

@hoechenberger
Copy link
Copy Markdown
Member

no but it should be tested as it's advertised as supported :)

Heh. Neat :) 😁

Copy link
Copy Markdown
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

+1 to MRG if CIs are green

@larsoner
Copy link
Copy Markdown
Member

Does it make sense to refactor mne/tests/test_defaults.py:test_si_units to make use of the new conversion code? I suspect there are some redundancies now

@larsoner
Copy link
Copy Markdown
Member

(also our CIs are failing on all PRs due to a matplotlib issue so feel free to ignore the raw plotting errors)

@HanBnrd HanBnrd requested a review from larsoner March 29, 2021 19:31
Copy link
Copy Markdown
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

LGTM +1 for merge assuming CIs are happy (aside from matplotlib failures)!

@HanBnrd
Copy link
Copy Markdown
Contributor Author

HanBnrd commented Mar 29, 2021

Does it make sense to refactor mne/tests/test_defaults.py:test_si_units to make use of the new conversion code? I suspect there are some redundancies now

@larsoner, I deleted a good chuck of it as most of the tests were already done in _get_scaling

@HanBnrd
Copy link
Copy Markdown
Contributor Author

HanBnrd commented Mar 29, 2021

LGTM +1 for merge assuming CIs are happy (aside from matplotlib failures)!

Should I merge main again once the CI is fixed?

@larsoner
Copy link
Copy Markdown
Member

In theory you shouldn't need to, if we just restart the CIs at that point they should get the fix because they build a merged-with-main version of the PR. But you could also merge with main in your branch and it would work without needing to manually restart

@hoechenberger hoechenberger merged commit 98fb5c2 into mne-tools:main Mar 30, 2021
@hoechenberger
Copy link
Copy Markdown
Member

Thank you, @HanBnrd!!

@HanBnrd HanBnrd deleted the get-data-units-code-sprint branch March 30, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants