resampling.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:CElegansBehaviour 作者: ChristophKirst 项目源码 文件源码
def resample_nd(curve, npoints, smooth = 0, periodic = False, derivative = 0):
  """Resample n points using n equidistant points along a curve

  Arguments:
    points (mxd array): coordinate of the reference points for the curve
    npoints (int): number of resamples equidistant points
    smooth (number): smoothness factor
    periodic (bool): if True assumes the curve is a closed curve

  Returns:
    (nxd array): resampled equidistant points
  """

  cinterp, u = splprep(curve.T, u = None, s = smooth, per = periodic);
  if npoints is all:
    npoints = curve.shape[0];
  us = np.linspace(u.min(), u.max(), npoints)
  curve = splev(us, cinterp, der = derivative);
  return np.vstack(curve).T;
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号