【发布时间】:2017-06-28 18:37:13
【问题描述】:
在我当前的项目中,我目前遇到了转换问题: 在第一步中,我使用 scipy interp1d 插入两个列表。
f_speed = scipy.interpolate.interp1d(t, v, 'cubic')
之后我想在这个函数中得到一个特定的点。这个值现在是一个来自 scipy 的数组,其中只有一个值。
currentSpeed = f_speed(tpoint)
# result: array(15.1944)
作为最后一步,我想用插值函数的值计算其他值,但我只得到 0 作为值。完全没有错误。
real_distance = currentSpeed * (1/15) # some calculations
# result: 0, all results with further calculations are zero
我需要从 scipy 数组转换为常规浮点值来继续我的计算。有什么功能可以做到吗?
我尝试了几种方法,例如 V = currentSpeed[0],或 numpy 中的 .tolist(在 scipy 中不可能)...
提前感谢您的帮助!
【问题讨论】:
标签: python scipy interpolation