__init__.py 文件源码

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

项目:simupy 作者: sixpearls 项目源码 文件源码
def callable_from_trajectory(t, curves):
    """
    Use scipy.interpolate splprep to build cubic b-spline interpolating
    functions over a set of curves.

    Parameters
    ----------
    t : 1D array_like
        Array of m time indices of trajectory
    curves : 2D array_like
        Array of m x n vector samples at the time indices. First dimension
        indexes time, second dimension indexes vector components

    Returns
    -------
    interpolated_callable : callable
        Callable which interpolates the given curve/trajectories
    """
    tck_splprep = interpolate.splprep(
        x=[curves[:, i] for i in range(curves.shape[1])], u=t, s=0)

    def interpolated_callable(t, *args):
        return np.array(
            interpolate.splev(t, tck_splprep[0], der=0)
        ).T.squeeze()

    return interpolated_callable
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号