diff --git a/borea/format/rpc.py b/borea/format/rpc.py index 28acf1c..1187de4 100644 --- a/borea/format/rpc.py +++ b/borea/format/rpc.py @@ -9,6 +9,7 @@ from borea.transform_world_image.transform_shot.image_world_shot import ImageWorldShot from borea.transform_world_image.transform_shot.world_image_shot import WorldImageShot from borea.utils.miscellaneous.miscellaneous import normalize +from borea.utils.solver.solver import npsolve class Rpc: @@ -161,7 +162,7 @@ def least_square_rpc(self, img_norm: np.ndarray, world_norm: np.ndarray, np.array: Rpc coefficients. """ mat_obs = self.setup_matrix_obs_rpc(img_norm, world_norm, polynomial_degree) - x = np.linalg.lstsq(mat_obs, img_norm, rcond=None)[0] + x = npsolve(mat_obs, img_norm) coef_rpc = np.zeros(40) if polynomial_degree == 1: diff --git a/borea/transform_world_image/transform_worksite/space_resection.py b/borea/transform_world_image/transform_worksite/space_resection.py index b8c4e9f..62cdf64 100644 --- a/borea/transform_world_image/transform_worksite/space_resection.py +++ b/borea/transform_world_image/transform_worksite/space_resection.py @@ -13,6 +13,7 @@ # pylint: disable-next=line-too-long from borea.transform_world_image.transform_worksite.image_world_intersection import WorldIntersection # noqa: E501 from borea.utils.miscellaneous.param_bundle import set_param_bundle_diff +from borea.utils.solver.solver import npsolve class SpaceResection: @@ -240,8 +241,7 @@ def func_least_square(self, shot_adjust: Shot, obs: np.ndarray, # Creation of A with mat_obs_axia # Calculate dx = (A.T @ A)**-1 @ A.T @ B - return np.squeeze(np.linalg.lstsq(self.mat_obs_axia(pt_eucli, shot_adjust), - v_res, rcond=None)[0]) + return np.squeeze(npsolve(self.mat_obs_axia(pt_eucli, shot_adjust), v_res)) def mat_obs_axia(self, pt_eucli: np.ndarray, imc_adjust: Shot) -> np.ndarray: """ diff --git a/borea/utils/solver/__init__.py b/borea/utils/solver/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/borea/utils/solver/solver.py b/borea/utils/solver/solver.py new file mode 100644 index 0000000..fe0ddc4 --- /dev/null +++ b/borea/utils/solver/solver.py @@ -0,0 +1,18 @@ +""" +Least square solver used by Borea +""" +import numpy as np + + +def npsolve(mat_a: np.ndarray, mat_b: np.ndarray) -> np.ndarray: + """ + Solver used by Borea to resolve Ax = B + + Args: + mat_a (np.ndarray): Matrix A + mat_b (np.ndarray): Matrix B + + Returns: + np.ndarray: the result x + """ + return np.linalg.lstsq(mat_a, mat_b, rcond=None)[0] diff --git a/docs/sphinx/_build/doctrees/borea.datastruct.doctree b/docs/sphinx/_build/doctrees/borea.datastruct.doctree index 01725df..e90de06 100644 Binary files a/docs/sphinx/_build/doctrees/borea.datastruct.doctree and b/docs/sphinx/_build/doctrees/borea.datastruct.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.doctree b/docs/sphinx/_build/doctrees/borea.doctree index 240bcff..939584f 100644 Binary files a/docs/sphinx/_build/doctrees/borea.doctree and b/docs/sphinx/_build/doctrees/borea.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.format.doctree b/docs/sphinx/_build/doctrees/borea.format.doctree index 75134dd..6a3ceb7 100644 Binary files a/docs/sphinx/_build/doctrees/borea.format.doctree and b/docs/sphinx/_build/doctrees/borea.format.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.geodesy.doctree b/docs/sphinx/_build/doctrees/borea.geodesy.doctree index a42939c..7f555ef 100644 Binary files a/docs/sphinx/_build/doctrees/borea.geodesy.doctree and b/docs/sphinx/_build/doctrees/borea.geodesy.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.geodesy.projectionlist.doctree b/docs/sphinx/_build/doctrees/borea.geodesy.projectionlist.doctree index ac8d644..622b72b 100644 Binary files a/docs/sphinx/_build/doctrees/borea.geodesy.projectionlist.doctree and b/docs/sphinx/_build/doctrees/borea.geodesy.projectionlist.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.process.doctree b/docs/sphinx/_build/doctrees/borea.process.doctree index 388ed37..3082e69 100644 Binary files a/docs/sphinx/_build/doctrees/borea.process.doctree and b/docs/sphinx/_build/doctrees/borea.process.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.process.p_add_data.doctree b/docs/sphinx/_build/doctrees/borea.process.p_add_data.doctree index e56d3cf..febe195 100644 Binary files a/docs/sphinx/_build/doctrees/borea.process.p_add_data.doctree and b/docs/sphinx/_build/doctrees/borea.process.p_add_data.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.process.p_format.doctree b/docs/sphinx/_build/doctrees/borea.process.p_format.doctree index 60b4798..4835526 100644 Binary files a/docs/sphinx/_build/doctrees/borea.process.p_format.doctree and b/docs/sphinx/_build/doctrees/borea.process.p_format.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.process.p_func.doctree b/docs/sphinx/_build/doctrees/borea.process.p_func.doctree index c850cd6..fcdf84c 100644 Binary files a/docs/sphinx/_build/doctrees/borea.process.p_func.doctree and b/docs/sphinx/_build/doctrees/borea.process.p_func.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.reader.doctree b/docs/sphinx/_build/doctrees/borea.reader.doctree index 5616448..5425548 100644 Binary files a/docs/sphinx/_build/doctrees/borea.reader.doctree and b/docs/sphinx/_build/doctrees/borea.reader.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.reader.orientation.doctree b/docs/sphinx/_build/doctrees/borea.reader.orientation.doctree index 0b2d861..cd1aefa 100644 Binary files a/docs/sphinx/_build/doctrees/borea.reader.orientation.doctree and b/docs/sphinx/_build/doctrees/borea.reader.orientation.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.stat.doctree b/docs/sphinx/_build/doctrees/borea.stat.doctree index a108928..2b75da2 100644 Binary files a/docs/sphinx/_build/doctrees/borea.stat.doctree and b/docs/sphinx/_build/doctrees/borea.stat.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.transform_world_image.doctree b/docs/sphinx/_build/doctrees/borea.transform_world_image.doctree index 96a403b..0458184 100644 Binary files a/docs/sphinx/_build/doctrees/borea.transform_world_image.doctree and b/docs/sphinx/_build/doctrees/borea.transform_world_image.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_dtm.doctree b/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_dtm.doctree index 7484b6a..5c14600 100644 Binary files a/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_dtm.doctree and b/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_dtm.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_shot.doctree b/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_shot.doctree index 0075add..c191844 100644 Binary files a/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_shot.doctree and b/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_shot.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_worksite.doctree b/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_worksite.doctree index 1883304..2718bd9 100644 Binary files a/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_worksite.doctree and b/docs/sphinx/_build/doctrees/borea.transform_world_image.transform_worksite.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.utils.check.doctree b/docs/sphinx/_build/doctrees/borea.utils.check.doctree index d54c3b9..4080608 100644 Binary files a/docs/sphinx/_build/doctrees/borea.utils.check.doctree and b/docs/sphinx/_build/doctrees/borea.utils.check.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.utils.doctree b/docs/sphinx/_build/doctrees/borea.utils.doctree index d0d847f..c0a2c81 100644 Binary files a/docs/sphinx/_build/doctrees/borea.utils.doctree and b/docs/sphinx/_build/doctrees/borea.utils.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.utils.miscellaneous.doctree b/docs/sphinx/_build/doctrees/borea.utils.miscellaneous.doctree index acc28f3..af5db77 100644 Binary files a/docs/sphinx/_build/doctrees/borea.utils.miscellaneous.doctree and b/docs/sphinx/_build/doctrees/borea.utils.miscellaneous.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.utils.singleton.doctree b/docs/sphinx/_build/doctrees/borea.utils.singleton.doctree index 69be448..ef13ab2 100644 Binary files a/docs/sphinx/_build/doctrees/borea.utils.singleton.doctree and b/docs/sphinx/_build/doctrees/borea.utils.singleton.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.utils.solver.doctree b/docs/sphinx/_build/doctrees/borea.utils.solver.doctree new file mode 100644 index 0000000..5c60dea Binary files /dev/null and b/docs/sphinx/_build/doctrees/borea.utils.solver.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.utils.xml.doctree b/docs/sphinx/_build/doctrees/borea.utils.xml.doctree index 7e35aac..e96174c 100644 Binary files a/docs/sphinx/_build/doctrees/borea.utils.xml.doctree and b/docs/sphinx/_build/doctrees/borea.utils.xml.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.worksite.doctree b/docs/sphinx/_build/doctrees/borea.worksite.doctree index 11d1397..60d6430 100644 Binary files a/docs/sphinx/_build/doctrees/borea.worksite.doctree and b/docs/sphinx/_build/doctrees/borea.worksite.doctree differ diff --git a/docs/sphinx/_build/doctrees/borea.writer.doctree b/docs/sphinx/_build/doctrees/borea.writer.doctree index 567a971..5544f46 100644 Binary files a/docs/sphinx/_build/doctrees/borea.writer.doctree and b/docs/sphinx/_build/doctrees/borea.writer.doctree differ diff --git a/docs/sphinx/_build/doctrees/environment.pickle b/docs/sphinx/_build/doctrees/environment.pickle index ec7b082..f489c1c 100644 Binary files a/docs/sphinx/_build/doctrees/environment.pickle and b/docs/sphinx/_build/doctrees/environment.pickle differ diff --git a/docs/sphinx/_build/doctrees/index.doctree b/docs/sphinx/_build/doctrees/index.doctree index eb22bfe..606b00b 100644 Binary files a/docs/sphinx/_build/doctrees/index.doctree and b/docs/sphinx/_build/doctrees/index.doctree differ diff --git a/docs/sphinx/_build/doctrees/modules.doctree b/docs/sphinx/_build/doctrees/modules.doctree index 51f963f..6d2747f 100644 Binary files a/docs/sphinx/_build/doctrees/modules.doctree and b/docs/sphinx/_build/doctrees/modules.doctree differ diff --git a/docs/sphinx/_build/html/.buildinfo b/docs/sphinx/_build/html/.buildinfo index 2ed2435..49d9213 100644 --- a/docs/sphinx/_build/html/.buildinfo +++ b/docs/sphinx/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 504fc0b18f5078da3c2b6c957c5c94f7 +config: 1377150614254adb87c28fd596e900be tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/sphinx/_build/html/_modules/borea/datastruct/camera.html b/docs/sphinx/_build/html/_modules/borea/datastruct/camera.html index ddf8308..23b2e1f 100644 --- a/docs/sphinx/_build/html/_modules/borea/datastruct/camera.html +++ b/docs/sphinx/_build/html/_modules/borea/datastruct/camera.html @@ -5,7 +5,7 @@ - borea.datastruct.camera - Borea 1.0.0 documentation + borea.datastruct.camera - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@ +
diff --git a/docs/sphinx/_build/html/_modules/borea/datastruct/dtm.html b/docs/sphinx/_build/html/_modules/borea/datastruct/dtm.html index c7f8732..888140f 100644 --- a/docs/sphinx/_build/html/_modules/borea/datastruct/dtm.html +++ b/docs/sphinx/_build/html/_modules/borea/datastruct/dtm.html @@ -5,7 +5,7 @@ - borea.datastruct.dtm - Borea 1.0.0 documentation + borea.datastruct.dtm - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@ +
diff --git a/docs/sphinx/_build/html/_modules/borea/datastruct/gcp.html b/docs/sphinx/_build/html/_modules/borea/datastruct/gcp.html index 54a4071..416cc8c 100644 --- a/docs/sphinx/_build/html/_modules/borea/datastruct/gcp.html +++ b/docs/sphinx/_build/html/_modules/borea/datastruct/gcp.html @@ -5,7 +5,7 @@ - borea.datastruct.gcp - Borea 1.0.0 documentation + borea.datastruct.gcp - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@ +
diff --git a/docs/sphinx/_build/html/_modules/borea/datastruct/shot.html b/docs/sphinx/_build/html/_modules/borea/datastruct/shot.html index c3af9c4..dc1965e 100644 --- a/docs/sphinx/_build/html/_modules/borea/datastruct/shot.html +++ b/docs/sphinx/_build/html/_modules/borea/datastruct/shot.html @@ -5,7 +5,7 @@ - borea.datastruct.shot - Borea 1.0.0 documentation + borea.datastruct.shot - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@ +
diff --git a/docs/sphinx/_build/html/_modules/borea/datastruct/workdata.html b/docs/sphinx/_build/html/_modules/borea/datastruct/workdata.html index d75de28..5e565e1 100644 --- a/docs/sphinx/_build/html/_modules/borea/datastruct/workdata.html +++ b/docs/sphinx/_build/html/_modules/borea/datastruct/workdata.html @@ -5,7 +5,7 @@ - borea.datastruct.workdata - Borea 1.0.0 documentation + borea.datastruct.workdata - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@ +
diff --git a/docs/sphinx/_build/html/_modules/borea/format/conl.html b/docs/sphinx/_build/html/_modules/borea/format/conl.html index e0889df..7531774 100644 --- a/docs/sphinx/_build/html/_modules/borea/format/conl.html +++ b/docs/sphinx/_build/html/_modules/borea/format/conl.html @@ -5,7 +5,7 @@ - borea.format.conl - Borea 1.0.0 documentation + borea.format.conl - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@ +
diff --git a/docs/sphinx/_build/html/_modules/borea/format/rpc.html b/docs/sphinx/_build/html/_modules/borea/format/rpc.html index 97b4331..4ec50f7 100644 --- a/docs/sphinx/_build/html/_modules/borea/format/rpc.html +++ b/docs/sphinx/_build/html/_modules/borea/format/rpc.html @@ -5,7 +5,7 @@ - borea.format.rpc - Borea 1.0.0 documentation + borea.format.rpc - Borea 0.2.1 documentation @@ -165,7 +165,7 @@
-
Borea 1.0.0 documentation
+
Borea 0.2.1 documentation
@@ -189,7 +189,7 @@