argrelextrema returns tuple of 2 empty arrays when no peaks found in 1D vector #2832
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
scipy.signal
Milestone
When using the scipy.signal.argrelextrema function to find the peaks in a 1D numpy vector and no peaks are found the return value is a tuple with two empty arrays.
The docs say it returns "Indices of the maxima, as an array of integers". I would expect with no peaks it would be a tuple with one empty array for each dimension of the input vector.
For example:
I would have expected '((array([]), dtype=float64),)' for the second print statement.
In the source for scipy it returns "(np.array([]),) * 2" when no peaks are found but it should probably be "(np.array([]),) * data.ndim".
The text was updated successfully, but these errors were encountered: