get_peaks function

Get peaks and valleys in a spectrum