def auto_line_fitting_filter(param, i1, i2):
    """A filter function for fitting of a single calibration line.

    Args:
        param ():
        i1 (int):
        i2 (int):

    Return:
        bool:
    """
    if param[0] <= 0.:
        # line amplitdue too small
        return False
    if param[1] < i1 or param[1] > i2:
        # line center not in the fitting range (i1, i2)
        return False
    if param[2] > 50. or param[2] < 1.0:
        # line too broad or too narrow
        return False
    if param[3] < -0.5*param[0]:
        # background too low
        return False
    return True