def smoothCurve(X, Fac):
NPoints = X.shape[0]
dim = X.shape[1]
idx = range(NPoints)
idxx = np.linspace(0, NPoints, NPoints*Fac)
Y = np.zeros((NPoints*Fac, dim))
NPointsOut = 0
for ii in range(dim):
Y[:, ii] = interp.spline(idx, X[:, ii], idxx)
#Smooth with box filter
y = (0.5/Fac)*np.convolve(Y[:, ii], np.ones(Fac*2), mode='same')
Y[0:len(y), ii] = y
NPointsOut = len(y)
Y = Y[0:NPointsOut-1, :]
Y = Y[2*Fac:-2*Fac, :]
return Y
评论列表
文章目录