Params: depth, duration, slope, t0

def traptransit_lhood(pars, ts, fs, sigs, maxslope=MAXSLOPE):
    """
    Params: depth, duration, slope, t0
    """
    if pars[0] < 0 or pars[1] < 0 or pars[2] < 2 or pars[2] > maxslope:
        return -np.inf

    fmod = traptransit(ts, pars)
    tot = 0
    for i in range(len(ts)):
        tot += -0.5*(fmod[i] - fs[i])*(fmod[i] - fs[i]) / (sigs[i]*sigs[i])
        #tot += np.log(1./pars[2]) #logflat prior on slope

    return tot