gjmvanboxtel / gsignal

R implementation of the Octave signal package
GNU General Public License v3.0
22 stars 6 forks source link

control flow logic in findpeaks #18

Closed jefferis closed 2 months ago

jefferis commented 2 months ago

https://github.com/gjmvanboxtel/gsignal/blob/0fbb9b185a353df081a46e604f14a8eee6c5ca36/R/findpeaks.R#L173

This should be

if (any(D<MinPeakDistance)) {

because otherwise it is just checking if D has some positive values rather than comparing distances with MinPeakDistance.

Compare with the corresponding line in octave

https://sourceforge.net/p/octave/signal/ci/default/tree/inst/findpeaks.m#l205

if (any (D(:) < minD))