You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keep Welch PSD spans shorter than n_per_seg via a per-span window (mne-tools#13039)
Address @drammock's review on mne-tools#14003: rather than dropping good-data spans
shorter than n_per_seg, analyze each such span with nperseg shrunk to the
span length and noverlap clamped below it (a per-span functools.partial
overriding the values baked into _func). n_fft is unchanged, so all spans
share one frequency grid; short spans just get coarser spectral resolution,
which is surfaced via a warning. No data is discarded.
This is the option-3 workaround from the PR discussion. The underlying SciPy
behavior (clamping nperseg but not noverlap) may still be worth reporting
upstream (option 4).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyuFNWN45FNffpGwsC4Su7
Fix :func:`mne.time_frequency.psd_array_welch` (and Welch-method ``compute_psd``) so that good data spans shorter than ``n_per_seg`` no longer raise ``noverlap must be less than nperseg``; such spans are now dropped from the estimate with a warning, by :newcontrib:`Cedric Conday`.
1
+
Fix :func:`mne.time_frequency.psd_array_welch` (and Welch-method ``compute_psd``) so that good data spans shorter than ``n_per_seg`` no longer raise ``noverlap must be less than nperseg``; such spans are now analyzed with a window shrunk to the span length (with a warning that their spectral resolution is reduced) instead of being lost, by :newcontrib:`Cedric Conday`.
0 commit comments