ipkiss3.all.find_peaks(x, y, method='spline', threshold=None, bandpass=None, **kwargs)

Find peaks in data varying in one parameter.

Assumes the y data is real and has been preprocessed to represent amplitude or power in linear or logarithmic scale.

Two peak detection methods are available:

  • ‘spline’: Fits the peaks with a cubic B-spline. The 2 x-values for which y goes through the threshold are found and finally the mathematical mean between those is used as the peak.
  • ‘cwt’: Finds the peaks using a wavelet convolution. First detects the bandwidths for which y is over threshold and uses the maximum bandwidth as a maximum wavelet width.

Depending on the features of the peaks like (a)symmetry and in-band ripple, one method may return better results than the other. Some experimentation may be needed to decide the best method for a specific device spectrum.


x: ndarray or list

Abscissa of the data

y: ndarray or list

Ordinate of the data in which to detect peaks

method: ‘spline’ or ‘cwt’

Peak finding method.

threshold: float or None

Decision threshold for peaks. Defaults to the average between minimum and maximum (independent of what the y data represents).

bandpass: bool or None

Bandpass (True) or bandstop (False) filter. None for auto-detect.


peak_x: ndarray

x values where y peaks

peak_y: ndarray

peak y values

Other Parameters:

smoothing: float

Spline smoothing factor (‘spline’ method). Defaults to 0.0


Peak values in the input arrays x,y are returned. For coarse data, you may want to apply an upfront interpolation or use find_peaks_spline().