Permalink
Browse files

Merge pull request #212 from pv/bug/1605-griddata-baryfix

BUG: trying to fix #1605, griddata spitting out nans
  • Loading branch information...
2 parents 6dc28b2 + 25ecea2 commit d77fae0b387a63ff1ebf0576d0a60a561604e1e7 @rgommers rgommers committed May 27, 2012
Showing with 23,004 additions and 4,479 deletions.
  1. +3,660 −2,096 scipy/interpolate/interpnd.c
  2. +7 −3 scipy/interpolate/interpnd.pyx.in
  3. +19,067 −2,290 scipy/spatial/qhull.c
  4. +3 −3 scipy/spatial/qhull.pxd
  5. +139 −84 scipy/spatial/qhull.pyx
  6. +3 −1 scipy/spatial/qhull_blas.h
  7. 0 scipy/spatial/tests/{ → data}/cdist-X1.txt
  8. 0 scipy/spatial/tests/{ → data}/cdist-X2.txt
  9. BIN scipy/spatial/tests/data/degenerate_pointset.npz
  10. 0 scipy/spatial/tests/{ → data}/iris.txt
  11. 0 scipy/spatial/tests/{ → data}/pdist-boolean-inp.txt
  12. 0 scipy/spatial/tests/{ → data}/pdist-chebychev-ml-iris.txt
  13. 0 scipy/spatial/tests/{ → data}/pdist-chebychev-ml.txt
  14. 0 scipy/spatial/tests/{ → data}/pdist-cityblock-ml-iris.txt
  15. 0 scipy/spatial/tests/{ → data}/pdist-cityblock-ml.txt
  16. 0 scipy/spatial/tests/{ → data}/pdist-correlation-ml-iris.txt
  17. 0 scipy/spatial/tests/{ → data}/pdist-correlation-ml.txt
  18. 0 scipy/spatial/tests/{ → data}/pdist-cosine-ml-iris.txt
  19. 0 scipy/spatial/tests/{ → data}/pdist-cosine-ml.txt
  20. 0 scipy/spatial/tests/{ → data}/pdist-double-inp.txt
  21. 0 scipy/spatial/tests/{ → data}/pdist-euclidean-ml-iris.txt
  22. 0 scipy/spatial/tests/{ → data}/pdist-euclidean-ml.txt
  23. 0 scipy/spatial/tests/{ → data}/pdist-hamming-ml.txt
  24. 0 scipy/spatial/tests/{ → data}/pdist-jaccard-ml.txt
  25. 0 scipy/spatial/tests/{ → data}/pdist-minkowski-3.2-ml-iris.txt
  26. 0 scipy/spatial/tests/{ → data}/pdist-minkowski-3.2-ml.txt
  27. 0 scipy/spatial/tests/{ → data}/pdist-minkowski-5.8-ml-iris.txt
  28. 0 scipy/spatial/tests/{ → data}/pdist-seuclidean-ml-iris.txt
  29. 0 scipy/spatial/tests/{ → data}/pdist-seuclidean-ml.txt
  30. 0 scipy/spatial/tests/{ → data}/pdist-spearman-ml.txt
  31. 0 scipy/spatial/tests/{ → data}/random-bool-data.txt
  32. +1 −1 scipy/spatial/tests/test_distance.py
  33. +124 −1 scipy/spatial/tests/test_qhull.py
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -202,6 +202,7 @@ class LinearNDInterpolator(NDInterpolatorBase):
cdef ${CDTYPE} fill_value
cdef int i, j, k, m, ndim, isimplex, inside, start, nvalues
cdef qhull.DelaunayInfo_t info
+ cdef double eps, eps_broad
ndim = xi.shape[1]
start = 0
@@ -213,6 +214,7 @@ class LinearNDInterpolator(NDInterpolatorBase):
nvalues = out.shape[1]
eps = np.finfo(np.double).eps * 100
+ eps_broad = sqrt(np.finfo(np.double).eps)
with nogil:
for i in xrange(xi.shape[0]):
@@ -221,7 +223,7 @@ class LinearNDInterpolator(NDInterpolatorBase):
isimplex = qhull._find_simplex(&info, c,
(<double*>xi.data) + i*ndim,
- &start, eps)
+ &start, eps, eps_broad)
# 2) Linear barycentric interpolation
@@ -440,7 +442,7 @@ cdef int _estimate_gradients_2d_global(qhull.DelaunayInfo_t *d, double *data,
# Didn't converge before maxiter
return 0
-def estimate_gradients_2d_global(tri, y, maxiter=400, tol=1e-6):
+def estimate_gradients_2d_global(tri, y, int maxiter=400, double tol=1e-6):
cdef np.ndarray[np.double_t, ndim=2] data
cdef np.ndarray[np.double_t, ndim=3] grad
cdef qhull.DelaunayInfo_t info
@@ -815,6 +817,7 @@ class CloughTocher2DInterpolator(NDInterpolatorBase):
cdef ${CDTYPE} fill_value
cdef int i, j, k, m, ndim, isimplex, inside, start, nvalues
cdef qhull.DelaunayInfo_t info
+ cdef double eps, eps_broad
ndim = xi.shape[1]
start = 0
@@ -826,14 +829,15 @@ class CloughTocher2DInterpolator(NDInterpolatorBase):
nvalues = out.shape[1]
eps = np.finfo(np.double).eps * 100
+ eps_broad = sqrt(eps)
with nogil:
for i in xrange(xi.shape[0]):
# 1) Find the simplex
isimplex = qhull._find_simplex(&info, c,
(<double*>xi.data) + i*ndim,
- &start, eps)
+ &start, eps, eps_broad)
# 2) Clough-Tocher interpolation
Oops, something went wrong.

0 comments on commit d77fae0

Please sign in to comment.