Skip to content

[ENH] - Extend spectral power with more FFT options - #354

Merged
TomDonoghue merged 10 commits into
mainfrom
fft
Oct 29, 2025
Merged

[ENH] - Extend spectral power with more FFT options#354
TomDonoghue merged 10 commits into
mainfrom
fft

Conversation

@TomDonoghue

@TomDonoghue TomDonoghue commented Oct 12, 2025

Copy link
Copy Markdown
Member

Add a function to compute a spectrum as from the FFT directly.

Why: every so often I find myself wanting to compute a single FFT window, and end up messing around remember how to do so. This adds the option to compute a spectrum from an individual FFT window, following the neurodsp spectral API.

Note that this PR is already merged with #358. In adding this function, since it uses numpy (not scipy like the others) there is no a padding option already available. I added a simplified padding function for a single window, adapted from the one we had before and that is suggested to be removed in #358.

Also, at one point I was using get_positive_fft_outputs to select positive ffts, but then realized this can be short-cutted by using np.rfft instead of np.fft. As such, I think the get_positive_fft_outputs can actually be removed, unless anyone thinks it's useful for some reason?

@neurodsp-tools neurodsp-tools deleted a comment from codecov Bot Oct 12, 2025
@neurodsp-tools neurodsp-tools deleted a comment from codecov Bot Oct 12, 2025
@TomDonoghue TomDonoghue changed the title [WIP] - Extend spectral power with more FFT options [ENH] - Extend spectral power with more FFT options Oct 27, 2025

@ryanhammonds ryanhammonds left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed review! I missed this.

I suppose part of this has been superseded by #357? Since both updated compute_spectrum_welch?

Edit: just saw you note that this has already been merged! I should read main comment before jumping into code 😅

Comment thread neurodsp/spectral/power.py
Comment thread neurodsp/spectral/power.py
@neurodsp-tools neurodsp-tools deleted a comment from codecov Bot Oct 29, 2025
@neurodsp-tools neurodsp-tools deleted a comment from codecov Bot Oct 29, 2025
@TomDonoghue

Copy link
Copy Markdown
Member Author

Thanks for checking through! I updated the API list & init, and did drop get_positive_fft_outputs, since it doesn't really have a use case. Merging this in now

@TomDonoghue
TomDonoghue merged commit 2c3165b into main Oct 29, 2025
8 of 10 checks passed
@TomDonoghue
TomDonoghue deleted the fft branch October 29, 2025 11:02
@neurodsp-tools neurodsp-tools deleted a comment from codecov Bot Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants