numpy_test.py 文件源码

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

项目:piphat 作者: bschousek 项目源码 文件源码
def calcsteps(current_time=current_time, speedparms=speedparms):
    speed=np.linspace(speedparms[0], speedparms[1], len(current_time))
    expected=np.multiply(current_time,speed)
    steps=np.diff(np.floor(expected))
    steplocs=np.where(steps !=0)[0]
    steptimes=current_time[steplocs]
    stepdelta=np.diff(np.insert(steptimes,0,0))
    stepdir=speed[steplocs]>0
    deltap=np.sum(stepdir)-np.sum(np.invert(stepdir))
    full=False

    retval={'steplocs':steplocs,
            'steptimes':current_time[steplocs],
            'speeds': speed[steplocs],
            'stepdelta': stepdelta,
            'stepdir':stepdir,
            'deltap': deltap}
        #logging.debug('steplocs %r' %steplocs)
    #logging.debug('steptimes %r' %current_time[steplocs])
    #logging.debug('speeds %r' %speed[steplocs])

    #logging.debug('retval %r' %retval)
    return retval
    #return steps, current_time
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号