-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[ENH] Add option to store and return TFR taper weights #12910
Conversation
I'm also somewhat confused about the design of the mne-python/mne/time_frequency/tfr.py Lines 285 to 315 in 82fc2f7
It is looping over tapers, and then over frequencies. However, the Would it not be more efficient to only loop over frequencies and take advantage of the fact that this will also return information for each taper? |
I also have a question regarding testing: for the I/O tests, we're reading Apart from this there are still some tests I need to expand. |
Thanks for the review @drammock! I will sort out those remaining tests, although I'm in the process of moving at the moment so it might not be for some days. Regarding those issues I came across with TFR multitapers and converting to dataframes / plotting: would you like me to incorporate that into this PR? |
Just looking into the sorting the power this morning and I am a little confused by the procedure being used to convert the complex taper coeffs into power, as it seems that no taper weights are ever applied. I opened an issue to try and figure out if this is a mistake, or a misunderstanding on my part: #13023 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest push adds support for plotting of data with a taper dimension (aggregates over tapers before plotting and converts to power (if complex coeffs) or keeps as phase data).
Also has test coverage.
As discussed there this is a bug but will be addressed in a separate PR once this is merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of minor comments otherwise LGTM!
restarted the failing CI (which should pass this time 🤞🏻) and marked for auto-merge when green. Thanks @tsbinns |
* upstream/main: [DOC] extend documentation for add_channels (mne-tools#13051) Add `combine_tfr` to API (mne-tools#13054) Add `combine_spectrum()` function and allow `grand_average()` to support `Spectrum` data (mne-tools#13058) BUG: Fix bug with helium anon (mne-tools#13056) [ENH] Add option to store and return TFR taper weights (mne-tools#12910)
Co-authored-by: Daniel McCloy <[email protected]> Co-authored-by: Eric Larson <[email protected]>
* upstream/main: (57 commits) Allow lasso selection sensors in a plot_evoked_topo (mne-tools#12071) MAINT: Fix doc build (mne-tools#13076) BUG: Improve sklearn compliance (mne-tools#13065) [pre-commit.ci] pre-commit autoupdate (mne-tools#13073) MAINT: Add Numba to 3.13 test (mne-tools#13075) Bump autofix-ci/action from ff86a557419858bb967097bfc916833f5647fa8c to 551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef in the actions group (mne-tools#13071) [BUG] Correct annotation onset for exportation to EDF and EEGLAB (mne-tools#12656) New feature for removing heart artifacts from EEG or ESG data using a Principal Component Analysis - Optimal Basis Sets (PCA-OBS) algorithm (mne-tools#13037) [BUG] Fix taper weighting in computation of TFR multitaper power (mne-tools#13067) [FIX] Reading an EDF with preload=False and mixed frequency (mne-tools#13069) Fix evoked topomap colorbars, closes mne-tools#13050 (mne-tools#13063) [pre-commit.ci] pre-commit autoupdate (mne-tools#13060) BUG: Fix bug with interval calculation (mne-tools#13062) [DOC] extend documentation for add_channels (mne-tools#13051) Add `combine_tfr` to API (mne-tools#13054) Add `combine_spectrum()` function and allow `grand_average()` to support `Spectrum` data (mne-tools#13058) BUG: Fix bug with helium anon (mne-tools#13056) [ENH] Add option to store and return TFR taper weights (mne-tools#12910) BUG: viz plot window's 'title' argument showed no effect. (mne-tools#12828) MAINT: Ensure limited set of tests are skipped (mne-tools#13053) ...
Reference issue (if any)
PR for #12851
What does this implement/fix?
Adds an option to return taper weights for complex and phase outputs of the multitaper method in
tfr_array_multitaper()
, and also ensures taper weights are stored inTFR
objects.Additional information
When working on this, I discovered a couple of other issues with the per-taper TFR implementations (#12851 (comment)), including the fact that the
TFR
object plotting methods andto_data_frame
methods do not account for a taper dimension, leading to errors. Wasn't sure if people want me to also address these here or in a separate PR.