methods_kharita.py 文件源码

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

项目:kharita 作者: vipyoung 项目源码 文件源码
def getseeds(datapoint,radius,theta):
    chosen = []; seeds = [];
#    random.shuffle(datapoint)
    periodsampl = 500000
    for p in datapoint:
        chosen.append(p);
    for j,p in enumerate(chosen):
        ok = -1;
        if j<periodsampl:
            for q in seeds:
                if taxidist(p,q,theta)<radius:
                    ok = 1
                    break;
            if ok <1:
                seeds.append(p)
        else:
            if j%periodsampl == 0:# and (is_power2(int(j/1000))):
#                print(j,time.time()-start)
                S = [(lonconst * xx[0], latconst * xx[1], theta / 180 * (xx[2]+45)) for xx in seeds];
                nbrs = NearestNeighbors(n_neighbors=1, algorithm='ball_tree').fit(S)
                X = [(lonconst * xx[0], latconst * xx[1], theta / 180 * (xx[2]+45)) for xx in chosen[j:min(len(chosen),j+periodsampl)]];
                distances, indices = nbrs.kneighbors(X)
            if distances[j%periodsampl][0] >radius:
                seeds.append(p)
    print('seeds: ', len(seeds))
    return (seeds)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号