resampling.py 文件源码

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

项目:CElegansBehaviour 作者: ChristophKirst 项目源码 文件源码
def resample_1d(data, npoints, smooth = 0, periodic = False, derivative = 0):
  """Resample 1d data using n equidistant points

  Arguments:
    data (array): data points
    npoints (int): number of points in equidistant resampling
    smooth (number): smoothness factor
    periodic (bool): if True assumes the curve is a closed curve

  Returns:
    (array): resampled data points
  """

  x = np.linspace(0, 1, data.shape[0]);
  dinterp = splrep(x, data, s = smooth, per = periodic);
  if npoints is all:
    npoints = data.shape[0];
  x2 = np.linspace(0, 1, npoints);
  return splev(x2, dinterp, der = derivative)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号