Skip to content

Conversation

@ansaminard
Copy link
Collaborator

@ansaminard ansaminard commented Jun 2, 2025

Plotting STFTs would be quite time-consuming, for 2 reasons:

  • conversion of STFT data from FieldsContainer to numpy array was inefficient
  • when plotting an STFT, this conversion was done twice, when once only would have sufficed

To remedy these:

  • conversion now preallocates array memory before looping on the FieldsContainer's fields
  • conversion called once only when plotting

More generally, these changes improve computation times in any situation where the STFT data is being retrieved as a numpy array (meaning it also improves computation times for some other example scripts that this PR did not change)

Computation times during CI/CD before these changes:
image

Computation times during CI/CD after these changes:
image

(also improved some minor code readability issues)

@github-actions github-actions bot added examples Examples and tutorials enhancement New features or code improvements labels Jun 2, 2025
@ansaminard ansaminard marked this pull request as ready for review June 2, 2025 15:54
@codecov
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (28eceb1) to head (dbcf17f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #287   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           81        81           
  Lines         4977      4976    -1     
=========================================
- Hits          4977      4976    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

anssmolla
anssmolla previously approved these changes Jun 3, 2025
anssmolla
anssmolla previously approved these changes Jun 3, 2025
anscquesson
anscquesson previously approved these changes Jun 3, 2025
@ansaminard ansaminard dismissed stale reviews from anscquesson and anssmolla via dbcf17f June 3, 2025 07:29
@anscquesson anscquesson self-requested a review June 3, 2025 08:32
@ansaminard ansaminard merged commit 5d44f55 into main Jun 3, 2025
27 checks passed
@ansaminard ansaminard deleted the feat/improve-stft-performance branch June 3, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or code improvements examples Examples and tutorials

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants