Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add combine_tfr to API #13054

Merged
merged 9 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/time_frequency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Functions that operate on mne-python objects:
.. autosummary::
:toctree: ../generated/

combine_tfr
csd_tfr
csd_fourier
csd_multitaper
Expand Down
1 change: 1 addition & 0 deletions doc/changes/devel/12910.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:func:`mne.time_frequency.combine_tfr` now raises an error when passed data with a tapers dimension, by `Thomas Binns`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12910.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the option to return taper weights from :func:`mne.time_frequency.tfr_array_multitaper`, and taper weights are now stored in the :class:`mne.time_frequency.BaseTFR` objects, by `Thomas Binns`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13054.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added :func:`mne.time_frequency.combine_tfr` to the documentation, by `Thomas Binns`_.
tsbinns marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions mne/time_frequency/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __all__ = [
"RawTFRArray",
"Spectrum",
"SpectrumArray",
"combine_tfr",
"csd_array_fourier",
"csd_array_morlet",
"csd_array_multitaper",
Expand Down Expand Up @@ -71,6 +72,7 @@ from .tfr import (
EpochsTFRArray,
RawTFR,
RawTFRArray,
combine_tfr,
fwhm,
morlet,
read_tfrs,
Expand Down
11 changes: 11 additions & 0 deletions mne/time_frequency/multitaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ def tfr_array_multitaper(
output="complex",
n_jobs=None,
*,
return_weights=False,
verbose=None,
):
"""Compute Time-Frequency Representation (TFR) using DPSS tapers.
Expand Down Expand Up @@ -502,8 +503,14 @@ def tfr_array_multitaper(
* ``'itc'`` : inter-trial coherence.
* ``'avg_power_itc'`` : average of single trial power and inter-trial
coherence across trials.

%(n_jobs)s
The parallelization is implemented across channels.
return_weights : bool, default False
If True, return the taper weights. Only applies if ``output='complex'`` or
``'phase'``.

.. versionadded:: 1.10.0
%(verbose)s

Returns
Expand All @@ -520,6 +527,9 @@ def tfr_array_multitaper(
If ``output`` is ``'avg_power_itc'``, the real values in ``out``
contain the average power and the imaginary values contain the
inter-trial coherence: :math:`out = power_{avg} + i * ITC`.
weights : array of shape (n_tapers, n_freqs)
The taper weights. Only returned if ``output='complex'`` or ``'phase'`` and
``return_weights=True``.

See Also
--------
Expand Down Expand Up @@ -550,6 +560,7 @@ def tfr_array_multitaper(
use_fft=use_fft,
decim=decim,
output=output,
return_weights=return_weights,
n_jobs=n_jobs,
verbose=verbose,
)
Loading
Loading