Skip to content

API, ENH: io, fiff, the bti and the kit #383

Closed

Description

@dengemann

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

  1. dengemann commented on Jan 15, 2013

    @dengemann
    MemberAuthor

    @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.

  2. agramfort commented on Jan 15, 2013

    @agramfort
    SponsorMember

    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

  3. dengemann commented on Jan 15, 2013

    @dengemann
    MemberAuthor

    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:

    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

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/383#issuecomment-12282411.

  4. dengemann commented on Jan 15, 2013

    @dengemann
    MemberAuthor

    ... 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:

    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:

    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

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/383#issuecomment-12282411.

  5. agramfort commented on Jan 15, 2013

    @agramfort
    SponsorMember

    +1 for both.

  6. dengemann commented on Jan 16, 2013

    @dengemann
    MemberAuthor

    Great. So @t3on , this also sets up the plan for how to proceed with #366 as soon as the functionality is settled ;-)

  7. dengemann commented on May 17, 2013

    @dengemann
    MemberAuthor

    Closing this, discussion continued on #542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions