def ringfunc(taun, *args):
    'cost function for ring fit to photometric data'
    (t, f, f_err, rad_ri, re, k, dst) = args
    # convolve and make smoothed ring photometry
    strip, dummy, g = exorings.ellipse_strip(rad_ri, \
        exorings.y_to_tau(taun), re[0], re[1], re[2], re[3], k, dst)

    # interpolate the smoothed curve....
    ring_model = interp1d(g[0], g[1], kind='linear')

    # ... to the times of the photometry
    ring_model_phot = ring_model(t)

    # calculate the residuals and the chi squared
    diff = f - ring_model_phot
    chisq = np.sum(np.power(diff/f_err, 2))
    red_chisq = chisq / diff.size

    return red_chisq
dataset/ETHPy150Open mkenworthy/exorings/disk_sim.py/ringfunc/original