首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >LinearNDInterpolator -- Qhull精度误差:初始单纯形是平坦的

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

Stack Overflow用户
提问于 2018-07-25 21:56:47
回答 1查看 7.3K关注 0票数 8

我试图使用scipy.interpolate.LinearNDInterpolator()在8维空间中插值数据点,并得到了一个我不明白的错误:

代码语言:javascript
运行
复制
scipy.spatial.qhull.QhullError: QH6154 Qhull precision error: Initial simplex is flat (facet 1 is coplanar with the interior point)

然后是更多的文本,我将在下面发布。使用我可以在网上找到的内容,我无法完成代码中的错误。这一切在我看来都是正确的(我只复制了相关的部分):

代码语言:javascript
运行
复制
from scipy import interpolate as inter
from numpy import array

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

inter.LinearNDInterpolator(npPoints, npS)

其中,points是一个Nx8嵌套的浮点数列表,而s是一个浮点数的Nx1列表,这两个列表都是前面定义的。

从我在文档中看到的情况来看,我认为我做得很对。我的错误在哪里?我应该用不同的方法吗?

以下是全Qhull错误

代码语言:javascript
运行
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2020-03-24 23:10:02

在我看来,这个问题的出现是因为,正如错误所述,您的数据(或给定的一组数据)实际上小于9维,即使您将它传递给了一个9列数组。正如您在数据中看到的,它是在错误消息中打印出来的,第5、第7和第8列是不变的。这意味着这些列是线性相关的,而且数据集只有7个维度。当它通过的时候,它试图形成一个9维的单纯形,但不能形成一个叫做凸性的。

这个问题是我在编写一个运行X翼型的翼型数据库时出现的,它可以在不同的攻角、雷诺数、襟翼偏转等情况下得到翼型系数。X翼型是精细的和碰撞的,在空间中的很多点上不返回任何结果。这意味着我最终得到了一个数据库,其中所有的点都是相同的雷诺数。这使得数据库不依赖于雷诺兹号,尽管我说是的。我的数据的维数比我想象的要少。

我将通过确保数据中的所有点都是唯一的来解决这个问题,并且每一列实际上都为集合添加了维度。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51528255

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档