def METHOD_NAME(tau, amp, pha, ngood=20):
    """Function to minimize for FFTFIT (Taylor 1992), eqn. A7.
    Input
    -----
    tau: float
        Trial phase shift
    amp: array of floats
        Absolute value of the product between the Fourier transform of the
        pulse profile and of the template (|P S|)
    pha: array of floats
        Difference between the angles of P and S
    Results
    -------
    res: float
        Result of the function
    """
    good = slice(1, ngood + 1)
    idx = np.arange(1, ngood + 1, dtype=int)
    res = np.sum(idx * amp[good] * np.sin(-pha[good] + TWOPI * idx * tau))
    return res