简体   繁体   English

LinearNDInterpolator -- Qhull 精度误差:初始单纯形是平坦的

[英]LinearNDInterpolator -- Qhull precision error: Initial simplex is flat

I am attempting to use scipy.interpolate.LinearNDInterpolator() to interpolate data points in an 8-dimensional space and am getting an error I don't understand:我正在尝试使用scipy.interpolate.LinearNDInterpolator()在 8 维空间中插入数据点,但遇到了一个我不明白的错误:

scipy.spatial.qhull.QhullError: QH6154 Qhull precision error: Initial simplex is flat (facet 1 is coplanar with the interior point)

followed by much more text which I will post below.接下来是更多的文字,我将在下面发布。 Using what I can find online I cannot fine the error in my code.使用我可以在网上找到的内容,我无法解决代码中的错误。 It all looks right to me (I only copied relevant portions):这一切对我来说都是正确的(我只复制了相关部分):

from scipy import interpolate as inter
from numpy import array

npPoints = array(points)
npS = array(s)

inter.LinearNDInterpolator(npPoints, npS)

where points is an Nx8 nested list of floats and s is an Nx1 list of floats, both defined previously.其中points是一个 Nx8 嵌套的浮点数列表, s是一个 Nx1 的浮点数列表,两者都是之前定义的。

From what I see in the documentation it seems to me that I'm doing it right.从我在文档中看到的,在我看来我做得对。 Where is my error?我的错误在哪里? Should I be using a different method?我应该使用不同的方法吗?

Here is the full Qhull error :这是完整的 Qhull 错误

Traceback (most recent call last):
  File "BellDataFit", line 83, in <module>
    inter.LinearNDInterpolator(npPoints, npS)
  File "interpnd.pyx", line 248, in scipy.interpolate.interpnd.LinearNDInterpolator.__init__
  File "qhull.pyx", line 1826, in scipy.spatial.qhull.Delaunay.__init__
  File "qhull.pyx", line 354, in scipy.spatial.qhull._Qhull.__init__
scipy.spatial.qhull.QhullError: QH6154 Qhull precision error: Initial simplex is flat (facet 1 is coplanar with the interior point)

While executing:  | qhull d Qbb Qx Qz Q12 Qt Qc
Options selected for Qhull 2015.2.r 2016/01/18:
  run-id 704299719  delaunay  Qbbound-last  Qxact-merge  Qz-infinity-point
  Q12-no-wide-dup  Qtriangulate  Qcoplanar-keep  _zero-centrum  Qinterior-keep
  Q3-no-merge-vertices-dim-high  Pgood  _max-width 5.6  Error-roundoff 3.5e-14
  _one-merge 6.7e-13  Visible-distance 2.1e-13  U-coplanar-distance 2.1e-13
  Width-outside 4.2e-13  _wide-facet 1.3e-12

precision problems (corrected unless 'Q0' or an error)
      2 flipped facets
     11 nearly singular or axis-parallel hyperplanes
     11 zero divisors during back substitute
 119436 zero divisors during gaussian elimination

The input to qhull appears to be less than 9 dimensional, or a
computation has overflowed.

Qhull could not construct a clearly convex simplex from points:
- p3(v9): -0.89 -0.89     0     0     0  -1.7  -3.1  -3.1   2.1
- p2(v8): -0.89 -0.89     0     0     0  -2.1  -3.1  -3.1   2.7
- p1(v7): -0.89 -0.89     0     0     0  -2.4  -3.1  -3.1   3.4
- p16(v6): -0.89 -0.89     0     0     0   2.8  -3.1  -3.1   4.3
- p2720(v5):     0     0 -0.89  0.89     0  -2.8  -3.1  -3.1   4.3
- p2448(v4):     0     0 -0.89 -0.89     0  -2.8  -3.1  -3.1   4.3
- p7055(v3):     0     0  0.89 -0.89     0  -2.8  -3.1  -3.1   4.3
- p272(v2): -0.89  0.89     0     0     0  -2.8  -3.1  -3.1   4.3
- p0(v1): -0.89 -0.89     0     0     0  -2.8  -3.1  -3.1   4.3
- p9503(v0):  0.89 -0.89     0     0     0  -2.8  -3.1  -3.1   4.3

The center point is coplanar with a facet, or a vertex is coplanar
with a neighboring facet.  The maximum round off error for
computing distances is 3.5e-14.  The center point, facets and distances
to the center point are as follows:

center point  -0.4444  -0.4444 -0.08889 -0.08889        0   -2.025   -3.142   -3.142    3.806

facet p2 p1 p16 p2720 p2448 p7055 p272 p0 p9503 distance=    0
facet p3 p1 p16 p2720 p2448 p7055 p272 p0 p9503 distance=    0
facet p3 p2 p16 p2720 p2448 p7055 p272 p0 p9503 distance=    0
facet p3 p2 p1 p2720 p2448 p7055 p272 p0 p9503 distance=    0
facet p3 p2 p1 p16 p2448 p7055 p272 p0 p9503 distance=    0
facet p3 p2 p1 p16 p2720 p7055 p272 p0 p9503 distance= -0.13
facet p3 p2 p1 p16 p2720 p2448 p272 p0 p9503 distance=    0
facet p3 p2 p1 p16 p2720 p2448 p7055 p0 p9503 distance=    0
facet p3 p2 p1 p16 p2720 p2448 p7055 p272 p9503 distance=    0
facet p3 p2 p1 p16 p2720 p2448 p7055 p272 p0 distance=    0

