-
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
API/WIP: new io module #542
Conversation
I have some changes to the kit module in #379 (to provide support for a GUI) and I'm afraid that rebasing will be hell - can we maybe merge those changes separately before changing the mne fiff namespace? |
On 01.04.2013, at 00:17, Christian Brodbeck notifications@github.com wrote:
|
I meant rebasing changes to files in the kit package, like the RawKIT class which I modified; if the corresponding file moved to a different location, will git know how to apply the changes? |
Ah, ok, got it. Good question. But anyways, I have two other PRs open and my On Mon, Apr 1, 2013 at 12:34 AM, Christian Brodbeck <
|
To add another point we should settle is how to populate the new io name space. |
thanks @dengemann for stimulating the discussion on this front. I think we should delay this PR after the next 0.6 release so we first merge I feel it's going to be a nightmare to avoid breaking people's code... |
On 03.04.2013, at 09:51, Alexandre Gramfort notifications@github.com wrote:
Btw. do we want to release 0.6 after all WIPs are merged?
yes, at least on the long run. I've already experimented with mass-deprecation, see fiff/init.py
|
I'll have a look when I find the time. It's great if you already have made |
yes, given the deprecation is complete + correct, tests should run. Let me Btw. what would you think about decomposing this into two PRs, one for the On Wed, Apr 3, 2013 at 9:49 PM, Alexandre Gramfort <notifications@github.com
|
Btw. old tests pass, and throw deprecation messages. denis-a-engemanns-macbook-air-2:mne-python denisaengemann$ nosetests mne/io/fiff/tests/test_raw.py
Test raw copying and appending combinations ... /Users/denisaengemann/python/mne-python/mne/utils.py:229: DeprecationWarning: Class Raw is deprecated; The fiff module will no longer be supported in v0.7. Please use the io module instead.
warnings.warn(msg, category=DeprecationWarning)
ok
Test raw rank estimation ... /Users/denisaengemann/python/mne-python/mne/utils.py:247: DeprecationWarning: Function pick_types is deprecated; The fiff module will no longer be supported in v0.7. Please use the io module instead.
warnings.warn(msg, category=DeprecationWarning)
ok
Test saving and loading raw data using multiple formats ... ok
Test loading multiple files simultaneously ... /Users/denisaengemann/python/mne-python/mne/utils.py:247: DeprecationWarning: Function concatenate_raws is deprecated; The fiff module will no longer be supported in v0.7. Please use the io module instead.
warnings.warn(msg, category=DeprecationWarning)
ok
Test reading/writing of bad channels ... ok
Test IO for raw data (Neuromag + CTF + gz) ... /Users/denisaengemann/python/mne-python/mne/utils.py:247: DeprecationWarning: Function pick_channels is deprecated; The fiff module will no longer be supported in v0.7. Please use the io module instead.
warnings.warn(msg, category=DeprecationWarning)
... |
... just some maintenance, rebasing + removing k v iterator names from fiff name space (consequence of automated deprecation via iteration over globals). |
@dengemann I've been thinking about modifying the MNE code so that the Raw class can support other file formats such as the one my group uses (ideally there would be an abstract Raw class that all file-format specific Raw classes inherit from). However, it looks like you might already have done some work in this branch. When I looked at it (via the Github interface), I couldn't find the IO module. Did you add the new module and folders to the commit? If so, I apologize, I'm still a bit new to git/github. |
@bburan-galenea Hi Brad, in fact this discussion here is about a planned io module. This PR is pending as we have too many open PRs at the moment this implies a major API change. Probably this won't be merged before mne-python 0.6 is out. In other words the io module only exists on my related branch which I proposed for merge here. However, I fear I have to disappoint you about the new functionality implied. This is basically just about changing names and name-spaces. Your proposal is certainly a good one, however this will demand many wo/man hours. This change would be a major one and setting up all tests, etc. will take even more time than just changing names and their hierarchy. |
@dengemann I work with two file formats. The first is a proprietary one created by MultiChannel Systems and is designed primarily for in vitro and in vivo multichannel electrode recording (arrays implanted in the brain). The second is a HDF5 file (just a lowpass-filtered, downsampled version of the MultiChannel Systems format to speed up data processing). We don't worry about things such as the inverse solution, sensor geometry, etc. But, we are interested in extracting the event-related LFP/EEG signal from our electrode array (and looking at coherence between electrode pairs). I've primarily been using the code in the time_frequency module, which (for the most part) does not require a Raw/Epoch class. However, many concepts that are currently coded in the Raw/Epoch class appear to be able to address some processing tasks I am currently working on (i.e. filtering, epoch extraction, artifact reject, merging multiple files, etc.). Rather than writing my own code to handle this, it occurred to me that it may make more sense to try to hook into the existing Raw/Epoch framework since it's pretty similar to what I had in mind (albeit a bit more complicated due to the nature of human imaging). Implementing the Raw API via duck-typing seems reasonable; however, it might be helpful to have a reference interface class (that just spells out the methods/attributes required for minimum functionality and throws a NotImplementedError for methods and assigns NotImplemented to all attributes). This shouldn't require any revision to the tests. Does this seem reasonable? |
@bburan-galenea this sounds like a reasonable request to me. I've been thinking about doing something similar for some ECoG data that I got my hands on, since mne-python has a lot of tools I'm familiar with. @agramfort @mluessi what do you think about adding a little bit of abstraction so that folks can implement their own |
@bburan-galenea thanks for the insights, your use case should not be to difficult to realize. We could think about a Raw mixin / ABC that makes the API commitments more explicit. Especially in your case it should not be difficult to meet these requirements, i.e., filling certain fields with dummy info while taking advantage of other methods / reading writing to fiff. |
@Eric89GXL yes. If we plan this carefully it might require changes in reasonable amounts. Besides a minimum API of methods / properties / attributes the reading / writing will certainly be the most challenging part. But if we can set some reasonable defaults for the ABC that should be doable. |
I think making it easier to integrate other file formats etc. is a good idea. Maybe we can something similar as in #382 which introduces a |
I like the idea of a BaseRaw object. We need to agree on what is the
I'll let you make this list more exhaustive. |
Maybe it would it make sense to define the interface of the base classes as the one that is used by MNE-Python internally. This would allow any derived class to be passed to functions provided by MNE-Python. |
Wasn't this what this proposal was about? |
In addition to what @agramfort mentioned, a |
@bburan-galenea you can already do https://github.com/mne-tools/mne-python/blob/master/examples/plot_read_and_write_raw_data.py So in theory, you could just write your own method to come up with |
@Eric89GXL That's great. Thanks! |
@bburan-galenea do you want to take a stab at enumerating the properties of the abstract class? If you want this to happen on a reasonable timeline, it might be good for you to push for it :) |
I figured that'd be the case :) It may not get done for a few weeks as I've got quite a few other things to take care of. I'll submit a PR once I have something stubbed out for review. |
Great. Once you're going to start working on it, it might be a good idea to post here before doing the coding, in case people have feedback on what should/shouldn't be included. Some people around here can be mighty picky... |
@agramfort now might be a good time to do it. Or directly after releasing 0.6 |
let's do it directly after. |
I think that's a wise idea, let's do it this way. |
Wait until #379 is merged please... because it adds changes to the kit... I've wanted to add some features but if io should be rearranged soon I can save those for later and get ready for review what I have... |
@christianmbrodbeck --- let me know about your schedule. I really would like to do this soonish before the big 0.7 coding begins. If you are afraid of a mess I'm happy to help you rebasing. |
ping @bburan-galenea still interested | have time? |
I'm still interested, but at the moment don't have the time to implement this. Sorry! If I get a chance to start working on this in earnest I'll let you guys know. |
@dengemann I have a feeling rebasing this will be nearly impossible, especially after my forward solution PR is merged. I say we close this for now, and once my last two PRs are merged (and the trans-gui one if that's 0.7), then deal with the import parentheticals, then do the IO change. WDYT? |
Keep it open, I'll take care of it then. |
I guess we can remove this from the 0.7 milestone, right? |
@mluessi I think this is the first thing to be done once 0.8 master is open for development. No reason to force this into 0.7 on my end. |
I'd say let's do this right after the release. Any objection? I don't want |
+1 for 0.8. |
Absolutely agreed, already changed this accordingly. I would suggest to discuss and plan the required changes carefully. We don't want to do such big API changes every 12 months ... |
To get the discussion going again.. I was just thinking that it may be better to only have a single class for
or
in both cases, Thoughts? |
@mluessi I like the functions instead of classes API but I'm not a fan of too deeply nested packages. This is btw. not far from the original proposal to have mne.io.read_raw_bti, mne.io.read_raw_fif. Number of tabs / keystrokes should be the same though ... |
I like @mluessi's proposal |
I'm fine with either. |
I'm not feeling strongly, I'm happy with Martin's proposal too. |
The advantage of @mluessi's proposal is that it facilitates separation of responsibilities (e.g. one person can primarily be responsible for FIFF, one for BTI, etc.) and having the code for each format in separate modules likely would minimize potential merge conflicts. |
to me this is 1st priority once py3k is working. |
Just to let you know I'm on it ;-) This addresses our discussion in #383 and the discussion we had while adding BTi and KIT support.
This is still WIP but the fiff module now is deprecated, and you can import mne + the new name space.
Before going on and changing the tests and the examples It would make sense to make sure we converge on the proposed change.
Let me briefly summarize how I wrapped up our discussion so far.