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

Develop #117

Merged
merged 83 commits into from
Jan 8, 2025
Merged

Develop #117

merged 83 commits into from
Jan 8, 2025

Conversation

possibly-human
Copy link
Collaborator

PeakDetector was not triggering correctly when in apex mode (PEAK_MAX, PEAK_MIN).
It would trigger at the moment of crossing the triggerThreshold (behaving like crossing mode) rather than triggering when falling back beyond the fallbackTolerance.

peak_test_0

The issue was due to _peakValue being reset to -FLT_MIN when fallingBack was true, but then immediately taking on the value of the next value at the next step :

  if (isMax)
    _peakValue = value;

(because value is always higher than -FLT_MIN, so isMax is true!)

Issue was fixed by adding if (_crossing) conditional to ensure that _peakValue will only be updated again after the next crossing.

  if (isMax && _crossing)
    _peakValue = value;

peak_test_simulator

sofian and others added 30 commits April 3, 2024 11:38
…e calls to put() during a single step (rel to #115).
…ormalizer and MinMaxScaler (untested) (rel to #115 and closes #116).
PeakDetector in apex mode (PEAK_MAX/PEAK_MIN) was triggering at the moment of crossing the triggerThreshold (behaving like crossing mode) instead of triggering at fallback threshold.

Fixed by adding if (_crossed) condition before allowing "_peakValue" to take on the value of the next "value"
@sofian sofian merged commit 71d27cd into master Jan 8, 2025
3 of 9 checks passed
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