Added a patch to scipy-kdtree to fix a np.min bug in query

This commit is contained in:
Guilhem Lavaux 2014-04-18 17:46:29 +02:00
parent 5dd9fb8620
commit b384912c42
3 changed files with 55 additions and 0 deletions

19
external/check_and_apply_patch.cmake vendored Normal file
View file

@ -0,0 +1,19 @@
SET(STAMP ${BUILD_PREFIX}/patch_applied)
SET(RESULT "not ok")
IF (EXISTS ${STAMP})
FILE(READ ${STAMP} RESULT)
ENDIF (EXISTS ${STAMP})
IF(NOT "${RESULT}" STREQUAL "ok")
EXECUTE_PROCESS(COMMAND patch -p0 -i ${PATCH_FILE}
WORKING_DIRECTORY ${SOURCE_PREFIX}
RESULT_VARIABLE okcode)
IF(NOT "${okcode}" STREQUAL "0")
FILE(WRITE ${STAMP} "not-applied")
MESSAGE(FATAL_ERROR "Patch not applied")
ELSE(NOT "${okcode}" STREQUAL "0")
FILE(WRITE ${STAMP} "ok")
ENDIF(NOT "${okcode}" STREQUAL "0")
ENDIF(NOT "${RESULT}" STREQUAL "ok")

View file

@ -199,7 +199,14 @@ IF(INTERNAL_KDTREE_SCIPY)
BUILD_IN_SOURCE 1
BUILD_COMMAND ${BUILD_ENVIRONMENT} ${CMAKE_SOURCE_DIR}/external/python_build.cmake
INSTALL_COMMAND ${BUILD_ENVIRONMENT} ${CMAKE_SOURCE_DIR}/external/python_install.cmake
PATCH_COMMAND ${CMAKE_COMMAND}
-DBUILD_PREFIX=${BUILD_PREFIX}/kdtree-scipy-prefix
-DPATCH_FILE=${CMAKE_SOURCE_DIR}/external/patch_kdtree
-DSOURCE_PREFIX=${BUILD_PREFIX}/kdtree-scipy-prefix/src/kdtree-scipy
-P ${CMAKE_SOURCE_DIR}/external/check_and_apply_patch.cmake
)
SET(AUXILIARY_PYTHON_DEPEND ${AUXILIARY_PYTHON_DEPEND} kdtree-scipy)
ENDIF(INTERNAL_KDTREE_SCIPY)

29
external/patch_kdtree vendored Normal file
View file

@ -0,0 +1,29 @@
--- periodic_kdtree.py.old 2014-04-18 17:30:39.000000000 +0200
+++ periodic_kdtree.py 2014-04-18 17:31:59.000000000 +0200
@@ -102,7 +102,7 @@
# all neighbors within the given distance_upper_bound".
# Cap distance_upper_bound
- distance_upper_bound = np.min(distance_upper_bound,
+ distance_upper_bound = min(distance_upper_bound,
self.max_distance_upper_bound)
# Run queries over all relevant images of x
@@ -128,7 +128,7 @@
# is a single point, not an array of points
# Cap r
- r = np.min(r, self.max_distance_upper_bound)
+ r = min(r, self.max_distance_upper_bound)
# Run queries over all relevant images of x
results = []
@@ -213,7 +213,7 @@
# all neighbors within the given distance_upper_bound".
# Cap distance_upper_bound
- distance_upper_bound = np.min(distance_upper_bound,
+ distance_upper_bound = min(distance_upper_bound,
self.max_distance_upper_bound)
# Run queries over all relevant images of x