indices = scipy.signal.argrelmax(y, order=order)[0]
mini = np.nanpercentile(y, 1) if self.percentile else np.nanmin(y)
maxi = np.nanpercentile(y, 99) if self.percentile else np.nanmax(y)
threshold = mini + self.alpha * (maxi - mini)
peak_time = np.array([sw[i].middle for i in indices if y[i] > threshold])
After Change
mini = 0
maxi = 1
elif self.scale == "relative":
mini = np.nanmin(data)
maxi = np.nanmax(data)
elif self.scale == "percentile":
mini = np.nanpercentile(data, 1)
maxi = np.nanpercentile(data, 99)
threshold = mini + self.alpha * (maxi - mini)
peak_time = np.array([sw[i].middle for i in indices if y[i] > threshold])