def reduce_peaks(peaks,fftsize,high_peak_threshold,low_peak_threshold):
    "Reduce the number of peaks by separating into high and low frequency regions and thresholding."
    #Separate regions ensure better spread of peaks. 
    low_peaks = []
    high_peaks = []

    for item in peaks:
        if(item[1]>(fftsize/4)):
            high_peaks.append(item)
        else:
            low_peaks.append(item)
    
    #Eliminate peaks based on respective thresholds in the low and high frequency regions.  
    reduced_peaks = []
    for item in peaks:
        if(item[1]>(fftsize/4)):
            if(item[2]>np.percentile(high_peaks,high_peak_threshold,axis=0)[2]):
                reduced_peaks.append(item)
            else:
                continue
        else:
            if(item[2]>np.percentile(low_peaks,low_peak_threshold,axis=0)[2]):
                reduced_peaks.append(item)
            else:
                continue

    return reduced_peaks
dataset/ETHPy150Open bmoquist/Shazam/peakpicker.py/reduce_peaks/original