Skip to content

Commit 8903b4a

Browse files
authored
add docstring note about legacy n_fft default (#12587)
1 parent 43414ba commit 8903b4a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

mne/time_frequency/spectrum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def _set_legacy_nfft_default(self, tmin, tmax, method, method_kw):
279279
This method returns ``None`` and has a side effect of (maybe) updating
280280
the ``method_kw`` dict.
281281
"""
282-
if method == "welch" and method_kw.get("n_fft", None) is None:
282+
if method == "welch" and method_kw.get("n_fft") is None:
283283
tm = _time_mask(self.times, tmin, tmax, sfreq=self.info["sfreq"])
284284
method_kw["n_fft"] = min(np.sum(tm), 2048)
285285

mne/utils/docs.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,8 @@ def _reflow_param_docstring(docstring, has_first_line=True, width=75):
17041704

17051705
_fmin_fmax = """\
17061706
fmin, fmax : float
1707-
The lower- and upper-bound on frequencies of interest. Default is {}"""
1707+
The lower- and upper-bound on frequencies of interest. Default is
1708+
{}"""
17081709

17091710
docdict["fmin_fmax_psd"] = _fmin_fmax.format(
17101711
"``fmin=0, fmax=np.inf`` (spans all frequencies present in the data)."
@@ -2578,10 +2579,13 @@ def _reflow_param_docstring(docstring, has_first_line=True, width=75):
25782579
**method_kw
25792580
Additional keyword arguments passed to the spectral estimation
25802581
function (e.g., ``n_fft, n_overlap, n_per_seg, average, window``
2581-
for Welch method, or
2582-
``bandwidth, adaptive, low_bias, normalization`` for multitaper
2583-
method). See :func:`~mne.time_frequency.psd_array_welch` and
2584-
:func:`~mne.time_frequency.psd_array_multitaper` for details.
2582+
for Welch method, or ``bandwidth, adaptive, low_bias, normalization``
2583+
for multitaper method). See :func:`~mne.time_frequency.psd_array_welch`
2584+
and :func:`~mne.time_frequency.psd_array_multitaper` for details. Note
2585+
that for Welch method if ``n_fft`` is unspecified its default will be
2586+
the smaller of ``2048`` or the number of available time samples (taking into
2587+
account ``tmin`` and ``tmax``), not ``256`` as in
2588+
:func:`~mne.time_frequency.psd_array_welch`.
25852589
"""
25862590

25872591
docdict["method_kw_tfr"] = _method_kw_tfr_template.format(

0 commit comments

Comments
 (0)