extended get_peaks.py