def _fourier_func(fourierparams, phase, mags):
<EOL>order = int(len(fourierparams)/<NUM_LIT:2>)<EOL>f_amp = fourierparams[:order]<EOL>f_pha = fourierparams[order:]<EOL>f_orders = [f_amp[x]*npcos(<NUM_LIT>*pi_value*x*phase + f_pha[x])<EOL>for x in range(order)]<EOL>total_f = npmedian(mags)<EOL>for fo in f_orders:<EOL><INDENT>total_f += fo<EOL><DEDENT>return total_f<EOL>
This returns a summed Fourier cosine series.

    Parameters
    ----------

    fourierparams : list
        This MUST be a list of the following form like so::

            [period,
             epoch,
             [amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],
             [phase_1, phase_2, phase_3, ..., phase_X]]

        where X is the Fourier order.

    phase,mags : np.array
        The input phase and magnitude areas to use as the basis for the cosine
        series. The phases are used directly to generate the values of the
        function, while the mags array is used to generate the zeroth order
        amplitude coefficient.

    Returns
    -------

    np.array
        The Fourier cosine series function evaluated over `phase`.