GithubHelp home page GithubHelp logo

Epoch concatenation about mne-python HOT 12 CLOSED

mne-tools avatar mne-tools commented on May 21, 2024
Epoch concatenation

from mne-python.

Comments (12)

agramfort avatar agramfort commented on May 21, 2024

I agree with all what you said. Basically you have 3 options:

  • concat Raw instances and work at the raw level
  • concat Epochs and return a new Epochs
  • concat Epochs into a new object on with we can iterate and call average
    and get_data. The concat magic would happen when accessing the data

wdyt?

from mne-python.

larsoner avatar larsoner commented on May 21, 2024

I like options 1 and 2 potentially better than option 3 (new object), because part of the motivation behind this is to continue to have access to all enhancements brought to the Epochs objects. That is, unless the new object (MultiEpochs or whatever) would inherit the Epochs class and just overload the average() and get_data() functions (and in this sense, be transparent to the user as otherwise being of the Epochs class)?

from mne-python.

agramfort avatar agramfort commented on May 21, 2024

I like options 1 and 2 potentially better than option 3 (new object),
because part of the motivation behind this is to continue to have access to
all enhancements brought to the Epochs objects. That is, unless the new
object (MultiEpochs or whatever) would inherit the Epochs class and just
overload the average() and get_data() functions (and in this sense, be
transparent to the user as otherwise being of the Epochs class)?

yes that would work. I'd say I'd have to try to implement it and use
it to see if it actually flies...

do not hesitate to give it a try as you clearly understood the
implications of those changes.

from mne-python.

larsoner avatar larsoner commented on May 21, 2024

I'll probably give the overloading a shot first, as this should be the easiest way not to require people to preload all their data.

from mne-python.

dengemann avatar dengemann commented on May 21, 2024

+1 for this.
My guess would be that 2) is the most clear / straight-forward option.
One option would be to include a .concatenate method for the epochs,
another one could be to do to override the add operator.
I personally hold a slight preference for a method or a function, as this
seems to involve less magic (although theres definitely something charming
to 'epochs_a + epochs_b').

2012/9/26 Eric89GXL [email protected]

I'll probably give the overloading a shot first, as this should be the
easiest way not to require people to preload all their data.


Reply to this email directly or view it on GitHubhttps://github.com//issues/120#issuecomment-8897627.

from mne-python.

larsoner avatar larsoner commented on May 21, 2024

Well, I just spent an embarrassing amount of time on this today to figure out that there's a problem with creating a new class (e.g., MultiClass) that inherits and extends the Epoch class. We'd either need to use a bunch of deepcopy()'s, or warn users against using it in certain ways.

In any case, I think it'll be cleaner to refactor the current Epochs class to use either 1) one raw input and one list of events (current behavior), or 2) a list of raws with a list of events (extended, new behavior). This will not only be easier to use than making a new class, but it easily retains backward compatibility, makes for a natural extension with a concatenate() call, and doesn't require people learning a new class. I'm going to work on that tomorrow.

from mne-python.

dengemann avatar dengemann commented on May 21, 2024

On 27.09.2012, at 01:31, Eric89GXL [email protected] wrote:

Well, I just spent an embarrassing amount of time on this today to figure out that there's a problem with creating a new class (e.g., MultiClass) that inherits and extends the Epoch class. We'd either need to use a bunch of deepcopy()'s, or warn users against using it in certain ways.

Ok, this does not sound ideal.. :-(

In any case, I think it'll be cleaner to refactor the current Epochs class to use either 1) one raw input and one list of events (current behavior), or 2) a list of raws with a list of events (extended, new behavior). This will not only be easier to use than making a new class, but it easily retains backward compatibility, makes for a natural extension with a concatenate() call, and doesn't require people learning a new class. I'm going to work on that tomorrow.

Sounds very good to me. And certainly getting into mixing classes and deepcopying nested structures is not exactly desirable.. (at least i don't like it)
Just free-wheeling: Maybe another take could be the use of class methods with alternative constructors and .new vs from_raws methods or so.
But probably it would be the most clean thing, as you say, to take the constructor as is and make its behavior contingent upon its input arguments, that is raw object vs list of raw objects.


Reply to this email directly or view it on GitHub.

from mne-python.

agramfort avatar agramfort commented on May 21, 2024

Well, I just spent an embarrassing amount of time on this today to figure
out that there's a problem with creating a new class (e.g., MultiClass) that
inherits and extends the Epoch class. We'd either need to use a bunch of
deepcopy()'s, or warn users against using it in certain ways.

that's what I was afraid of.

In any case, I think it'll be cleaner to refactor the current Epochs class
to use either 1) one raw input and one list of events (current behavior), or
2) a list of raws with a list of events (extended, new behavior). This will
not only be easier to use than making a new class, but it easily retains
backward compatibility, makes for a natural extension with a concatenate()
call, and doesn't require people learning a new class. I'm going to work on
that tomorrow.

sounds very reasonable and cleaner. What I've been willing to do too is to
instantiate a Raw with a list of fif files in case the run is too long.

A

from mne-python.

dengemann avatar dengemann commented on May 21, 2024

On 27.09.2012, at 09:24, Alexandre Gramfort [email protected] wrote:

Well, I just spent an embarrassing amount of time on this today to figure
out that there's a problem with creating a new class (e.g., MultiClass) that
inherits and extends the Epoch class. We'd either need to use a bunch of
deepcopy()'s, or warn users against using it in certain ways.

that's what I was afraid of.

In any case, I think it'll be cleaner to refactor the current Epochs class
to use either 1) one raw input and one list of events (current behavior), or
2) a list of raws with a list of events (extended, new behavior). This will
not only be easier to use than making a new class, but it easily retains
backward compatibility, makes for a natural extension with a concatenate()
call, and doesn't require people learning a new class. I'm going to work on
that tomorrow.

sounds very reasonable and cleaner. What I've been willing to do too is to
instantiate a Raw with a list of fif files in case the run is too long.

A

... so one could search through all of them for events and instantiate an epochs object with more or less the existing code...

Bu how would the raw object then look like, e.g. The info structure?


Reply to this email directly or view it on GitHub.

from mne-python.

agramfort avatar agramfort commented on May 21, 2024

Bu how would the raw object then look like, e.g. The info structure?

the info should be exactly the same. That's valid if it's actually the same run.

from mne-python.

dengemann avatar dengemann commented on May 21, 2024

Then maybe this should be the way to go. Maybe other use cases will emerge and then we're best off with a Raw object that handles multiple fif files if desired.

On 27.09.2012, at 09:51, Alexandre Gramfort [email protected] wrote:

Bu how would the raw object then look like, e.g. The info structure?

the info should be exactly the same. That's valid if it's actually the same run.

Reply to this email directly or view it on GitHub.

from mne-python.

agramfort avatar agramfort commented on May 21, 2024

Then maybe this should be the way to go. Maybe other use cases will emerge
and then we're best off with a Raw object that handles multiple fif files if
desired.

I think we need both as the multiple fif input to raw should assume
that first_samp or the next is last_samp from the previous.

from mne-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.