Coder Social home page Coder Social logo

Comments (7)

larsoner avatar larsoner commented on August 15, 2024 1

To me it looks like "just" a difference in "n_fft" default. And psd_array_welch's default of 256 is pretty small for typical data, and compute_psd's default of 1024 is better. But it's odd that the evoked.compute_psd docs don't mention that the default is different. We should document where the defaults of compute_psd differ from the psd_array_* methods (might just be n_fft?) in compute_psd then we're okay I think. (The default of 1024 is better in my mind than 256 so don't want to change that, and doesn't seem worth it to change psd_array_welch to match by deprecation.)

from mne-python.

alexrockhill avatar alexrockhill commented on August 15, 2024

I only see the 256 default documented in psd_array_welch, I don't see 1024 mentioned anywhere although that seems to be the case from the data but maybe I'm just missing it

from mne-python.

drammock avatar drammock commented on August 15, 2024

The n_fft default for compute_psd() is actually data-dependent and was inherited from the legacy plot_psd() and plot_psd_topo() functions. It is:

tm = _time_mask(self.times, tmin, tmax, sfreq=self.info["sfreq"])
method_kw["n_fft"] = min(np.sum(tm), 2048)

I'll add a docstring note about the default.

from mne-python.

alexrockhill avatar alexrockhill commented on August 15, 2024

What do you think about changing the default in mne.time_frequency.psd_array_welch to match @drammock ? I agree with @larsoner that that tends to be rather few points for how high sampling rates tend to be nowadays but I'm not overly opinionated. I am a bit opinionated that I don't particularly like how two seemingly synonymous APIs don't have the same defaults, I think ideally they'd be the same.

from mne-python.

alexrockhill avatar alexrockhill commented on August 15, 2024

So no to harmonizing?

from mne-python.

drammock avatar drammock commented on August 15, 2024

So no to harmonizing?

Sorry I didn't see your comment before the PR was merged. My feeling is: the default that uses min(n_times, 2048) is a nice convenience default to avoid folks seeing scipy warnings. Folks who are using the psd_array_* interface are already doing "advanced" things (working outside of our normal MNE objects) so they might actually not appreciate a default that does a bit of magic like that (i.e., they might prefer to see those warnings). So I would want users to be able to turn it off, meaning the psd_array_welch function would need a new n_fft="auto" or so (so that passing an integer would not suppress warnings, but "auto" would adapt the value to the data size if necessary, thereby preventing the warning).

Which all feels a bit too... over-engineered? Folks doing advanced things can just write the min(n_times, 2048) or whatever into their own scripts.

from mne-python.

alexrockhill avatar alexrockhill commented on August 15, 2024

Hmm don't love it but I don't really have a better idea at the moment, I think the documentation will go a long way so thanks for that.

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.