Trapezoidal parameters for simulated orbit.
    
    All arguments passed to :func:`eclipse` except the following:

    :param pars0: (optional)
        Initial guess for least-sq optimization for trapezoid parameters.

    :return dur,dep,slope:
        Best-fit duration, depth, and T/tau for eclipse shape.

def eclipse_tt(p0,b,aR,P=1,ecc=0,w=0,npts=100,u1=0.394,u2=0.261,conv=True,
               cadence=1626./86400,frac=1,sec=False,pars0=None,tol=1e-4,width=3):
    """
    Trapezoidal parameters for simulated orbit.
    
    All arguments passed to :func:`eclipse` except the following:

    :param pars0: (optional)
        Initial guess for least-sq optimization for trapezoid parameters.

    :return dur,dep,slope:
        Best-fit duration, depth, and T/tau for eclipse shape.
    
    """
    ts,fs = eclipse(p0=p0,b=b,aR=aR,P=P,ecc=ecc,w=w,npts=npts,u1=u1,u2=u2,
                    conv=conv,cadence=cadence,frac=frac,sec=sec,tol=tol,width=width)
    
    #logging.debug('{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}'.format(p0,b,aR,P,ecc,w,xmax,npts,u1,u2,leastsq,conv,cadence,frac,sec,new))
    #logging.debug('ts: {} fs: {}'.format(ts,fs))

    if pars0 is None:
        depth = 1 - fs.min()
        duration = (fs < (1-0.01*depth)).sum()/float(len(fs)) * (ts[-1] - ts[0])
        tc0 = ts[fs.argmin()]
        pars0 = np.array([duration,depth,5.,tc0])
    
    dur,dep,slope,epoch = fit_traptransit(ts,fs,pars0)
    return dur,dep,slope