These points either have a maximum or minimum x-coordinate, or
they maximize the determinant for k coordinates.  Trial points
are first selected from points that maximize a coordinate.

Because of the high dimension, the min x-coordinate and max-coordinate
points are used if the determinant is non-zero.  Option 'Qs' will
do a better, though much slower, job.  Instead of 'Qs', you can change
the points by randomly rotating the input with 'QR0'.

The min and max coordinates for each dimension are:
  0:   -0.8889    0.8889  difference= 1.778
  1:   -0.8889    0.8889  difference= 1.778
  2:   -0.8889    0.8889  difference= 1.778
  3:   -0.8889    0.8889  difference= 1.778
  4:         0         0  difference=    0
  5:    -2.793     2.793  difference= 5.585
  6:    -3.142  -2.225e-308  difference= 3.142
  7:    -3.142  -2.225e-308  difference= 3.142
  8:  1.776e-15     5.585  difference= 5.585

If the input should be full dimensional, you have several options that
may determine an initial simplex:
  - use 'QJ'  to joggle the input and make it full dimensional
  - use 'QbB' to scale the points to the unit cube
  - use 'QR0' to randomly rotate the input for different maximum points
  - use 'Qs'  to search all points for the initial simplex
  - use 'En'  to specify a maximum roundoff error less than 3.5e-14.
  - trace execution with 'T3' to see the determinant for each point.

If the input is lower dimensional:
  - use 'QJ' to joggle the input and make it full dimensional
  - use 'Qbk:0Bk:0' to delete coordinate k from the input.  You should
    pick the coordinate with the least range.  The hull will have the
    correct topology.
  - determine the flat containing the points, rotate the points
    into a coordinate plane, and delete the other coordinates.
  - add one or more points to make the input full dimensional.

It seems to me that the problem arises because, as the error says, your data (or a given set of your data) are really less than 9-dimensional even though you're passing it a 9-column array.在我看来,问题的出现是因为,正如错误所说,即使您将一个 9 列数组传递给它,您的数据(或一组给定的数据)实际上也小于 9 维。 As you can see in the data it's printed out in the error message, the 5th, 7th, and 8th columns are constant.正如您在错误消息中打印的数据中看到的那样,第 5、第 7 和第 8 列是常量。 This means those columns are linearly dependent and that set of data only has 7 dimensions.这意味着这些列是线性相关的,并且该数据集只有 7 个维度。 As it's going through, it's trying to form a 9-dimensional simplex but can't form one that's convex .当它通过时,它试图形成一个 9 维单纯形,但不能形成一个凸形

This issue showed up for me when I was coding an airfoil database that runs Xfoil to get the airfoil coefficients at different angles of attack, Reynolds numbers, flap deflections, etc. Xfoil was being finnicky and crash and not return any result for a lot of points in the space.当我编写一个运行 Xfoil 的翼型数据库以获取不同攻角下的翼型系数、雷诺数、襟翼偏转等时,这个问题出现在我身上。空间中的点。 That meant I ended up with a database where all the points were at the same Reynolds number.这意味着我最终得到了一个数据库,其中所有点都处于相同的雷诺数。 This made the database not dependent upon Reynolds number, even though I said it was.这使得数据库不依赖于雷诺数,即使我说它是。 My data had fewer dimensions than I though it did.我的数据的维度比我想象的要少。

I would fix this by making sure all the points in your data are unique and each column actually adds dimension to the set.我会通过确保数据中的所有点都是唯一的并且每一列实际上为集合添加维度来解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 QhullError: QH6154 Qhull 精度错误: Initial simplex is flat (facet 1 is coplanar with the interior point) - QhullError: QH6154 Qhull precision error: Initial simplex is flat (facet 1 is coplanar with the interior point) griddata:QH6214 qhull输入错误:没有足够的points(2)来构造初始单纯形 - griddata: QH6214 qhull input error: not enough points(2) to construct initial simplex 我如何在 Python 中为 LinearNDInterpolator 使用 Qhull 选项? - How do i use Qhull options for LinearNDInterpolator in Python? 使用 LinearNDInterpolator 进行外推 - Extrapolate with LinearNDInterpolator RuntimeError:qhull Delaunay三角剖分计算错误:输入不一致(退出代码= 1); - RuntimeError: Error in qhull Delaunay triangulation calculation: input inconsistency (exitcode=1); Python linprog最小化错误 - 单工方法 - Python linprog minimization error - simplex method ImportError:无法导入名称“ LinearNDInterpolator” - ImportError: cannot import name 'LinearNDInterpolator' Pycharm 错误:导入 qhull 时 DLL 加载失败:找不到指定的模块 - Pycharm Error: DLL load failed while importing qhull: The specified module could not be found Bigfloat-精度误差 - Bigfloat - Error in the precision 该程序是否存在精度错误? - Is there an error of precision in that program?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM