-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Possible bug in computation of multitaper TFR power #13023
Labels
Comments
Yeah just the fact that we call |
Okay, so #12910 makes the weights available in the class which could be used. Is it worth just fixing this there, or open a new PR? Don't want to overburden with a big PR review. |
Sure, sounds good! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the problem
When working through some bugs with plotting TFR multitaper data in #12910 I was looking over the
_time_frequency_loop
code for converting complex multitaper coefficients into real-valued power.Here the timeseries data,
X
, and windows,Ws
, for each taper,W
, are convolved to give the time-frequency transformed data,coefs
:mne-python/mne/time_frequency/tfr.py
Lines 709 to 713 in b329515
When power is requested, the complex coefficients for each taper are converted to power:
mne-python/mne/time_frequency/tfr.py
Lines 719 to 723 in b329515
... and summed together:
mne-python/mne/time_frequency/tfr.py
Line 740 in b329515
But I don't see at any point a weighting of the coefficients according to the taper weights. There is at the end a normalisation according to the number of tapers:
mne-python/mne/time_frequency/tfr.py
Lines 752 to 754 in b329515
... but that just means each taper is treated as having an equal weighting.
I also didn't notice anywhere upstream of the TFR computation where the taper weights were already applied.
This could be a misunderstanding on my part, but at least based on how PSD computation is handled, taper weights are applied when converting complex coefficients to power:
mne-python/mne/time_frequency/multitaper.py
Lines 187 to 206 in b329515
@larsoner do you have any ideas?
Steps to reproduce
Link to data
No response
Expected results
N/A
Actual results
N/A
Additional information
N/A
The text was updated successfully, but these errors were encountered: