human
Complete this python program:
def _filter_ridge_lines(cwt, ridge_lines, window_size=None, min_length=None, min_snr=1, noise_perc=10):
assistant
#Here is the Python code you requested.

    """Filter ridge lines according to prescribed criteria. Intended
    to be used for finding relative maxima.
    Parameters
    cwt : 2-D ndarray
    Continuous wavelet transform from which the `ridge_lines` were defined.
    ridge_lines : 1-D sequence
    Each element should contain 2 sequences, the rows and columns
    of the ridge line (respectively).
    window_size : int, optional
    Size of window to use to calculate noise floor.
    Default is ``cwt.shape[1] / 20``.
    min_length : int, optional
    Minimum length a ridge line needs to be acceptable.
    Default is ``cwt.shape[0] / 4``, ie 1/4-th the number of widths.
    min_snr : float, optional
    Minimum SNR ratio. Default 1. The signal is the value of
    the cwt matrix at the shortest length scale (``cwt[0, loc]``), the
    noise is the `noise_perc`th percentile of datapoints contained within a
    window of `window_size` around ``cwt[0, loc]``.
    noise_perc : float, optional
    When calculating the noise floor, percentile of data points
    examined below which to consider noise. Calculated using
    scipy.stats.scoreatpercentile.
    References
    Bioinformatics (2006) 22 (17): 2059-2065. :doi:`10.1093/bioinformatics/btl355`
    http://bioinformatics.oxfordjournals.org/content/22/17/2059.long
    """
    num_points = cwt.shape[1]
    if (min_length is None):
        min_length = np.ceil((cwt.shape[0] / 4))
    if (window_size is None):
        window_size = np.ceil((num_points / 20))
    window_size = int(window_size)
    (hf_window, odd) = divmod(window_size, 2)
    row_one = cwt[0, :]
    noises = np.zeros_like(row_one)
    for (ind, val) in enumerate(row_one):
        window_start = max((ind - hf_window), 0)
        window_end = min(((ind + hf_window) + odd), num_points)
        noises[ind] = scoreatpercentile(row_one[window_start:window_end], per=noise_perc)
    def filt_func(line):
        if (len(line[0]) < min_length):
            return False
        snr = abs((cwt[(line[0][0], line[1][0])] / noises[line[1][0]]))
        if (snr < min_snr):
            return False
        return True
    return list(filter(filt_func, ridge_lines))