get_peaks function

Get peaks and valleys from a spectrum