stuffr.py 文件源码

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

项目:piradar 作者: scivision 项目源码 文件源码
def decimate2(x,dec=2):
    Nout = int(math.floor(len(x)/dec))
    idx = numpy.arange(Nout,dtype=numpy.int)*int(dec)
    res = x[idx]*0.0
    count = numpy.copy(x[idx])
    count[:]=1.0

    count_vector = numpy.negative(numpy.isnan(x))*1.0
    x[numpy.where(numpy.isnan(x))] = 0.0

    for i in numpy.arange(dec):
        res = res + x[idx+i]
        count += count_vector[idx+i]

    count[numpy.where(count == 0.0)] = 1.0
    return(res/count)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号