Scipy的griddata方法总是失败

戴尔·迈尔斯(Dale Myers)

我正在尝试在Scipy中使用griddata方法对一组数据执行双三次插值。但是,每次尝试时,都会出现ValueError'Buffer not C contiguous'。

奇怪的是,我正在运行他们给出的示例算法,但仍然失败:

def func(x, y):
    return x*(1-x)*np.cos(4*np.pi*x) * np.sin(4*np.pi*y**2)**2

def bicubic():

    grid_x, grid_y = np.mgrid[0:1:100j, 0:1:200j]
    points = np.random.rand(1000, 2)
    values = func(points[:,0], points[:,1])

    data = griddata(points, values, (grid_x, grid_y), method='cubic')
    return data

堆栈跟踪为:

Traceback (most recent call last):
  File "parser.py", line 135, in <module>
    ZI = bicubic(xv,yv,values,gridx,gridy)
  File "/Users/Velox/Dropbox/Uni/Masters Project/Data/OpenSense/bicubic.py", line 14, in bicubic
    return griddata(points, values, (grid_x, grid_y), method='cubic')
  File "/Library/Python/2.7/site-packages/scipy/interpolate/ndgriddata.py", line 187, in griddata
    ip = CloughTocher2DInterpolator(points, values, fill_value=fill_value)
  File "interpnd.pyx", line 803, in scipy.interpolate.interpnd.CloughTocher2DInterpolator.__init__ (scipy/interpolate/interpnd.c:8584)
  File "interpnd.pyx", line 478, in scipy.interpolate.interpnd.estimate_gradients_2d_global (scipy/interpolate/interpnd.c:6644)
ValueError: Buffer not C contiguous.

Numpy和Scipy的版本分别1.8.0.dev-665a00a0.13.0.dev-61f05fe

有谁知道出什么问题了吗?

戴尔·迈尔斯(Dale Myers)

因此,这是numpy版本过时的问题。该错误可以在这里看到:https : //github.com/numpy/numpy/issues/2956

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

加快SciPy Griddata功能

来自分类Dev

发送短信方法总是失败

来自分类Dev

使用Scipy内插griddata方法重新栅格化数据时出现意外的内存错误

来自分类Dev

登录Twitter总是转到回调失败方法

来自分类Dev

使用`scipy.interpolate.griddata`的插值非常慢

来自分类Dev

Q then()总是调用失败

来自分类Dev

SKPaymentTransaction总是失败

来自分类Dev

UIDocumentInteractionController总是失败

来自分类Dev

AudioRecord总是创建失败

来自分类Dev

CreateFile()总是失败

来自分类Dev

jQuery POST总是失败

来自分类Dev

$ .getJSON总是失败

来自分类Dev

jQuery Ajax总是失败

来自分类Dev

AudioRecord总是创建失败

来自分类Dev

SKPaymentTransaction总是失败

来自分类Dev

ConfidentialClientApplication AcquireTokenSilentAsync总是失败

来自分类Dev

Mod 或 Predicate 总是失败

来自分类Dev

NODEmcu 总是说明连接失败总是

来自分类Dev

护照“ Hello World”总是失败

来自分类Dev

fileManager.createFileAtPath总是失败

来自分类Dev

npm install firebase总是失败

来自分类Dev

Laravel Task Scheduler总是失败

来自分类Dev

由于debconf,postinst总是失败

来自分类Dev

系统服务停止总是失败

来自分类Dev

load-CurrentPlayerLeaderboardScore 总是失败

来自分类Dev

封装后asserTrue()总是失败

来自分类Dev

link_to ...远程:true,方法:发布总是在第一次尝试时失败

来自分类Dev

jQuery ajax请求是否总是调用完成或失败方法?

来自分类Dev

对于在单独线程 (Task.Run) 上运行的异步方法,MustHaveHappened Assert 总是失败