pyampd
pyampd copied to clipboard
A question about most local maxima
Hi, @ig248 ,
I read the original paper and compared it with your implementation, I am wondering why below code reshapes LSM matrix by LSM[0:l_scale, :]
but not by LSM[0:l_scale+1, :]
?
https://github.com/ig248/pyampd/blob/cd247030f5a4ccd971da837b9b873cacbd7adfb3/pyampd/ampd.py#L106
As the paper said, it reshapes the LSM matrix by removing all elements m_{k,i} for which k > λ holds. So it should lead to new λ ×N matrix. But in your implementation, the new matrix is (λ-1) ×N.
And under certain dataset, the l_scale
may equals to 0, then LSM[0:0]
will throw an exception...
Looking forward to your response
Yeah I just downloaded this module and encountered the very same issue as l_scale is 0 for my data. I also changed it to l_scale+1 and now it works. The same problem is in line 52 for the original implementation:
https://github.com/ig248/pyampd/blob/cd247030f5a4ccd971da837b9b873cacbd7adfb3/pyampd/ampd.py#L52
Just wanted to add here that, when I got an error message "zero-size array to reduction operation minimum which has no identity" from using find_peaks, implementing the change you suggested fixed my issue.
Why when I try to change l_scale to l_scale+1 I get the wrong peak, although this does not report an error anymore.