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

DOC: impedances may be obtained for BrainVision #12861

Merged
merged 3 commits into from
Sep 19, 2024
Merged

Conversation

sappelhoff
Copy link
Member

This was not clear from the documentation before.

Copy link
Member

@adam2392 adam2392 left a comment

Choose a reason for hiding this comment

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

LGTM. Would it be worthwhile to mention that it will be None if nothing was read re impedances?

Copy link
Contributor

@cbrnr cbrnr left a comment

Choose a reason for hiding this comment

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

LGTM. I don't think mentioning that this attribute is None if no impedance values are available is necessary.

mne/io/brainvision/brainvision.py Outdated Show resolved Hide resolved
mne/io/brainvision/brainvision.py Outdated Show resolved Hide resolved
@cbrnr cbrnr enabled auto-merge (squash) September 18, 2024 15:08
@@ -63,6 +63,9 @@ class RawBrainVision(BaseRaw):
Notes
-----
If the BrainVision header file contains impedance measurements, these may be
accessed using ``raw.impedances`` after reading using this function.
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: I see that this attribute was discussed and added many years ago in #7974, but I thought that attributes that don't survive I/O roundtrips aren't supposed to be added?

e.g. #11825 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

I think we made an exception for BV at one point. But thinking about it I think I'd rather deprecate this param and show an example of how to use pybv directly to access this information.

Copy link
Member

@drammock drammock Sep 18, 2024

Choose a reason for hiding this comment

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

my guess is that .impedances is allowed to deviate for legacy reasons (probably either someone judged that it would break too much user code to remove it, or it's needed by downstream libraries).

edit: hadn't seen Eric's comment until after my review

Copy link
Member

Choose a reason for hiding this comment

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

Note that I actually stumble upon this while adding the ANT reader, and thus I added a similar ìmpedance attribute in the ANT reader. Maybe it should be removed as well and live in antio.

@@ -63,6 +63,9 @@ class RawBrainVision(BaseRaw):
Notes
-----
If the BrainVision header file contains impedance measurements, these may be
accessed using ``raw.impedances`` after reading using this function.
Copy link
Member

@drammock drammock Sep 18, 2024

Choose a reason for hiding this comment

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

my guess is that .impedances is allowed to deviate for legacy reasons (probably either someone judged that it would break too much user code to remove it, or it's needed by downstream libraries).

edit: hadn't seen Eric's comment until after my review

mne/io/brainvision/brainvision.py Outdated Show resolved Hide resolved
@sappelhoff
Copy link
Member Author

I think we made an exception for BV at one point. But thinking about it I think I'd rather deprecate this param and show an example of how to use pybv directly to access this information.

I agree in principle @larsoner and I'd be happy to take this functionality out of mne-python and give it a new home in pybv. The order of steps could be:

  1. merge this PR as an interim solution
  2. move functionality from mne to pybv, still support the attribute in mne but import pybv to get it
  3. deprecate the attribute in mne, and write a note in the BrainVision Raw docstr that pybv can be used to obtain impedances

Any other suggestions?

@larsoner
Copy link
Member

  1. merge this PR as an interim solution
  2. move functionality from mne to pybv, still support the attribute in mne but import pybv to get it
  3. deprecate the attribute in mne, and write a note in the BrainVision Raw docstr that pybv can be used to obtain impedances

I'm not sure there is a ton of value to (1) or (2) ideally (3) would make (1) and (2) obsolete. But if we don't get around to (3) for a while then (1) is useful in the interim (and done already!), so why not at least merge this.

Note that I actually stumble upon this while adding the ANT reader, and thus I added a similar ìmpedance attribute in the ANT reader. Maybe it should be removed as well and live in antio.

Yes! In fact this makes me think that we should have in a tutorial somewhere about how you can get additional information not provided by mne using these other modules. It could be organized by type of info like impedance, reference schemes, etc. (my preference) or by manufacturer. Can already show pybv and antio as mentioned but also probably mffpy. @sappelhoff or @mscheltienne would either one of you like to get the ball rolling?

@larsoner larsoner merged commit fa841cb into mne-tools:main Sep 19, 2024
5 checks passed
@larsoner
Copy link
Member

Thanks @sappelhoff !

@sappelhoff
Copy link
Member Author

Can already show pybv and antio as mentioned but also probably mffpy. @sappelhoff or @mscheltienne would either one of you like to get the ball rolling?

I am currently a bit short on time with a big backlog, so I will have to deprioritize this, but I have it on my list for pybv, at least. Would be happy if someone beat me to it though :-)

bids-standard/pybv#122

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.

7 participants