-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Include helper functions from pybv #12450
Conversation
Qt acting up in some of the tests? I don't think these are related. |
I am fine either maintaining it here or in pybv. |
Hopefully #12452 takes care of the CI problems |
@cbrnr from bids-standard/pybv#120 (comment) you said
IIRC the idea is/was to keep as much export maintainance outside MNE-Python as possible. So the people most familiar with how to write BV files should maintain the BV stuff in pybv, those most familiar with EEGLAB in eeglabio, etc. At some point we decided this was the way to go after discussing the issue. Can you look back at the GitHub history and find the relevant discussions? |
I cannot find a discussion, only you mentioning that this is how it was decided 😄: I'm fine with the idea to outsource as much export maintenance as possible, but I think it shouldn't be too much. In the case of pybv, I'd argue that functions that exclusively prepare MNE data to feed into pybv should really live in MNE, and not in a private module in pybv. Also, the maintainers are also contributors to MNE, so it's not going to be a huge problem I think 😉. |
5121f6e
to
8d39c1f
Compare
Yeah unfortunately I think this goes against the current/existing plan, which I think can be articulated as roughly 1) keep stuff like this in external modules, but 2) modify MNE with new public methods if necessary information is not in public interfaces. I'd rather not change course -- I don't see a compelling reason to do so. |
Are you saying that we delegate completely internal MNE stuff to external modules?
OK, so you are suggesting to make the function |
I think all of this code belongs in pybv. The only thing we should do at the MNE end ideally is call |
Eric, I don't really get it. It looks like you view pybv as some MNE helper package, which it clearly isn't, at least to me. |
To summarize how (I think at least, it was some years ago!) we decided to go this "punt to other packages as much as possible" idea, the main problem we're trying to solve I'd frame as: end users want to take
I agree something toward either of these extremes would be the cleanest option from a conceptual standpoint, and that there are lots of options you could go for in between these them in terms of who is responsible for what. So how did we end up where I think we did, which is much more toward the first option? Practically, MNE-Python maintainers have finite, limited bandwidth and knowledge, so we have to make compromises. Adding exporting functionality makes our (already too big!) codebase bigger. The more stuff we can ask other modules and maintainers to do, the better from the perspective of the health of MNE-Python. Have a problem with Where some conceptual impurity comes in is perhaps with us supporting a |
I'm not arguing against our decision to outsource the actual exporting part to external packages. What I find strange is that only in the case of pybv, MNE is not converting MNE-specific objects to a format required for the export function. This is not the case for exporting to EEGLAB, EDF, and MFF. The first two formats also use external packages to do the heavy lifting (eeglabio and edfio), but MNE-Python includes some private functions that prepare the data to be compatible with the required arguments for these functions. I think EEGLAB export should do the same. Your argument of finite dev bandwidth is equally valid if we move these two private functions into MNE. There are very few (if any?) MNE maintainers who are comfortable with all provided functionality, and this has never been a problem. Also, all pybv maintainers are MNE contributors anyway, and I'd rather work on MNE-specific issues directly in MNE. And again, I am not disputing the idea of delegating the actual export to other packages. But I have a problem with including functions that are exclusively used by MNE-Python in pybv as a private module. |
4b4036a
to
025e81f
Compare
Having slept over it and based on the discussion, I switch from my "either way is fine" position to being in favor of maintaining the code that converts from mne RAW to inputs as required by pybv within MNE-Python, as is already done for a number of other formats. This is what @cbrnr suggests in this PR, and I think the "maintenance burden" is very low -- especially when exclusively public (well documented) functions of pybv are being used. As for testing, all io and sanity tests should happen in pybv, except for maybe one or two basic tests in mne-python, that make sure that the actual conversion looks fine. so +1 for this PR, and deleting the corresponding private module in pybv. |
I'm in favor of Eric, IMO, if the MNE-code used by I'm not very familiar with the export package and with who depends on who; but if the idea is that those packages are not only used by MNE-Python and thus should not depend on MNE, then I would turn |
@mscheltienne this is like asking pandas to include functions that convert |
No, but I would argue the larger package wins and we should try to simplify the codebase and maintenance of the larger package. In your example, |
Asking a non-MNE package to include MNE code to avoid shipping it with MNE itself has got to be the weirdest design decision we've made in a looong time 🥹🤦 Edit: No, actually the one where we recently re-implemented language support for keyword arguments ourselves is the uncontested winner. This one here is the runner-up though |
It sounds like @mscheltienne and I are out outvoted on this one by @cbrnr @sappelhoff and @hoechenberger , so I can live with moving in the direction suggested by @cbrnr . We should wait for @drammock to chime in though (next week most likely) before proceeding |
Setting aside for a moment the fact that many of the same individuals sit on both sides of this issue (looking at you @cbrnr 🙂), I think that as MNE devs we have no choice but to respect the decisions made by the maintainers of other packages in our ecosystem. When Sphinx devs make changes that break our docs build, we have basically 3 choices: (1) open an issue and/or PR to (persuade Sphinx devs to) change Sphinx; (2) change MNE to adapt to the change in Sphinx; or (3) abandon Sphinx and build our docs some other way. (not trying to pick on Sphinx --- just using it as an example that is unrelated to the particular changes discussed here). There's a gray area between code that clearly belongs in MNE and code that clearly belongs in format-specific read/write/manipulate packages. If the That said, I don't agree with the proposed direction here (now comes the "persuasion" part). I can see @cbrnr's point that we do a fair amount of output prep in If the desired end-state here is "cleaner separation of concerns" / "pybv only handles brainvision stuff, not MNE stuff" then I think there's a strong case that However, note that moving the code from pybv to MNE also creates the risk that users will end up in a state where they can't write BV format at all, if they have an older MNE version and a newer pybv version. The only way I can think to prevent this would be if |
I really understand your points, but in this case the better solution for me is still to include the preparation part within MNE. Here's a summary of my reasons:
You will probably still disagree, but as a developer in both projects, I think this is the best solution for both packages. Therefore, I would like to go ahead with this change and hope that you can live with it. |
I think there are good arguments on both sides. For me as a
I am personally fine with point 2. (and the reasons why it's beneficial for MNE-Python), but I understand Richard's and Clemens' points as well. If I were forced to vote, I'd reluctantly tend towards accepting the present PR. Regarding this point:
This risk will be minimal / non-existent due to the high overlap between mne an pybv devs and our awareness of this potential situation. |
Well, the
@sappelhoff is not worried because
... but after bids-standard/pybv#120 is merged and a new release of |
Then let's merge only this PR, and we wait until the next MNE release before merging the corresponding PR in pybv. |
That doesn't completely eliminate the risk, but does reduce it to a level I'm more comfortable with. Good idea. |
025e81f
to
2d2292d
Compare
Thanks @cbrnr ! |
I think it makes sense to maintain helper functions used to prepare input for
pybv
fromRaw
objects in MNE instead of pybv. See bids-standard/pybv#120.BTW, the test does not compare annotations in the original and exported/imported file, probably because our BrainVision reader does not support channel-specific markers yet?