pyampd icon indicating copy to clipboard operation
pyampd copied to clipboard

A question about most local maxima

Open skyan opened this issue 4 years ago • 3 comments

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

skyan avatar Aug 24 '20 11:08 skyan

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

OskarHofmann avatar Jan 21 '21 16:01 OskarHofmann

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.

yidilozdemir avatar Feb 17 '21 09:02 yidilozdemir

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.

code-yuan-shi avatar Jul 10 '23 07:07 code-yuan-shi