Skip to content
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

stats: handle absence of global maxima in signal #127

Merged
merged 3 commits into from
Aug 8, 2024
Merged

Conversation

eneelo
Copy link
Collaborator

@eneelo eneelo commented Aug 8, 2024

Summary

This PR addresses issues with functions/methods that rely on identifying global maxima of a time series when there are none (e.g., because signal crosses its mean value only once).

  • qats.signal.find_maxima(): if only one mean-level crossing, return empty arrays. Previously, find_maxima() could fail if there was one up-crossing but no down-crossings. This fixes find_maxima() fails when no downcrossings are found #125.
  • qats.signal.average_frequency(): if only one mean-level crossing, return np.nan. Previously, this would generate a runtime warning (RuntimeWarning: divide by zero encountered in divide).

Other updates:

  • [GUI] In PSD calculation: if signal length is shorter that nperseg specified in settings, use signal length. This removes the scipy UserWarning generated if this mismatch occurs.

@eneelo eneelo self-assigned this Aug 8, 2024
@eneelo eneelo changed the title Handle absence of global maxima in TimeSeries methods Handle absence of global maxima Aug 8, 2024
@eneelo eneelo changed the title Handle absence of global maxima stats: handle absence of global maxima in signal Aug 8, 2024
Copy link

sonarcloud bot commented Aug 8, 2024

@eneelo eneelo merged commit ca4b35c into master Aug 8, 2024
6 checks passed
@eneelo eneelo deleted the fix-find-maxima branch August 8, 2024 12:27
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.

find_maxima() fails when no downcrossings are found
1 participant