def fitCurv(t,d,x,y):
    """ Fit a curv [x,y] to connect head and tail with [t,d]
    Args:
        t: ndarray
            time axis of data to be imitated
        d: ndarray
            value axis of data to be imitated
        x: ndarray
            standard curve x
        y: ndarray
            standard curve y
    Returns:
        x: ndarray
            x after imitation
        y: ndarray
            y after imitation
    """
    x = (x-x[0])/(x[-1]-x[0])*(t[-1]-t[0])+t[0]
    dt= (t-t[0])/(t[-1]-t[0])*(d[-1]-d[0])+d[0] # data triangle
    yt= (x-x[0])/(x[-1]-x[0])*(d[-1]-d[0])+d[0] # y triangle
    y = y * max(d-dt) + yt
    return x,y