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
评论列表
文章目录