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
BaseRaw + io module #1003
Comments
@agramfort I'll take care of it over the holidays. |
I'm on it now |
@agramfort now that I'm in the middle of my edits it occurs to me how inconsistent it feels to have mne.Evoked, mne.Epochs but not mne.Raw., it really looks stupid next to each other in any example. |
well the meaning of io is raw io in my mind. the io module should contain only the BaseRaw and Raw* classes. |
@agramfort it would be strange to me to have a submodule named |
@agramfort I think we agree on this. We simply should expose the most frequently used callables in |
@Eric89GXL if we move all the read_* functions in io then we move many |
I have in mind to type: mne.io.read_raw_fif and picks = mne.pick_types(...) On Tue, Dec 24, 2013 at 5:55 PM, Denis A. Engemann <notifications@github.com
|
I know that I suggested this.
|
@agramfort that makes sense. Do you think we should not expose |
I think it makes the most sense to deprecate direct instantiation of raw using |
i'm fine with functions, but it really should be consistent. no historical excuses ;-) |
I won't continue here before we reach consensus, this PR is too fidgety otherwise. Let's shoot for a post-holiday / xmas hangout if necessary. |
The only remaining debate is over whether to put the |
and how many of all other read_* functions should follow, e.g. read_ica, etc. likewise, how much of pick to expose in mne name space. |
I'd prefer |
I think it would be good to have all file-reading functions in a separate sub-package, so I vote for either using Regarding having a BaseRaw class in mne/io/base.py. I think we should put it in mne/raw.py, this will be more consistent with other types (Evoked etc.). |
I'm confused. Let me try to do some score-keeping.
currently the thing
I agree. but currently this is not in sight. hdf5 might be the next thing cf. NEO support. We should definitely chose an API that does not block such future developments. on the other hand side we should not give too much weight to thing things we (Y)AGN(I). Admittedly, in this case is a bit different in that we try to find an API that is both maximum general and simple ....
well auto-completion works equally well with underscores ;-)
I'm trying to wrap up. So you (@mluessi) would like to have a base class in mne but all readers spreaded across format specific modules (prefix notation). @agramfort and @Eric89GXL want do deprecate constructors but basically converge on I guess we need postpone this to a point where all of us can meet in a hangout. |
I don't feel very strongly about it, I'm fine with either |
It looks like we really need to hangout to converge... let's plan this for after the holidays. I'm back at work on jan 6 |
Jan 6th or later works for me, but I am not too passionate about it so I'm okay if you can work it out without me (esp. since I am the limiting time factor). |
@dengemann pointed me here to discuss how to create bipolar montages for stereotactic EEG, for which I'm currently manipulating the While we are simply recomputing channel data and changing labels, bipolar sEEG is, technically, the use of adjacent channels as references, but I didn't see any way to do that in MNE currently. Does this fit somewhere into the above discussion? |
can you share a gist of the "hack" you do with the info and the _data field? |
@mmWoodman indeed not all aspects of the above discussion match your use case. But the general topic |
@mmWoodman that's indeed very helpful. It helps me understanding that the io is not the crucial part of your problem since you apparently record the sEEG with the 4D Magnes system. Maybe it's a separate issue but we could probably add parts of your code to the BTi converter and / or add a designated sEEG montage function ... to be discussed. |
Any chance the bipolar montage could be computed using an SSP projector? This would be more efficient and convenient. |
@mmWoodman if you can write it as a projection it may work. Have a look here for the EEG average reference projection: https://github.com/mne-tools/mne-python/blob/master/mne/fiff/proj.py#L524 Using an SSP would have the advantage that you wouldn't need to use preloading and you can switch on/off the projection later (e.g. when plotting evoked responses). |
@mluessi thanks for the tip. Are these the projections in The preloading and switching on/off is indeed useful as we often see bipolar/monopolar as complementary, not exclusive, so I'll look into writing an appropriate function. |
Why do you need them to be sparse? I don't anticipate hitting memory problems, and it may or may not be faster depending on whether sparse matrix multiplication in It seems like if all you're doing is subtracting pairs of channels, it should be possible with a single matrix. Whether or not this can be represented as a projection vector, I'm not sure. |
They don't need to be sparse; 'twas but a curiosity. The number of sEEG electrodes doesn't exceed ~60, at least in our case due to the amplifier. It does require a matrix, e.g. for a single implantation it would be |
using the SSP mechanism seem complicated I see a few things that could be done:
|
In addition we could add a bti function for renaming / setting channel types. |
I opened #1070 to continue sEEG discussion and avoid derailing the original discussion here. |
@agramfort where would you put the RawBase? |
In fiff/base.py
|
@agramfort I'll open a PR later such that we can discuss the interface the ABCMeta is supposed to dictate. |
Regarding being able to read non-fiff formats for things other than Raw, we are currently discussing read/write functions for FieldTrip data (Epochs, Evoked, etc.), which btw is the reason for mne-tools/mne-matlab#9 which will allow FT to read Epochs. So we should keep this in mind when designing the new io module. |
@mluessi I was also thinking about about |
@agramfort @Eric89GXL @mluessi ... To simplify convergence, could we please vote what to include in the interface definition: `print '\n - [ ] '.join(dir(raw))``
|
@dengemann I think for saving, maybe we could have a |
@dengemann ?? I don't get it.. |
@mluessi vote for the ABCMeta methods ;-) |
@agramfort @mluessi a few of the attributes are computed during runtime. We would need to make them Any thoughts? |
@agramfort why do you suggest to put the RawBase class into fiff/base.py? Maybe I'm misunderstanding something, but isn't the point of this PR to make IO less fiff-centric? I think it would make more sense to have the base class in mne/raw.py and format specific readers in the .py file for the respective file format. @dengemann are you trying to decide which methods/attributes from |
whatever method is not specific to fiff files :) |
first we create the base class then we refactor the io module to move stuff |
@agramfort +1 let's create the base class and the derived class for fiff first. Given that we are now planing to implement readers for FT, do you guys think it is still the best idea to implement a flat hierarchy or would hierarchical be better? I.e., should we use |
fine with mne.io.fieldtrip |
@agramfort the problem I see is that using a proper ABC class won't allow for inheritance. All methods expected by the API will be needed to be implemented by the advanced user, if only wrapping super calls to the base class. I'm not sure this is really what we want. |
abstract methods should be only the methods required by subclasses. the other methods are inherited |
duplicate |
I'd like to summarize what I feel needs to be done on the BaseRaw class + io module. Here are the few steps I would take
then introduce a BaseRaw class in mne/io/base.py , define the interface and update the base class in every object in the Raw family
do I forget something?
any volunteer? :)
The text was updated successfully, but these errors were encountered: