gjmvanboxtel / gsignal

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

findpeaks crashes with a long vector of data #21

Open bnicenboim opened 2 weeks ago

bnicenboim commented 2 weeks ago

findpeaks crashes with a long vector of data, compressed here: pos_sig.zip

peaks <- gsignal::findpeaks(pos_sig,MinPeakDistance = 100)
# Error in qr.solve(A, y) : singular matrix 'a' in solv

if I subset it, it works:

peaks <- gsignal::findpeaks(pos_sig[1:80000],MinPeakDistance = 100)
gjmvanboxtel commented 5 days ago

Hi Bruno,

Thanks for your report. This was fixed in v0.3-7.9000, to be released to CRAN soon.

The error was due to the fact that an internal call to the polynomial fitting function in the library pracma failed with an error. The equivalent function in Octave/Matlab only produces a warning but continues execution (discarding the candidate peak). I now caught the error and continued execution, of course also discarding the candidate peak.

Best, Geert