[WIP] - Add / use / update compute_spectrogram#359
Open
TomDonoghue wants to merge 4 commits intomainfrom
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #359 +/- ##
=======================================
Coverage 98.32% 98.33%
=======================================
Files 119 119
Lines 4430 4435 +5
=======================================
+ Hits 4356 4361 +5
Misses 74 74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR relates to the note about the spectrogram implementation in #344 - and also relates in part to discussion & updates in #357 and #358. Notably, while the #357 update moved away from using spectrogram in our Welch's function, this doesn't fully address the note about the implementation change in #344, since we use the
scipy.signal.spectrogramfunction elsewhere.To start with, this PR:
compute_spectrogramfunction to unify and make explicit our use of spectrograms (this initial version usesscipy.signal.spectrogram, so no change in behavior)compute_spectrogramin relevant places inneurodsp.spectral.variance.From here, the question is which implementation of spectrogram to support. We can add (instead or in addition), the new scipy.signal.ShortTimeFFT.spectrogram implementation.
From here, we could update to use scipy's new implementation of spectrogram, and it would look something like this:
However, there are some differences in the windowing and defaults that seem a bit nitpicky to solve. We would need to decide if / to what extent to match behavior between new & old (alternately: to what extent to just take the new behavior).
Relevant notes on aligning the implementations: