peakutils.peak.indexes does not allow thres_abs argument

Issue #30 resolved
Zakery Alexander Fyke created an issue

According to the documentation:

peakutils.peak.indexes(y, thres=0.3, min_dist=1, thres_abs=False) Peak detection routine.

Finds the numeric index of the peaks in y by taking its first order difference. By using thres and min_dist parameters, it is possible to reduce the number of detected peaks. y must be signed.

Parameters: y (ndarray (signed)) – 1D amplitude data to search for peaks. thres (float between [0., 1.]) – Normalized threshold. Only the peaks with amplitude higher than the threshold will be detected. min_dist (int) – Minimum distance between each detected peak. The peak with the highest amplitude is preferred to satisfy this constraint. thres_abs (boolean) – If True, the thres value will be interpreted as an absolute value, instead of a normalized threshold.

However, attempting to use this as peakutils.peak.indexes(y, thres=1, min_dist=30, thres_abs=True) will yield: "indexes() got unexpected keyword argument 'thres_abs'".

Comments (3)

  1. Hilmar Zech

    This should be easily fixed by adding an if statement before the normalisation:

    if not thres_abs:
        thres = thres * (np.max(y) - np.min(y)) + np.min(y)
    
  2. Matteo

    It's a problem of synchronisation between code and documentation. The latest pip release of the package is old and does not include the thres_abs option described in the docs.

    While we wait for an updated release, you can temporarily install the latest version directly from the repository using

    pip install --upgrade git+https://bitbucket.org/lucashnegri/peakutils.git
    
  3. Log in to comment