Skip to content

Commit 25a8a83

Browse files
committed
[core] fixed numpy typing in calc module
1 parent 0cc098c commit 25a8a83

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/instrumentman/calculations.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Sequence
33

44
import numpy as np
5+
import numpy.typing as npt
56
from geocompy.data import Angle, Coordinate
67

78

@@ -132,7 +133,7 @@ def _weights_resection_horizontal(
132133
accuracy_hz: float = 1,
133134
accuracy_v: float = 1,
134135
accuracy_d: tuple[float, float] = (1, 1.5)
135-
) -> np.ndarray:
136+
) -> npt.NDArray[np.floating]:
136137
weights: list[float] = []
137138

138139
accuracy_sd, accuracy_sd_ppm = accuracy_d
@@ -162,7 +163,7 @@ def _weights_resection_vertical(
162163
targets: list[Coordinate],
163164
*,
164165
accuracy_v: float = 1
165-
) -> np.ndarray:
166+
) -> npt.NDArray[np.floating]:
166167
weights: list[float] = []
167168

168169
accuracy_v_rad = math.radians(accuracy_v / 3600)
@@ -187,8 +188,8 @@ def _iter_resection_horizontal(
187188
targets: list[Coordinate],
188189
station: Coordinate,
189190
orientation: Angle,
190-
weights: np.ndarray,
191-
) -> tuple[np.ndarray, np.ndarray]:
191+
weights: npt.NDArray[np.floating],
192+
) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]]:
192193
design_float, obs_float = _matrices_resection_horizontal(
193194
measurements,
194195
targets,
@@ -215,8 +216,8 @@ def _iter_resection_vertical(
215216
measurements: list[tuple[Angle, Angle, float]],
216217
targets: list[Coordinate],
217218
station: Coordinate,
218-
weights: np.ndarray
219-
) -> tuple[np.ndarray, np.ndarray]:
219+
weights: npt.NDArray[np.floating]
220+
) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]]:
220221
design_float, obs_float = _matrices_resection_vertical(
221222
measurements,
222223
targets,
@@ -262,7 +263,10 @@ def resection_horizontal(
262263
o_tolerance = float(orientation_tolerance)
263264

264265
if uniform_weights:
265-
weights = np.eye(len(measurements) * 2)
266+
weights: npt.NDArray[np.floating] = np.eye(
267+
len(measurements) * 2,
268+
dtype=np.float64
269+
)
266270
else:
267271
weights = _weights_resection_horizontal(
268272
measurements,
@@ -316,7 +320,10 @@ def resection_vertical(
316320
accuracy_v: float = 1
317321
) -> tuple[Coordinate, Coordinate]:
318322
if uniform_weights:
319-
weights = np.eye(len(measurements))
323+
weights: npt.NDArray[np.floating] = np.eye(
324+
len(measurements),
325+
dtype=np.float64
326+
)
320327
else:
321328
weights = _weights_resection_vertical(
322329
measurements,

0 commit comments

Comments
 (0)