Channel_Fun.py 文件源码

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

项目:DrainageNetworkExtraction 作者: MiladHooshyar 项目源码 文件源码
def simple_poly_fit(x , y , number_of_uni_point, smoothness):

    number_of_point = len(x)
    t = np.zeros_like(x)
    for i in range(0 , number_of_point):
        if i > 0:
            t[i] = t[i - 1] + np.sqrt((x[i] - x[i - 1]) ** 2 + (y[i] - y[i - 1]) ** 2)
        else:
            t[i] = 0

    k = min(3 , number_of_point - 1) # spline order
    nest = -1 # estimate of number of knots needed (-1 = maximal)
    tckp , u = splprep([x , y , t] , s = smoothness , k = k , nest = -1)

    x_new , y_new, t_new = splev(linspace(0,1,number_of_uni_point),tckp)

    return x_new , y_new

########################################################################
########################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号