Repository navigation
ENH: Validate frequencies and add docstring warning in TFR array classes (#14605) - #14606
Open
ishaaaan17 wants to merge 1 commit into
Open
ishaaaan17 wants to merge 1 commit into
ishaaaan17 wants to merge 1 commit into
Conversation
ishaaaan17
force-pushed
the
enh/tfr-array-freqs-check
branch
from
November 28, 2026 12:49
8f5a6a1 to
51308d7
Compare
tsbinns
reviewed
Nov 28, 2026
tsbinns
left a comment
Member
There was a problem hiding this comment.
Thanks for opening this @ishaaaan17. That was a typo in the issue to say it expects all freq > 0. It should have been >= 0. Apologies, I have updated the issue to reflect this.
Although our Morlet and multitaper TFR computations don't return a DC bin, it is perhaps too strict to completely prevent this.
Apart from that, this would be good to merge.
ishaaaan17
force-pushed
the
enh/tfr-array-freqs-check
branch
from
November 28, 2026 16:41
51308d7 to
8acfd18
Compare
Contributor
Author
|
thanks @tsbinns, updated the check to freqs >= 0 and reverted the dummy 0 hz test changes since 0 hz is allowed now. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue (if any)
Closes #14605. Follow-up to #14598.
What does this implement/fix?
As discussed with @tsbinns in #14605, this expands the input validation and docstring warnings from #14598 to
AverageTFRArray,EpochsTFRArray, andRawTFRArray:BaseTFR._check_state()(shared by all three*TFRArrayclasses) that frequencies are non-negative (freqs >= 0) and do not exceed the Nyquist frequency (sfreq / 2).warn_spectrum_arraydocdict entry via@fill_doc_staticat the top of theNotessection inAverageTFRArray,EpochsTFRArray, andRawTFRArray.test_tfr_init_errors.Additional information
Style (
ruff), static docstring (check_static_docs.py), and towncrier changelog (14606.bugfix.rst) checks pass, andtest_tfr.py,test_topo.py, andtest_topomap.pypass locally after the final edit.AI Assistance Disclosure: I planned the approach based on #14598 and reviewed all changes; I used Antigravity (Gemini) to draft the edits, integrate the tests, and verify style, changelog, and static-doc checks.