pitmap 0.0.0a2__tar.gz → 0.0.0a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/PKG-INFO +21 -6
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/README.md +16 -2
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/pyproject.toml +6 -5
- {pitmap-0.0.0a2 → pitmap-0.0.0a4/src}/pitmap/__init__.py +1 -1
- {pitmap-0.0.0a2 → pitmap-0.0.0a4/src}/pitmap.egg-info/PKG-INFO +21 -6
- pitmap-0.0.0a4/src/pitmap.egg-info/SOURCES.txt +11 -0
- {pitmap-0.0.0a2 → pitmap-0.0.0a4/src}/pitmap.egg-info/requires.txt +2 -2
- pitmap-0.0.0a2/pitmap/core/__init__.py +0 -0
- pitmap-0.0.0a2/pitmap/core/interpolation.py +0 -160
- pitmap-0.0.0a2/pitmap.egg-info/SOURCES.txt +0 -13
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/LICENSE +0 -0
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/setup.cfg +0 -0
- {pitmap-0.0.0a2 → pitmap-0.0.0a4/src}/pitmap.egg-info/dependency_links.txt +0 -0
- {pitmap-0.0.0a2 → pitmap-0.0.0a4/src}/pitmap.egg-info/top_level.txt +0 -0
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/tests/test_nearest_region.py +0 -0
- {pitmap-0.0.0a2 → pitmap-0.0.0a4}/tests/test_sector_idw.py +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pitmap
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.0a4
|
|
4
4
|
Summary: Surface construction from scattered survey points for open-pit mine surveying: polygonal, sector IDW, polynomial, NURBS and kernel interpolators, with prism volumes.
|
|
5
5
|
Author: Leonid Shpaner
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/datasciencedynamics/pitmap
|
|
8
8
|
Project-URL: Repository, https://github.com/datasciencedynamics/pitmap
|
|
9
|
+
Project-URL: Documentation, https://datasciencedynamics.com/pitmap/
|
|
9
10
|
Keywords: mine surveying,interpolation,open-pit,NURBS,IDW,surface modeling
|
|
10
11
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
12
|
Classifier: Intended Audience :: Science/Research
|
|
12
13
|
Classifier: Programming Language :: Python :: 3
|
|
13
14
|
Classifier: Topic :: Scientific/Engineering
|
|
14
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.8
|
|
15
16
|
Description-Content-Type: text/markdown
|
|
16
17
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: numpy>=1.
|
|
18
|
-
Requires-Dist: scipy>=1.
|
|
18
|
+
Requires-Dist: numpy>=1.20
|
|
19
|
+
Requires-Dist: scipy>=1.7
|
|
19
20
|
Provides-Extra: kernel
|
|
20
21
|
Requires-Dist: scikit-learn>=1.3; extra == "kernel"
|
|
21
22
|
Provides-Extra: nurbs
|
|
@@ -40,7 +41,8 @@ Dynamic: license-file
|
|
|
40
41
|
|
|
41
42
|
[](https://pypi.org/project/pitmap/)
|
|
42
43
|
[](https://github.com/datasciencedynamics/pitmap/blob/main/LICENSE)
|
|
43
|
-

|
|
45
|
+
[](https://datasciencedynamics.com/pitmap/)
|
|
44
46
|
|
|
45
47
|
Surface construction from scattered survey points for open-pit mine surveying.
|
|
46
48
|
|
|
@@ -53,6 +55,8 @@ kernel-based interpolator added for comparison. All methods share one
|
|
|
53
55
|
> **Status:** pre-alpha. The API will change. Nothing here is ready for
|
|
54
56
|
> production use yet.
|
|
55
57
|
|
|
58
|
+
Documentation: https://datasciencedynamics.com/pitmap/
|
|
59
|
+
|
|
56
60
|
## Methods
|
|
57
61
|
|
|
58
62
|
| Class | Method | Source |
|
|
@@ -92,7 +96,7 @@ model.predict(np.array([[2.0, 1.0], [9.0, 9.0]]))
|
|
|
92
96
|
## Repository layout
|
|
93
97
|
|
|
94
98
|
```
|
|
95
|
-
pitmap/
|
|
99
|
+
src/pitmap/ package; core/ holds the interpolators
|
|
96
100
|
data_gen.py fetch a raw DEM tile -> data/raw (Parquet, optional CSV)
|
|
97
101
|
preprocessing.py subsample to sparse survey points -> data/processed
|
|
98
102
|
notebooks/ analysis; outputs stripped before commit
|
|
@@ -109,6 +113,17 @@ make test
|
|
|
109
113
|
make help # list all targets
|
|
110
114
|
```
|
|
111
115
|
|
|
116
|
+
## Acknowledgements
|
|
117
|
+
|
|
118
|
+
The surface-construction methods implemented here were developed by
|
|
119
|
+
Prof. Oleksandr Zelenskyi, Volodymyr Lysenko and Oleksii Donchenko of the
|
|
120
|
+
Department of Informatics and Applied Software, State University of Economics
|
|
121
|
+
and Technology (Kryvyi Rih, Ukraine), over many years of work on automated
|
|
122
|
+
geological and mine-surveying support for open-pit mining. This package is an
|
|
123
|
+
independent open-source implementation of the methods as described in their
|
|
124
|
+
published papers (below); it contains none of their source code. Any errors in
|
|
125
|
+
the implementation are the package author's alone.
|
|
126
|
+
|
|
112
127
|
## References
|
|
113
128
|
|
|
114
129
|
Zelenskyi, O., Lysenko, V., Alekseyev, M., & Vlasov, V. (2020). Modeling of
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/pitmap/)
|
|
4
4
|
[](https://github.com/datasciencedynamics/pitmap/blob/main/LICENSE)
|
|
5
|
-

|
|
6
|
+
[](https://datasciencedynamics.com/pitmap/)
|
|
6
7
|
|
|
7
8
|
Surface construction from scattered survey points for open-pit mine surveying.
|
|
8
9
|
|
|
@@ -15,6 +16,8 @@ kernel-based interpolator added for comparison. All methods share one
|
|
|
15
16
|
> **Status:** pre-alpha. The API will change. Nothing here is ready for
|
|
16
17
|
> production use yet.
|
|
17
18
|
|
|
19
|
+
Documentation: https://datasciencedynamics.com/pitmap/
|
|
20
|
+
|
|
18
21
|
## Methods
|
|
19
22
|
|
|
20
23
|
| Class | Method | Source |
|
|
@@ -54,7 +57,7 @@ model.predict(np.array([[2.0, 1.0], [9.0, 9.0]]))
|
|
|
54
57
|
## Repository layout
|
|
55
58
|
|
|
56
59
|
```
|
|
57
|
-
pitmap/
|
|
60
|
+
src/pitmap/ package; core/ holds the interpolators
|
|
58
61
|
data_gen.py fetch a raw DEM tile -> data/raw (Parquet, optional CSV)
|
|
59
62
|
preprocessing.py subsample to sparse survey points -> data/processed
|
|
60
63
|
notebooks/ analysis; outputs stripped before commit
|
|
@@ -71,6 +74,17 @@ make test
|
|
|
71
74
|
make help # list all targets
|
|
72
75
|
```
|
|
73
76
|
|
|
77
|
+
## Acknowledgements
|
|
78
|
+
|
|
79
|
+
The surface-construction methods implemented here were developed by
|
|
80
|
+
Prof. Oleksandr Zelenskyi, Volodymyr Lysenko and Oleksii Donchenko of the
|
|
81
|
+
Department of Informatics and Applied Software, State University of Economics
|
|
82
|
+
and Technology (Kryvyi Rih, Ukraine), over many years of work on automated
|
|
83
|
+
geological and mine-surveying support for open-pit mining. This package is an
|
|
84
|
+
independent open-source implementation of the methods as described in their
|
|
85
|
+
published papers (below); it contains none of their source code. Any errors in
|
|
86
|
+
the implementation are the package author's alone.
|
|
87
|
+
|
|
74
88
|
## References
|
|
75
89
|
|
|
76
90
|
Zelenskyi, O., Lysenko, V., Alekseyev, M., & Vlasov, V. (2020). Modeling of
|
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pitmap"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.0a4"
|
|
8
8
|
description = "Surface construction from scattered survey points for open-pit mine surveying: polygonal, sector IDW, polynomial, NURBS and kernel interpolators, with prism volumes."
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
11
|
license = "MIT"
|
|
12
12
|
license-files = ["LICENSE"]
|
|
13
13
|
authors = [{name = "Leonid Shpaner"}]
|
|
@@ -19,13 +19,14 @@ classifiers = [
|
|
|
19
19
|
"Topic :: Scientific/Engineering",
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
|
-
"numpy>=1.
|
|
23
|
-
"scipy>=1.
|
|
22
|
+
"numpy>=1.20",
|
|
23
|
+
"scipy>=1.7",
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
[project.urls]
|
|
27
27
|
Homepage = "https://github.com/datasciencedynamics/pitmap"
|
|
28
28
|
Repository = "https://github.com/datasciencedynamics/pitmap"
|
|
29
|
+
Documentation = "https://datasciencedynamics.com/pitmap/"
|
|
29
30
|
|
|
30
31
|
[project.optional-dependencies]
|
|
31
32
|
kernel = ["scikit-learn>=1.3"]
|
|
@@ -35,7 +36,7 @@ viz = ["matplotlib>=3.7"]
|
|
|
35
36
|
dev = ["pytest", "black", "nbstripout", "jupyter", "build", "twine"]
|
|
36
37
|
|
|
37
38
|
[tool.setuptools.packages.find]
|
|
38
|
-
|
|
39
|
+
where = ["src"]
|
|
39
40
|
|
|
40
41
|
[tool.black]
|
|
41
42
|
line-length = 88
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pitmap
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.0a4
|
|
4
4
|
Summary: Surface construction from scattered survey points for open-pit mine surveying: polygonal, sector IDW, polynomial, NURBS and kernel interpolators, with prism volumes.
|
|
5
5
|
Author: Leonid Shpaner
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/datasciencedynamics/pitmap
|
|
8
8
|
Project-URL: Repository, https://github.com/datasciencedynamics/pitmap
|
|
9
|
+
Project-URL: Documentation, https://datasciencedynamics.com/pitmap/
|
|
9
10
|
Keywords: mine surveying,interpolation,open-pit,NURBS,IDW,surface modeling
|
|
10
11
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
12
|
Classifier: Intended Audience :: Science/Research
|
|
12
13
|
Classifier: Programming Language :: Python :: 3
|
|
13
14
|
Classifier: Topic :: Scientific/Engineering
|
|
14
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.8
|
|
15
16
|
Description-Content-Type: text/markdown
|
|
16
17
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: numpy>=1.
|
|
18
|
-
Requires-Dist: scipy>=1.
|
|
18
|
+
Requires-Dist: numpy>=1.20
|
|
19
|
+
Requires-Dist: scipy>=1.7
|
|
19
20
|
Provides-Extra: kernel
|
|
20
21
|
Requires-Dist: scikit-learn>=1.3; extra == "kernel"
|
|
21
22
|
Provides-Extra: nurbs
|
|
@@ -40,7 +41,8 @@ Dynamic: license-file
|
|
|
40
41
|
|
|
41
42
|
[](https://pypi.org/project/pitmap/)
|
|
42
43
|
[](https://github.com/datasciencedynamics/pitmap/blob/main/LICENSE)
|
|
43
|
-

|
|
45
|
+
[](https://datasciencedynamics.com/pitmap/)
|
|
44
46
|
|
|
45
47
|
Surface construction from scattered survey points for open-pit mine surveying.
|
|
46
48
|
|
|
@@ -53,6 +55,8 @@ kernel-based interpolator added for comparison. All methods share one
|
|
|
53
55
|
> **Status:** pre-alpha. The API will change. Nothing here is ready for
|
|
54
56
|
> production use yet.
|
|
55
57
|
|
|
58
|
+
Documentation: https://datasciencedynamics.com/pitmap/
|
|
59
|
+
|
|
56
60
|
## Methods
|
|
57
61
|
|
|
58
62
|
| Class | Method | Source |
|
|
@@ -92,7 +96,7 @@ model.predict(np.array([[2.0, 1.0], [9.0, 9.0]]))
|
|
|
92
96
|
## Repository layout
|
|
93
97
|
|
|
94
98
|
```
|
|
95
|
-
pitmap/
|
|
99
|
+
src/pitmap/ package; core/ holds the interpolators
|
|
96
100
|
data_gen.py fetch a raw DEM tile -> data/raw (Parquet, optional CSV)
|
|
97
101
|
preprocessing.py subsample to sparse survey points -> data/processed
|
|
98
102
|
notebooks/ analysis; outputs stripped before commit
|
|
@@ -109,6 +113,17 @@ make test
|
|
|
109
113
|
make help # list all targets
|
|
110
114
|
```
|
|
111
115
|
|
|
116
|
+
## Acknowledgements
|
|
117
|
+
|
|
118
|
+
The surface-construction methods implemented here were developed by
|
|
119
|
+
Prof. Oleksandr Zelenskyi, Volodymyr Lysenko and Oleksii Donchenko of the
|
|
120
|
+
Department of Informatics and Applied Software, State University of Economics
|
|
121
|
+
and Technology (Kryvyi Rih, Ukraine), over many years of work on automated
|
|
122
|
+
geological and mine-surveying support for open-pit mining. This package is an
|
|
123
|
+
independent open-source implementation of the methods as described in their
|
|
124
|
+
published papers (below); it contains none of their source code. Any errors in
|
|
125
|
+
the implementation are the package author's alone.
|
|
126
|
+
|
|
112
127
|
## References
|
|
113
128
|
|
|
114
129
|
Zelenskyi, O., Lysenko, V., Alekseyev, M., & Vlasov, V. (2020). Modeling of
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/pitmap/__init__.py
|
|
5
|
+
src/pitmap.egg-info/PKG-INFO
|
|
6
|
+
src/pitmap.egg-info/SOURCES.txt
|
|
7
|
+
src/pitmap.egg-info/dependency_links.txt
|
|
8
|
+
src/pitmap.egg-info/requires.txt
|
|
9
|
+
src/pitmap.egg-info/top_level.txt
|
|
10
|
+
tests/test_nearest_region.py
|
|
11
|
+
tests/test_sector_idw.py
|
|
File without changes
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"""Interpolators that share one fit/predict interface.
|
|
2
|
-
|
|
3
|
-
Each class takes survey points as an (n, 2) array of x, y coordinates and an
|
|
4
|
-
(n,) array of elevations (or any indicator such as ore grade) z, and predicts
|
|
5
|
-
z at new x, y locations.
|
|
6
|
-
|
|
7
|
-
Methods follow the automated geological and mine-surveying support system
|
|
8
|
-
described in Zelenskyi et al. (2020), Zelensky & Lysenko (2023), and
|
|
9
|
-
Zelensky & Donchenko (2025).
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from __future__ import annotations
|
|
13
|
-
|
|
14
|
-
import numpy as np
|
|
15
|
-
from scipy.interpolate import NearestNDInterpolator
|
|
16
|
-
from scipy.spatial import cKDTree
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def _check_xy_z(xy: np.ndarray, z: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
|
|
20
|
-
xy = np.asarray(xy, dtype=float)
|
|
21
|
-
z = np.asarray(z, dtype=float)
|
|
22
|
-
if xy.ndim != 2 or xy.shape[1] != 2:
|
|
23
|
-
raise ValueError("xy must have shape (n, 2)")
|
|
24
|
-
if z.shape != (xy.shape[0],):
|
|
25
|
-
raise ValueError("z must have shape (n,)")
|
|
26
|
-
return xy, z
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def _check_query(xy: np.ndarray) -> np.ndarray:
|
|
30
|
-
xy = np.asarray(xy, dtype=float)
|
|
31
|
-
if xy.ndim != 2 or xy.shape[1] != 2:
|
|
32
|
-
raise ValueError("query xy must have shape (m, 2)")
|
|
33
|
-
return xy
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class NearestRegion:
|
|
37
|
-
"""Polygonal (nearest-region / Thiessen polygon) surface.
|
|
38
|
-
|
|
39
|
-
Every location takes the elevation of its closest survey point, so the
|
|
40
|
-
surface is piecewise constant over the Voronoi cell of each point. This is
|
|
41
|
-
the classical polygonal method of mine surveying and reserve estimation
|
|
42
|
-
(Zelensky & Lysenko, 2023, section 4).
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
def __init__(self) -> None:
|
|
46
|
-
self._interp: NearestNDInterpolator | None = None
|
|
47
|
-
|
|
48
|
-
def fit(self, xy: np.ndarray, z: np.ndarray) -> "NearestRegion":
|
|
49
|
-
xy, z = _check_xy_z(xy, z)
|
|
50
|
-
self._interp = NearestNDInterpolator(xy, z)
|
|
51
|
-
return self
|
|
52
|
-
|
|
53
|
-
def predict(self, xy: np.ndarray) -> np.ndarray:
|
|
54
|
-
if self._interp is None:
|
|
55
|
-
raise RuntimeError("call fit() before predict()")
|
|
56
|
-
xy = _check_query(xy)
|
|
57
|
-
return self._interp(xy[:, 0], xy[:, 1])
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class SectorIDW:
|
|
61
|
-
"""Sector-constrained inverse distance weighting.
|
|
62
|
-
|
|
63
|
-
The value at a query point is a weighted average of nearby survey points,
|
|
64
|
-
with weight 1 / d**power (Zelenskyi et al., 2020; Zelensky & Donchenko,
|
|
65
|
-
2025, eq. 11). To stop a cluster of points on one side from dominating,
|
|
66
|
-
the search circle of the given radius is cut into ``n_sectors`` equal
|
|
67
|
-
angular sectors and only the single closest point in each sector is used
|
|
68
|
-
(2020 paper, Fig. 3). Query points with no survey point inside the radius
|
|
69
|
-
return NaN.
|
|
70
|
-
|
|
71
|
-
Parameters
|
|
72
|
-
----------
|
|
73
|
-
radius : float
|
|
74
|
-
Search radius in the units of xy.
|
|
75
|
-
power : float, default 2.0
|
|
76
|
-
Distance exponent alpha. 2 is the usual choice.
|
|
77
|
-
n_sectors : int, default 8
|
|
78
|
-
Number of angular sectors around each query point.
|
|
79
|
-
anisotropy : tuple[float, float] or None
|
|
80
|
-
Critical correlation radius along x and along y, (rk_x, rk_y). When
|
|
81
|
-
given, distances are scaled by rk_max / rk_axis before weighting so a
|
|
82
|
-
point along the better-correlated axis counts as closer (Zelensky &
|
|
83
|
-
Donchenko, 2025, eq. 12-13). None means isotropic.
|
|
84
|
-
"""
|
|
85
|
-
|
|
86
|
-
def __init__(
|
|
87
|
-
self,
|
|
88
|
-
radius: float,
|
|
89
|
-
power: float = 2.0,
|
|
90
|
-
n_sectors: int = 8,
|
|
91
|
-
anisotropy: tuple[float, float] | None = None,
|
|
92
|
-
) -> None:
|
|
93
|
-
if radius <= 0:
|
|
94
|
-
raise ValueError("radius must be positive")
|
|
95
|
-
if n_sectors < 1:
|
|
96
|
-
raise ValueError("n_sectors must be at least 1")
|
|
97
|
-
if anisotropy is not None:
|
|
98
|
-
rk_x, rk_y = anisotropy
|
|
99
|
-
if rk_x <= 0 or rk_y <= 0:
|
|
100
|
-
raise ValueError("anisotropy radii must be positive")
|
|
101
|
-
self.radius = float(radius)
|
|
102
|
-
self.power = float(power)
|
|
103
|
-
self.n_sectors = int(n_sectors)
|
|
104
|
-
self.anisotropy = anisotropy
|
|
105
|
-
self._xy: np.ndarray | None = None
|
|
106
|
-
self._z: np.ndarray | None = None
|
|
107
|
-
self._tree: cKDTree | None = None
|
|
108
|
-
|
|
109
|
-
# scale factors that stretch the axis with the shorter correlation radius
|
|
110
|
-
def _axis_scale(self) -> np.ndarray:
|
|
111
|
-
if self.anisotropy is None:
|
|
112
|
-
return np.ones(2)
|
|
113
|
-
rk = np.asarray(self.anisotropy, dtype=float)
|
|
114
|
-
return rk.max() / rk
|
|
115
|
-
|
|
116
|
-
def fit(self, xy: np.ndarray, z: np.ndarray) -> "SectorIDW":
|
|
117
|
-
xy, z = _check_xy_z(xy, z)
|
|
118
|
-
self._xy = xy
|
|
119
|
-
self._z = z
|
|
120
|
-
# the tree is built on scaled coordinates so the radius search already
|
|
121
|
-
# respects anisotropy
|
|
122
|
-
self._tree = cKDTree(xy * self._axis_scale())
|
|
123
|
-
return self
|
|
124
|
-
|
|
125
|
-
def _predict_one(self, q: np.ndarray) -> float:
|
|
126
|
-
assert self._tree is not None and self._xy is not None and self._z is not None
|
|
127
|
-
scale = self._axis_scale()
|
|
128
|
-
q_scaled = q * scale
|
|
129
|
-
idx = self._tree.query_ball_point(q_scaled, self.radius)
|
|
130
|
-
if len(idx) == 0:
|
|
131
|
-
return np.nan
|
|
132
|
-
idx = np.asarray(idx)
|
|
133
|
-
|
|
134
|
-
delta = self._xy[idx] * scale - q_scaled # (k, 2) offsets, scaled
|
|
135
|
-
d = np.hypot(delta[:, 0], delta[:, 1])
|
|
136
|
-
|
|
137
|
-
# a survey point sitting exactly on the query location wins outright
|
|
138
|
-
hit = np.where(d == 0.0)[0]
|
|
139
|
-
if hit.size:
|
|
140
|
-
return float(self._z[idx[hit[0]]])
|
|
141
|
-
|
|
142
|
-
# assign each candidate to an angular sector and keep the closest per sector
|
|
143
|
-
angle = np.arctan2(delta[:, 1], delta[:, 0]) # (-pi, pi]
|
|
144
|
-
sector = np.floor((angle + np.pi) / (2.0 * np.pi / self.n_sectors)).astype(int)
|
|
145
|
-
sector = np.clip(sector, 0, self.n_sectors - 1)
|
|
146
|
-
|
|
147
|
-
keep: list[int] = []
|
|
148
|
-
for s in np.unique(sector):
|
|
149
|
-
members = np.where(sector == s)[0]
|
|
150
|
-
keep.append(members[np.argmin(d[members])])
|
|
151
|
-
keep_arr = np.asarray(keep)
|
|
152
|
-
|
|
153
|
-
w = d[keep_arr] ** (-self.power)
|
|
154
|
-
return float(np.sum(w * self._z[idx[keep_arr]]) / np.sum(w))
|
|
155
|
-
|
|
156
|
-
def predict(self, xy: np.ndarray) -> np.ndarray:
|
|
157
|
-
if self._tree is None:
|
|
158
|
-
raise RuntimeError("call fit() before predict()")
|
|
159
|
-
xy = _check_query(xy)
|
|
160
|
-
return np.array([self._predict_one(q) for q in xy])
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
pitmap/__init__.py
|
|
5
|
-
pitmap.egg-info/PKG-INFO
|
|
6
|
-
pitmap.egg-info/SOURCES.txt
|
|
7
|
-
pitmap.egg-info/dependency_links.txt
|
|
8
|
-
pitmap.egg-info/requires.txt
|
|
9
|
-
pitmap.egg-info/top_level.txt
|
|
10
|
-
pitmap/core/__init__.py
|
|
11
|
-
pitmap/core/interpolation.py
|
|
12
|
-
tests/test_nearest_region.py
|
|
13
|
-
tests/test_sector_idw.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|