[Git][debian-gis-team/pykdtree][master] 5 commits: New upstream version 1.3.13+ds
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Sep 7 17:02:27 BST 2024
Antonio Valentino pushed to branch master at Debian GIS Project / pykdtree
Commits:
a30ed48e by Antonio Valentino at 2024-09-07T15:53:02+00:00
New upstream version 1.3.13+ds
- - - - -
db21bede by Antonio Valentino at 2024-09-07T15:53:03+00:00
Update upstream source from tag 'upstream/1.3.13+ds'
Update to upstream version '1.3.13+ds'
with Debian dir 3232fdb0ab02fb9ab65113e322b93c0a21141ec5
- - - - -
ad452f32 by Antonio Valentino at 2024-09-07T15:53:40+00:00
New upstream release
- - - - -
e5d14979 by Antonio Valentino at 2024-09-07T16:00:34+00:00
Install the latest README.rst
- - - - -
0fcb65ce by Antonio Valentino at 2024-09-07T16:00:55+00:00
Set distribution to unstable
- - - - -
8 changed files:
- .github/workflows/deploy-wheels.yml
- CHANGELOG.md
- − debian/README.rst
- debian/changelog
- debian/docs
- pykdtree/kdtree.pyx
- pykdtree/test_tree.py
- setup.py
Changes:
=====================================
.github/workflows/deploy-wheels.yml
=====================================
@@ -36,7 +36,7 @@ jobs:
- os: windows-2019
cibw_archs: "AMD64 ARM64"
artifact_name: "win"
- - os: macos-11
+ - os: macos-12
cibw_archs: "x86_64 arm64"
artifact_name: "mac"
- os: "ubuntu-20.04"
@@ -58,13 +58,16 @@ jobs:
platforms: all
- name: Build wheels
- uses: pypa/cibuildwheel at v2.17.0
+ uses: pypa/cibuildwheel at v2.20.0
env:
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *i686 *-musllinux_aarch64"
CIBW_ARCHS: "${{ matrix.cibw_archs }}"
CIBW_TEST_COMMAND: "pytest -v --pyargs pykdtree"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64"
+ # we use openmp (libomp) from homebrew which has a current limit of
+ # macos 12 (Monterey): https://formulae.brew.sh/formula/libomp
+ CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=12
- name: Upload wheel(s) as build artifacts
uses: actions/upload-artifact at v4
@@ -103,7 +106,7 @@ jobs:
path: dist
- name: Publish package to PyPI
if: github.event.action == 'published'
- uses: pypa/gh-action-pypi-publish at v1.8.14
+ uses: pypa/gh-action-pypi-publish at v1.10.0
with:
user: ${{ secrets.pypi_username }}
password: ${{ secrets.pypi_password }}
=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,25 @@
+## Version 1.3.13 (2024/09/04)
+
+### Issues Closed
+
+* [Issue 116](https://github.com/storpipfugl/pykdtree/issues/116) - Segmentation fault on empty points ([PR 119](https://github.com/storpipfugl/pykdtree/pull/119) by [@STNLd2](https://github.com/STNLd2))
+
+In this release 1 issue was closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 119](https://github.com/storpipfugl/pykdtree/pull/119) - Fixed empty pts segfault ([116](https://github.com/storpipfugl/pykdtree/issues/116))
+
+#### Features added
+
+* [PR 124](https://github.com/storpipfugl/pykdtree/pull/124) - Enable Python 3.13 wheel building and switch to C17 C standard
+
+In this release 2 pull requests were closed.
+
+
+
## Version 1.3.12 (2024/04/12)
### Pull Requests Merged
=====================================
debian/README.rst deleted
=====================================
@@ -1,96 +0,0 @@
-========
-pykdtree
-========
-
-Objective
----------
-pykdtree is a kd-tree implementation for fast nearest neighbour search in Python.
-The aim is to be the fastest implementation around for common use cases (low dimensions and low number of neighbours) for both tree construction and queries.
-
-The implementation is based on scipy.spatial.cKDTree and libANN by combining the best features from both and focus on implementation efficiency.
-
-The interface is similar to that of scipy.spatial.cKDTree except only Euclidean distance measure is supported.
-
-Queries are optionally multithreaded using OpenMP.
-
-Installation
-------------
-Default build of pykdtree with OpenMP enabled queries using libgomp
-
-.. code-block:: bash
-
- $ cd <pykdtree_dir>
- $ python setup.py install
-
-If it fails with undefined compiler flags or you want to use another OpenMP implementation please modify setup.py at the indicated point to match your system.
-
-Building without OpenMP support is controlled by the USE_OMP environment variable
-
-.. code-block:: bash
-
- $ cd <pykdtree_dir>
- $ export USE_OMP=0
- $ python setup.py install
-
-Usage
------
-The usage of pykdtree is similar to scipy.spatial.cKDTree so for now refer to its documentation
-
- >>> from pykdtree.kdtree import KDTree
- >>> kd_tree = KDTree(data_pts)
- >>> dist, idx = pkd_tree.query(query_pts, k=8)
-
-The number of threads to be used in OpenMP enabled queries can be controlled with the standard OpenMP environment variable OMP_NUM_THREADS.
-
-The **leafsize** argument (number of data points per leaf) for the tree creation can be used to control the memory overhead of the kd-tree. pykdtree uses a default **leafsize=16**.
-Increasing **leafsize** will reduce the memory overhead and construction time but increase query time.
-
-pykdtree accepts data in double precision (numpy.float64) og single precision (numpy.float32) floating point. If data of another type is used an internal copy in double precision is made resulting in a memory overhead. If the kd-tree is constructed on single precision data the query points must be single precision as well.
-
-Benchmarks
-----------
-Comparison with scipy.spatial.cKDTree and libANN. This benchmark is on geospatial 3D data with 10053632 data points and 4276224 query points. The results are indexed relative to the construction time of scipy.spatial.cKDTree. A leafsize of 10 (scipy.spatial.cKDTree default) is used.
-
-Note: libANN is *not* thread safe. In this benchmark libANN is compiled with "-O3 -funroll-loops -ffast-math -fprefetch-loop-arrays" in order to achieve optimum performance.
-
-================== ===================== ====== ======== ==================
-Operation scipy.spatial.cKDTree libANN pykdtree pykdtree 4 threads
------------------- --------------------- ------ -------- ------------------
-
-Construction 100 304 96 96
-
-query 1 neighbour 1267 294 223 70
-
-Total 1 neighbour 1367 598 319 166
-
-query 8 neighbours 2193 625 449 143
-
-Total 8 neighbours 2293 929 545 293
-================== ===================== ====== ======== ==================
-
-Looking at the combined construction and query this gives the following performance improvement relative to scipy.spatial.cKDTree
-
-========== ====== ======== ==================
-Neighbours libANN pykdtree pykdtree 4 threads
----------- ------ -------- ------------------
-1 129% 329% 723%
-
-8 147% 320% 682%
-========== ====== ======== ==================
-
-Note: mileage will vary with the dataset at hand and computer architecture.
-
-Test
-----
-Run the unit tests using nosetest
-
-.. code-block:: bash
-
- $ cd <pykdtree_dir>
- $ python setup.py nosetests
-
-Changelog
----------
-v0.2 : Reduced memory footprint. Can now handle single precision data internally avoiding copy conversion to double precision. Default leafsize changed from 10 to 16 as this reduces the memory footprint and makes it a cache line multiplum (negligible if any query performance observed in benchmarks). Reduced memory allocation for leaf nodes. Applied patch for building on OS X.
-
-v0.1 : Initial version.
=====================================
debian/changelog
=====================================
@@ -1,9 +1,13 @@
-pykdtree (1.3.12+ds-2) UNRELEASED; urgency=medium
+pykdtree (1.3.13+ds-1) unstable; urgency=medium
- * Team upload.
+ [ Bas Couwenberg ]
* Bump Standards-Version to 4.7.0, no changes.
- -- Bas Couwenberg <sebastic at debian.org> Sun, 28 Jul 2024 19:53:44 +0200
+ [ Antonio Valentino ]
+ * New upstream release.
+ * Install the latest README.rst.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Sat, 07 Sep 2024 16:00:38 +0000
pykdtree (1.3.12+ds-1) unstable; urgency=medium
=====================================
debian/docs
=====================================
@@ -1 +1 @@
-debian/README.rst
+README.rst
=====================================
pykdtree/kdtree.pyx
=====================================
@@ -94,6 +94,10 @@ cdef class KDTree:
# Check arguments
if leafsize < 1:
raise ValueError('leafsize must be greater than zero')
+ if data_pts.ndim != 2:
+ raise ValueError('data_pts array should have exactly 2 dimensions')
+ if data_pts.size == 0:
+ raise ValueError('data_pts should be non-empty')
# Get data content
cdef np.ndarray[float, ndim=1] data_array_float
=====================================
pykdtree/test_tree.py
=====================================
@@ -2,7 +2,6 @@ import numpy as np
from pykdtree.kdtree import KDTree
-
data_pts_real = np.array([[ 790535.062, -369324.656, 6310963.5 ],
[ 790024.312, -365155.688, 6311270. ],
[ 789515.75 , -361009.469, 6311572. ],
@@ -106,9 +105,9 @@ data_pts_real = np.array([[ 790535.062, -369324.656, 6310963.5 ],
def test1d():
- data_pts = np.arange(1000)
+ data_pts = np.arange(1000)[..., None]
kdtree = KDTree(data_pts, leafsize=15)
- query_pts = np.arange(400, 300, -10)
+ query_pts = np.arange(400, 300, -10)[..., None]
dist, idx = kdtree.query(query_pts)
assert idx[0] == 400
assert dist[0] == 0
@@ -301,16 +300,17 @@ def test_scipy_comp():
def test1d_mask():
- data_pts = np.arange(1000)
+ data_pts = np.arange(1000)[..., None]
# put the input locations in random order
np.random.shuffle(data_pts)
- bad_idx = np.nonzero(data_pts == 400)
- nearest_idx_1 = np.nonzero(data_pts == 399)
- nearest_idx_2 = np.nonzero(data_pts == 390)
+ bad_idx = np.nonzero(data_pts[..., 0] == 400)
+ print(bad_idx)
+ nearest_idx_1 = np.nonzero(data_pts[..., 0] == 399)
+ nearest_idx_2 = np.nonzero(data_pts[..., 0] == 390)
kdtree = KDTree(data_pts, leafsize=15)
# shift the query points just a little bit for known neighbors
# we want 399 as a result, not 401, when we query for ~400
- query_pts = np.arange(399.9, 299.9, -10)
+ query_pts = np.arange(399.9, 299.9, -10)[..., None]
query_mask = np.zeros(data_pts.shape[0]).astype(bool)
query_mask[bad_idx] = True
dist, idx = kdtree.query(query_pts, mask=query_mask)
@@ -321,10 +321,10 @@ def test1d_mask():
def test1d_all_masked():
- data_pts = np.arange(1000)
+ data_pts = np.arange(1000)[..., None]
np.random.shuffle(data_pts)
kdtree = KDTree(data_pts, leafsize=15)
- query_pts = np.arange(400, 300, -10)
+ query_pts = np.arange(400, 300, -10)[..., None]
query_mask = np.ones(data_pts.shape[0]).astype(bool)
dist, idx = kdtree.query(query_pts, mask=query_mask)
# all invalid
@@ -370,3 +370,16 @@ def test127d_ok():
kdtree = KDTree(data_pts)
dist, idx = kdtree.query(data_pts)
assert np.all(dist == 0)
+
+
+def test_empty_fail():
+ data_pts = np.array([1, 2, 3])
+ try:
+ kdtree = KDTree(data_pts)
+ except ValueError as e:
+ assert 'exactly 2 dimensions' in str(e), str(e)
+ data_pts = np.array([[]])
+ try:
+ kdtree = KDTree(data_pts)
+ except ValueError as e:
+ assert 'non-empty' in str(e), str(e)
=====================================
setup.py
=====================================
@@ -57,7 +57,7 @@ class build_ext_subclass(build_ext):
comp = self.compiler.compiler_type
omp_comp, omp_link = _omp_compile_link_args(comp)
if comp in ('unix', 'cygwin', 'mingw32'):
- extra_compile_args = ['-std=c99', '-O3'] + omp_comp
+ extra_compile_args = ['-std=c17', '-O3'] + omp_comp
extra_link_args = omp_link
elif comp == 'msvc':
extra_compile_args = ['/Ox'] + omp_comp
@@ -197,7 +197,7 @@ extensions = [
setup(
name='pykdtree',
- version='1.3.12',
+ version='1.3.13',
url="https://github.com/storpipfugl/pykdtree",
description='Fast kd-tree implementation with OpenMP-enabled queries',
long_description=readme,
View it on GitLab: https://salsa.debian.org/debian-gis-team/pykdtree/-/compare/5e08f7fc1f8c220b1072bf2c63aaff56199571ed...0fcb65cedd95ca968646ee66c723f55541d9958e
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pykdtree/-/compare/5e08f7fc1f8c220b1072bf2c63aaff56199571ed...0fcb65cedd95ca968646ee66c723f55541d9958e
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240907/a2db00cd/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list