GithubHelp home page GithubHelp logo

(Epoch) resampling about mne-python HOT 6 CLOSED

mne-tools avatar mne-tools commented on May 22, 2024
(Epoch) resampling

from mne-python.

Comments (6)

agramfort avatar agramfort commented on May 22, 2024

that would be great to have this but my gut feeling is that piece of code
should land into scipy.signal

have you looked at:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample.html

I would send an email on the scipy-devel mailing list if somebody has done
this already and if there is an interest in scipy.signal.

option 2 is to have a resample method that uses scipy.signal.resample or
upfirdn http://code.google.com/p/upfirdn/ if availble.

makes sense?

from mne-python.

larsoner avatar larsoner commented on May 22, 2024

Yeah, I started trying to use upfirdn, and it was not as straightforward as I had hoped. Maybe for now we can try the scipy.signal.resample, and look at some results. We can always add more methods later (e.g., method='upfirdn' or whatever). How do you think on this:

  1. Make generic function in mne-python that takes in a numpy array, in sample rate, and out sample rate, and (for now) basically wraps to scipy's resample, returning the resampled array. This way we could eventually change what we use for resampling, or extend it if we want.

  2. Make methods in epochs (and wherever else) that call this generic function.

If this sounds reasonable, what would you like the function to be called for (1) the general function and (2) in epochs specifically? And what mne-python file should I put the general function in?

from mne-python.

agramfort avatar agramfort commented on May 22, 2024

Yeah, I started trying to use upfirdn, and it was not as straightforward
as I had hoped. Maybe for now we can try the scipy.signal.resample, and look
at some results. We can always add more methods later (e.g.,
method='upfirdn' or whatever).

makes sense

How do you think on this:

  1. Make generic function in mne-python that takes in a numpy array, in
    sample rate, and out sample rate, and (for now) basically wraps to scipy's
    resample, returning the resampled array. This way we could eventually change
    what we use for resampling, or extend it if we want.

yes

  1. Make methods in epochs (and wherever else) that call this generic
    function.

+1

If this sounds reasonable, what would you like the function to be called
for (1) the general function and (2) in epochs specifically? And what
mne-python file should I put the general function in?

I would say all called resample.

mne.time_frequency.resample()
Epochs.resample()
Evoked.resample()

I am relunctant to add a new signal module just for one function.

from mne-python.

larsoner avatar larsoner commented on May 22, 2024

Should I put the resample() function (the one that gets called by Epochs and Evoked, etc.) in filter.py? Seems like a natural fit.

from mne-python.

agramfort avatar agramfort commented on May 22, 2024

Yes

Le 26 sept. 2012 à 19:17, Eric89GXL [email protected] a écrit :

Should I put the resample() function in filter.py? Seems like a natural fit.


Reply to this email directly or view it on GitHub.

from mne-python.

larsoner avatar larsoner commented on May 22, 2024

So I've implemented a resample() function in filter.py. Comparing the results to MATLAB, it looks like I can actually get less (!) ringing in Python than I get using MATLAB's resample() (based on upfirdn) by using the 'flat' window, and zero-padding the data appropriately. I wrote it to operate on N-dimensional arrays along a given axis but haven't tested that yet, but I'm going to submit a pull request so people can try it out to see if they think it's reasonable.

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.