Fits trapezoid model to provided ts,fs

def fit_traptransit(ts,fs,p0):
    """
    Fits trapezoid model to provided ts,fs
    """
    pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs))
    if success not in [1,2,3,4]:
        raise NoFitError
    #logging.debug('success = {}'.format(success))
    return pfit