Repository navigation
Description
We're facing a couple of upgrades with regard to support of other MEG systems. My work on binary readers for bti is making good progress and also the kit does, as far as I can see. With this changes some design and API questions become obvious. Our last discussion was to add the new functionality to mne/fiff.py. Also the long-term vision was to dissolve the fiff and distribute it over the mne name space and a new io module.
Now my current estimate for my contrib is about 1.6 k new lines of code, possibly even more when tests are included and the bti dataset.
Q1: put it in one single module or create a new directory under io which harbors different submodules for reading, transforming, constants, etc.
The former would seem more light weight to me at the first glance. However distributing and bundling common operations across and in specific submodules might improve readability and and maintainability. Opinions?
Q2: As handy as it is to subclass Raw for constructing raw objects from different sources than fiff files, I don't think it's the desired thing on the long run. First we will create more classes without a real need for them. Second it API wise it doesn't feel natural to me to deal with things like mne.io.RawBTi or mne.io.KIT (current solution). Another solution could be to keep the subclasses 'private' if this is possible at all and delegate the stuff to interface functions like mne.io.raw_from_kit, mne.io.raw_from_bti. This leads to a third possiblity, namely factory functions or class methods for Raw. We could have two slim classmethods like mne.Raw.from_bti, mne.Raw.from_kit which delegate the arguments passed to constructor functions in mne.io.bti, mne.io.kit. A fourth, somewhat hackish idea was to use regular functions, as in proposal ii would be to try to privately delete the Raw.init method inside a factory function exposed to io namespace and override it inside the body of the function. But this feels like black magic / hackery. I personally would like to have some kind of factory function in the numpy / pandas style of np.fromfile / pandas.DataFrame.from_csv, no matter how it's done internally. Any thoughts?
Activity
dengemann commentedon Jan 15, 2013
@agramfort s recent proposal from #382 could be applied here, so it's worth to update. Instead of mne.io.bti.RawBTi we would have mne.io.bti.Raw, mne.io.kit.Raw and mne.io.Raw. That would be the even more straightforward than for realtime epochs, because the resulting Raw objects have an identical API. We then could have constructor / factory functions in the io namespace. mne.io.raw_from_bti, mne.io.raw_from_kit.
agramfort commentedon Jan 15, 2013
or to be consistent with the mne.read_* functions :
mne.io.read_raw_fif (same as mne.fiff.Raw)
mne.io.read_raw_bti
mne.io.read_raw_kit
dengemann commentedon Jan 15, 2013
That I like.
We then could leave the Raw classes in their related modules and could keep
them all named Raw.
On Tue, Jan 15, 2013 at 7:44 PM, Alexandre Gramfort <
[email protected]> wrote:
dengemann commentedon Jan 15, 2013
... which also addresses the other question.
I think mne.io.fiff mne.io.bti mne.io.kit submodules would be what I
prefer, where each of them is a directory.
On Tue, Jan 15, 2013 at 7:47 PM, Denis-Alexander Engemann <
[email protected]> wrote:
agramfort commentedon Jan 15, 2013
+1 for both.
dengemann commentedon Jan 16, 2013
Great. So @t3on , this also sets up the plan for how to proceed with #366 as soon as the functionality is settled ;-)
dengemann commentedon May 17, 2013
Closing this, discussion continued on #542