open-space-toolkit-mathematics 4.2.2__py312-none-manylinux2014_aarch64.whl

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.

Potentially problematic release.


This version of open-space-toolkit-mathematics might be problematic. Click here for more details.

Files changed (56) hide show
  1. open_space_toolkit_mathematics-4.2.2.dist-info/METADATA +28 -0
  2. open_space_toolkit_mathematics-4.2.2.dist-info/RECORD +56 -0
  3. open_space_toolkit_mathematics-4.2.2.dist-info/WHEEL +5 -0
  4. open_space_toolkit_mathematics-4.2.2.dist-info/top_level.txt +1 -0
  5. open_space_toolkit_mathematics-4.2.2.dist-info/zip-safe +1 -0
  6. ostk/__init__.py +1 -0
  7. ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-312-aarch64-linux-gnu.so +0 -0
  8. ostk/mathematics/__init__.py +5 -0
  9. ostk/mathematics/libopen-space-toolkit-mathematics.so.4 +0 -0
  10. ostk/mathematics/test/__init__.py +1 -0
  11. ostk/mathematics/test/curve_fitting/__init__.py +1 -0
  12. ostk/mathematics/test/curve_fitting/interpolator/__init__.py +1 -0
  13. ostk/mathematics/test/curve_fitting/interpolator/test_barycentric_rational.py +34 -0
  14. ostk/mathematics/test/curve_fitting/interpolator/test_cubic_spline.py +45 -0
  15. ostk/mathematics/test/curve_fitting/interpolator/test_interpolator.py +71 -0
  16. ostk/mathematics/test/curve_fitting/interpolator/test_linear.py +35 -0
  17. ostk/mathematics/test/geometry/__init__.py +1 -0
  18. ostk/mathematics/test/geometry/d2/__init__.py +1 -0
  19. ostk/mathematics/test/geometry/d2/conftest.py +82 -0
  20. ostk/mathematics/test/geometry/d2/object/__init__.py +1 -0
  21. ostk/mathematics/test/geometry/d2/object/test_composite.py +96 -0
  22. ostk/mathematics/test/geometry/d2/object/test_line.py +57 -0
  23. ostk/mathematics/test/geometry/d2/object/test_linestring.py +174 -0
  24. ostk/mathematics/test/geometry/d2/object/test_multipolygon.py +101 -0
  25. ostk/mathematics/test/geometry/d2/object/test_point.py +213 -0
  26. ostk/mathematics/test/geometry/d2/object/test_point_set.py +103 -0
  27. ostk/mathematics/test/geometry/d2/object/test_polygon.py +370 -0
  28. ostk/mathematics/test/geometry/d2/object/test_segment.py +104 -0
  29. ostk/mathematics/test/geometry/d2/test_object.py +25 -0
  30. ostk/mathematics/test/geometry/d2/test_transformation.py +84 -0
  31. ostk/mathematics/test/geometry/d3/__init__.py +1 -0
  32. ostk/mathematics/test/geometry/d3/object/__init__.py +1 -0
  33. ostk/mathematics/test/geometry/d3/object/test_composite.py +262 -0
  34. ostk/mathematics/test/geometry/d3/object/test_cuboid.py +20 -0
  35. ostk/mathematics/test/geometry/d3/object/test_line.py +68 -0
  36. ostk/mathematics/test/geometry/d3/object/test_linestring.py +168 -0
  37. ostk/mathematics/test/geometry/d3/object/test_point.py +234 -0
  38. ostk/mathematics/test/geometry/d3/object/test_point_set.py +116 -0
  39. ostk/mathematics/test/geometry/d3/object/test_polygon.py +141 -0
  40. ostk/mathematics/test/geometry/d3/object/test_segment.py +120 -0
  41. ostk/mathematics/test/geometry/d3/objects/test_cuboid.py +20 -0
  42. ostk/mathematics/test/geometry/d3/test_intersection.py +3 -0
  43. ostk/mathematics/test/geometry/d3/test_object.py +3 -0
  44. ostk/mathematics/test/geometry/d3/test_transformation.py +3 -0
  45. ostk/mathematics/test/geometry/d3/transformation/__init__.py +1 -0
  46. ostk/mathematics/test/geometry/d3/transformation/rotation/__init__.py +1 -0
  47. ostk/mathematics/test/geometry/d3/transformation/rotation/test_euler_angle.py +138 -0
  48. ostk/mathematics/test/geometry/d3/transformation/rotation/test_quaternion.py +184 -0
  49. ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_matrix.py +29 -0
  50. ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_vector.py +47 -0
  51. ostk/mathematics/test/geometry/test_angle.py +345 -0
  52. ostk/mathematics/test/object/__init__.py +1 -0
  53. ostk/mathematics/test/object/test_interval.py +515 -0
  54. ostk/mathematics/test/object/test_vector.py +5 -0
  55. ostk/mathematics/test/solver/test_numerical_solver.py +176 -0
  56. ostk/mathematics/test/test_object.py +24 -0
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: open-space-toolkit-mathematics
3
+ Version: 4.2.2
4
+ Summary: Geometry, curve fitting, optimization.
5
+ Author: Open Space Collective
6
+ Author-email: contact@open-space-collective.org
7
+ License: Apache License 2.0
8
+ Keywords: open-space-collective,open-space-toolkit mathematics
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: numpy <3.0,>=1.0
15
+ Requires-Dist: open-space-toolkit-core ~=4.0
16
+
17
+ # Open Space Toolkit ▸ Mathematics
18
+
19
+ Geometry, curve fitting, optimization.
20
+
21
+ [![Build and Test](https://github.com/open-space-collective/open-space-toolkit-mathematics/actions/workflows/build-test.yml/badge.svg?branch=main)](https://github.com/open-space-collective/open-space-toolkit-mathematics/actions/workflows/build-test.yml)
22
+ [![Code Coverage](https://codecov.io/gh/open-space-collective/open-space-toolkit-mathematics/branch/main/graph/badge.svg)](https://codecov.io/gh/open-space-collective/open-space-toolkit-mathematics)
23
+ [![Documentation](https://img.shields.io/readthedocs/pip/stable.svg)](https://open-space-collective.github.io/open-space-toolkit-mathematics)
24
+ [![GitHub version](https://badge.fury.io/gh/open-space-collective%2Fopen-space-toolkit-mathematics.svg)](https://badge.fury.io/gh/open-space-collective%2Fopen-space-toolkit-mathematics)
25
+ [![PyPI version](https://badge.fury.io/py/open-space-toolkit-mathematics.svg)](https://badge.fury.io/py/open-space-toolkit-mathematics)
26
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
27
+
28
+ [GitHub](https://github.com/open-space-collective/open-space-toolkit-mathematics)
@@ -0,0 +1,56 @@
1
+ ostk/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
2
+ ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-312-aarch64-linux-gnu.so,sha256=xw5J5Y6qTgJiyw1uOWQ0WMGg3OO_jFu0w5W_LJrHqFA,1570520
3
+ ostk/mathematics/__init__.py,sha256=U81I6jh2hIPyuT4dtZjNcLi-CQ8yXIvtFn32tVK1YCY,92
4
+ ostk/mathematics/libopen-space-toolkit-mathematics.so.4,sha256=QGpNS1xqN_mVNasWafYLN2fYyAvTzVPp4YNzHxo0wPM,2444968
5
+ ostk/mathematics/test/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
6
+ ostk/mathematics/test/test_object.py,sha256=WtksTu9zz8_UNkQYKLO64nNBFDBkRWM_DXFuAWTdKUM,1027
7
+ ostk/mathematics/test/curve_fitting/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
8
+ ostk/mathematics/test/curve_fitting/interpolator/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
9
+ ostk/mathematics/test/curve_fitting/interpolator/test_barycentric_rational.py,sha256=T2aqrwvb48GrIsNzH2tZpwM5Pc7HQfPx73yvxx-0A6o,1117
10
+ ostk/mathematics/test/curve_fitting/interpolator/test_cubic_spline.py,sha256=h2u0_0neNHKzgh4-i25VWSGZLJe6bzP2waZ-GRy8thc,1378
11
+ ostk/mathematics/test/curve_fitting/interpolator/test_interpolator.py,sha256=46px5NKN8TJO9L9KbopsK9pixq0j3_Xu7PchDQTSEPQ,2093
12
+ ostk/mathematics/test/curve_fitting/interpolator/test_linear.py,sha256=9axYpdxqQksp5SNEDdDgq2NMLyBO_q0Y-HYhEbsb9wY,1111
13
+ ostk/mathematics/test/geometry/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
14
+ ostk/mathematics/test/geometry/test_angle.py,sha256=HOzlWUApgN6LN0g0Zts0cFQ6In_nmbYpFb3CnWWHVR0,10136
15
+ ostk/mathematics/test/geometry/d2/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
16
+ ostk/mathematics/test/geometry/d2/conftest.py,sha256=pKLQ32AMokx_5-Y5Xks9kj-okj1o6vn2XUOkU1RWkPE,1759
17
+ ostk/mathematics/test/geometry/d2/test_object.py,sha256=JwyeSL4JIR8LY2is0SJKdoTeKiJINDv4b8uFd6dY75c,546
18
+ ostk/mathematics/test/geometry/d2/test_transformation.py,sha256=WEG_qVZFx-0wZB6Qn3uHKBGdEJ04fq5Vds2Kqx_YkO0,2095
19
+ ostk/mathematics/test/geometry/d2/object/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
20
+ ostk/mathematics/test/geometry/d2/object/test_composite.py,sha256=w7-pm2fsoRutDGmQ7ZJjm1X6yW-OHl6w7oArrT7_VxA,2763
21
+ ostk/mathematics/test/geometry/d2/object/test_line.py,sha256=Dr0uHk-gFLJcsC69W1DBCvvipLlAbTVPBxigJGKXORQ,1433
22
+ ostk/mathematics/test/geometry/d2/object/test_linestring.py,sha256=EucjDiSSQ2Ab3-huWtfanE6Cb0Jazb78LUuiFnpe8Mo,5933
23
+ ostk/mathematics/test/geometry/d2/object/test_multipolygon.py,sha256=kxLhoygnMIiSreFvf3C2nycFpZjZCHcit96cN0y5QYo,3543
24
+ ostk/mathematics/test/geometry/d2/object/test_point.py,sha256=Eoq1FAYB6W4yrjpassgG9PRb3Zdg2DOjpmTZZuNiQ9M,6457
25
+ ostk/mathematics/test/geometry/d2/object/test_point_set.py,sha256=hxrck57IHXDkZa0FV717eAvj_sbDtUIqC2LX-ae4EZ0,3337
26
+ ostk/mathematics/test/geometry/d2/object/test_polygon.py,sha256=fHEJDXmzgl24-eQ3gMGIBwNZsEa-3F6_8T6eLzaVgFI,12621
27
+ ostk/mathematics/test/geometry/d2/object/test_segment.py,sha256=M1QTkseGo1ADeslcEl5JzlQEc_1-1LpBV4av_FuPX7E,3072
28
+ ostk/mathematics/test/geometry/d3/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
29
+ ostk/mathematics/test/geometry/d3/test_intersection.py,sha256=7QrduhVXyTHG0lGLEHNgv4olvFrR6TR0MNgu9acmRd4,61
30
+ ostk/mathematics/test/geometry/d3/test_object.py,sha256=7QrduhVXyTHG0lGLEHNgv4olvFrR6TR0MNgu9acmRd4,61
31
+ ostk/mathematics/test/geometry/d3/test_transformation.py,sha256=7QrduhVXyTHG0lGLEHNgv4olvFrR6TR0MNgu9acmRd4,61
32
+ ostk/mathematics/test/geometry/d3/object/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
33
+ ostk/mathematics/test/geometry/d3/object/test_composite.py,sha256=03wi6k35a2lwyM29q5STjqX4CHL1IofYm2hBzERQlzU,7710
34
+ ostk/mathematics/test/geometry/d3/object/test_cuboid.py,sha256=xJp6ImRnkNw_k6Tt8RaSXlsGnSqM-SlQSBfbm7SwJuA,470
35
+ ostk/mathematics/test/geometry/d3/object/test_line.py,sha256=d-CvDjXeH1WQcleCU2yt4FdHLhWgy45NGzn3mEwy6xE,1690
36
+ ostk/mathematics/test/geometry/d3/object/test_linestring.py,sha256=L2gEJGDOaP17RgbLbX0-kBjskW_MrPLxVyf_l9yyxag,5938
37
+ ostk/mathematics/test/geometry/d3/object/test_point.py,sha256=-5Cjy3Pru3UWbMO7vBDNiJYfUkqVVxxZtDgsMYYaosc,6611
38
+ ostk/mathematics/test/geometry/d3/object/test_point_set.py,sha256=ceMRMNcnVAAsuMWORMW6wwJDNbTtMn3y-4rWR04QnPM,3605
39
+ ostk/mathematics/test/geometry/d3/object/test_polygon.py,sha256=7ZjucWMsNzppN3pptxHgGgOtOGv1grseT7VnctgOJP4,4262
40
+ ostk/mathematics/test/geometry/d3/object/test_segment.py,sha256=HWg-BCJoa74EgWlvUPd85v_qR2p9THi0ejhtG0EQNEA,4027
41
+ ostk/mathematics/test/geometry/d3/objects/test_cuboid.py,sha256=uIDwPbkygXFIopKc2kayKYgadNfOKD_zxf3w2J4DfTY,471
42
+ ostk/mathematics/test/geometry/d3/transformation/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
43
+ ostk/mathematics/test/geometry/d3/transformation/rotation/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
44
+ ostk/mathematics/test/geometry/d3/transformation/rotation/test_euler_angle.py,sha256=eTIxAqUfCQj6eZfoQgNu-1xFg0O4sbKk4n8XHQwXD2E,4393
45
+ ostk/mathematics/test/geometry/d3/transformation/rotation/test_quaternion.py,sha256=CFau3zwBUWj-KELNdjhCd88teUh8U9f0wpNDDeObr60,6867
46
+ ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_matrix.py,sha256=pD-zR2e1uMTD2eenjQiFPPMKji_gdnuYPuDYQ7pGgUg,1055
47
+ ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_vector.py,sha256=ngzrvqH_0QRGwNsWc2RupUkpsTU5vZI-eoh5q2BkKRQ,1568
48
+ ostk/mathematics/test/object/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
49
+ ostk/mathematics/test/object/test_interval.py,sha256=rf7tL-m76inO18rzxopkWrk-cSjKhoN5xXek6e53wAU,21708
50
+ ostk/mathematics/test/object/test_vector.py,sha256=5MG3s8vhgoGKAIc5GzswlZObyIrJDIPNtsEd5wNORPU,76
51
+ ostk/mathematics/test/solver/test_numerical_solver.py,sha256=5Z7uXlvfQ_pjrSAOd7ff-ky5pjRZk3-R0F565FfCUrU,5672
52
+ open_space_toolkit_mathematics-4.2.2.dist-info/METADATA,sha256=amu-XuPENkcrNKaYKZWpVOtcXn4M2KL6q-l4ljvnkz0,1806
53
+ open_space_toolkit_mathematics-4.2.2.dist-info/WHEEL,sha256=BkukRh3yV-0ShqWpqM9MJTPX0A9STjzkdXRVhnNRK8E,111
54
+ open_space_toolkit_mathematics-4.2.2.dist-info/top_level.txt,sha256=zOR18699uDYnafgarhL8WU_LmTZY_5NVqutv-flp_x4,5
55
+ open_space_toolkit_mathematics-4.2.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
56
+ open_space_toolkit_mathematics-4.2.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (71.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py312-none-manylinux2014_aarch64
5
+
ostk/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,5 @@
1
+ # Apache License 2.0
2
+
3
+ from ostk.core import *
4
+
5
+ from .OpenSpaceToolkitMathematicsPy import *
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,34 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.mathematics.curve_fitting import Interpolator
6
+ from ostk.mathematics.curve_fitting.interpolator import BarycentricRational
7
+
8
+
9
+ @pytest.fixture
10
+ def interpolator() -> BarycentricRational:
11
+ return BarycentricRational(
12
+ x=[0.0, 1.0, 2.0, 4.0, 5.0, 6.0], y=[0.0, 3.0, 6.0, 9.0, 17.0, 5.0]
13
+ )
14
+
15
+
16
+ class TestBarycentricRational:
17
+ def test_constructor_success(self, interpolator: BarycentricRational):
18
+ assert interpolator is not None
19
+ assert isinstance(interpolator, Interpolator)
20
+ assert isinstance(interpolator, BarycentricRational)
21
+
22
+ def test_evaluate(self, interpolator: BarycentricRational):
23
+
24
+ assert interpolator.evaluate(0.0) == 0.0
25
+ assert interpolator.evaluate(1.0) == 3.0
26
+ assert interpolator.evaluate(2.0) == 6.0
27
+ assert interpolator.evaluate(4.0) == 9.0
28
+ assert interpolator.evaluate(5.0) == 17.0
29
+ assert interpolator.evaluate(6.0) == 5.0
30
+
31
+ assert (
32
+ interpolator.evaluate(x=[0.0, 1.0, 2.0, 4.0, 5.0, 6.0])
33
+ == [0.0, 3.0, 6.0, 9.0, 17.0, 5.0]
34
+ ).all()
@@ -0,0 +1,45 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ from ostk.mathematics.curve_fitting import Interpolator
8
+ from ostk.mathematics.curve_fitting.interpolator import CubicSpline
9
+
10
+
11
+ @pytest.fixture
12
+ def interpolator() -> CubicSpline:
13
+ return CubicSpline(
14
+ x=[0.0, 1.0, 2.0, 3.0, 4.0, 5.0], y=[0.0, 3.0, 6.0, 9.0, 17.0, 5.0]
15
+ )
16
+
17
+
18
+ class TestCubicSpline:
19
+ def test_constructor_success(self, interpolator: CubicSpline):
20
+ assert interpolator is not None
21
+ assert isinstance(interpolator, Interpolator)
22
+ assert isinstance(interpolator, CubicSpline)
23
+
24
+ def test_default_constructor_2(self):
25
+ CubicSpline(y=[0.0, 3.0, 6.0, 9.0, 17.0, 5.0], x_0=0.0, h=1.0)
26
+
27
+ def test_evaluate(self):
28
+ y: list[float] = [
29
+ -4.632122947015880607e06,
30
+ -4.638362755234977230e06,
31
+ -4.644761115514834411e06,
32
+ -4.650595795951002277e06,
33
+ -4.655866062354639173e06,
34
+ -4.660571249500595033e06,
35
+ -4.664710761221675202e06,
36
+ -4.668284070493859239e06,
37
+ -4.671290719512360170e06,
38
+ -4.673730319758670405e06,
39
+ ]
40
+ interpolator = CubicSpline(y, 0.0, 10.0)
41
+
42
+ for i in range(10):
43
+ assert pytest.approx(interpolator.evaluate(i * 10.0)) == y[i]
44
+
45
+ assert pytest.approx(interpolator.evaluate(np.linspace(0.0, 90.0, 10))) == y
@@ -0,0 +1,71 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.mathematics.curve_fitting import Interpolator
6
+
7
+
8
+ @pytest.fixture
9
+ def interpolation_type() -> Interpolator.Type:
10
+ return Interpolator.Type.Linear
11
+
12
+
13
+ @pytest.fixture
14
+ def interpolator(interpolation_type: Interpolator.Type) -> Interpolator:
15
+ class MyInterpolator(Interpolator):
16
+ def evaluate(self, x: list[float]) -> list[float]:
17
+ return x
18
+
19
+ def evaluate(self, x: float) -> float:
20
+ return x
21
+
22
+ return MyInterpolator(interpolation_type=interpolation_type)
23
+
24
+
25
+ class TestInterpolator:
26
+ def test_subclass(self, interpolator: Interpolator):
27
+ assert interpolator is not None
28
+ assert isinstance(interpolator, Interpolator)
29
+
30
+ def test_get_interpolation_type(
31
+ self,
32
+ interpolator: Interpolator,
33
+ interpolation_type: Interpolator.Type,
34
+ ):
35
+ assert interpolator.get_interpolation_type() == interpolation_type
36
+
37
+ @pytest.mark.parametrize(
38
+ "parametrized_interpolation_type, x, y",
39
+ [
40
+ (
41
+ Interpolator.Type.BarycentricRational,
42
+ [0.0, 1.0, 2.0, 4.0, 5.0, 6.0],
43
+ [0.0, 3.0, 6.0, 9.0, 17.0, 5.0],
44
+ ),
45
+ (
46
+ Interpolator.Type.CubicSpline,
47
+ [0.0, 1.0, 2.0, 3.0, 4.0, 5.0],
48
+ [0.0, 3.0, 6.0, 9.0, 17.0, 5.0],
49
+ ),
50
+ (
51
+ Interpolator.Type.Linear,
52
+ [0.0, 1.0, 2.0, 4.0, 5.0, 6.0],
53
+ [0.0, 3.0, 6.0, 9.0, 17.0, 5.0],
54
+ ),
55
+ ],
56
+ )
57
+ def test_generate_interpolators(
58
+ self,
59
+ parametrized_interpolation_type: Interpolator.Type,
60
+ x: list[float],
61
+ y: list[float],
62
+ ):
63
+ interpolator: Interpolator = Interpolator.generate_interpolator(
64
+ interpolation_type=parametrized_interpolation_type,
65
+ x=x,
66
+ y=y,
67
+ )
68
+
69
+ assert interpolator is not None
70
+ assert isinstance(interpolator, Interpolator)
71
+ assert interpolator.get_interpolation_type() == parametrized_interpolation_type
@@ -0,0 +1,35 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.mathematics.curve_fitting import Interpolator
6
+ from ostk.mathematics.curve_fitting.interpolator import Linear
7
+
8
+
9
+ @pytest.fixture
10
+ def interpolator() -> Linear:
11
+ return Linear(x=[0.0, 1.0, 2.0, 4.0, 5.0, 6.0], y=[0.0, 3.0, 6.0, 9.0, 17.0, 5.0])
12
+
13
+
14
+ class TestLinear:
15
+ def test_constructor_success(self, interpolator: Linear):
16
+ assert interpolator is not None
17
+ assert isinstance(interpolator, Interpolator)
18
+ assert isinstance(interpolator, Linear)
19
+
20
+ def test_evaluate(self):
21
+ interpolator = Linear(
22
+ x=[0.0, 1.0, 2.0, 4.0, 5.0, 6.0], y=[0.0, 3.0, 6.0, 9.0, 17.0, 5.0]
23
+ )
24
+
25
+ assert interpolator.evaluate(0.0) == 0.0
26
+ assert interpolator.evaluate(1.0) == 3.0
27
+ assert interpolator.evaluate(2.0) == 6.0
28
+ assert interpolator.evaluate(4.0) == 9.0
29
+ assert interpolator.evaluate(5.0) == 17.0
30
+ assert interpolator.evaluate(6.0) == 5.0
31
+
32
+ assert (
33
+ interpolator.evaluate(x=[0.0, 1.0, 2.0, 4.0, 5.0, 6.0])
34
+ == [0.0, 3.0, 6.0, 9.0, 17.0, 5.0]
35
+ ).all()
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,82 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ import ostk.mathematics as mathematics
8
+
9
+
10
+ Point = mathematics.geometry.d2.object.Point
11
+ PointSet = mathematics.geometry.d2.object.PointSet
12
+ Line = mathematics.geometry.d2.object.Line
13
+ Segment = mathematics.geometry.d2.object.Segment
14
+ Polygon = mathematics.geometry.d2.object.Polygon
15
+ Composite = mathematics.geometry.d2.object.Composite
16
+
17
+
18
+ @pytest.fixture
19
+ def point() -> Point:
20
+ return Point(-2.0, 5.0)
21
+
22
+
23
+ @pytest.fixture
24
+ def point_set() -> PointSet:
25
+ return PointSet([Point(1.0, 2.0), Point(2.0, 3.0)])
26
+
27
+
28
+ @pytest.fixture
29
+ def line() -> Line:
30
+ return Line(Point(1.0, 2.0), np.array((1.0, 1.0)))
31
+
32
+
33
+ @pytest.fixture
34
+ def segment() -> Segment:
35
+ return Segment(Point(0.0, 0.0), Point(0.0, 2.0))
36
+
37
+
38
+ @pytest.fixture
39
+ def polygon() -> Polygon:
40
+ point_1: Point = Point(-1.0, 1.0)
41
+ point_2: Point = Point(1.0, 1.0)
42
+ point_3: Point = Point(1.0, -1.0)
43
+ point_4: Point = Point(-1.0, -1.0)
44
+
45
+ return Polygon([point_1, point_2, point_3, point_4])
46
+
47
+
48
+ def square(center: Point) -> Polygon:
49
+ point_1: Point = center + [0.5, 0.5]
50
+ point_2: Point = center + [0.5, -0.5]
51
+ point_3: Point = center + [-0.5, -0.5]
52
+ point_4: Point = center + [-0.5, 0.5]
53
+
54
+ return Polygon([point_1, point_2, point_3, point_4])
55
+
56
+
57
+ @pytest.fixture
58
+ def square_1() -> Polygon:
59
+ return square(Point(0.0, 0.0))
60
+
61
+
62
+ @pytest.fixture
63
+ def square_2() -> Polygon:
64
+ return square(Point(0.0, 10.0))
65
+
66
+
67
+ @pytest.fixture
68
+ def square_3() -> Polygon:
69
+ return square(Point(0.5, 0.0))
70
+
71
+
72
+ @pytest.fixture
73
+ def square_4() -> Polygon:
74
+ return square(Point(1.0, 0.0))
75
+
76
+
77
+ @pytest.fixture
78
+ def composite(polygon: Polygon, point: Point) -> Composite:
79
+ composite = Composite(polygon)
80
+ composite += Composite(point)
81
+
82
+ return composite
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,96 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import ostk.mathematics as mathematics
6
+
7
+
8
+ Object = mathematics.geometry.d2.Object
9
+ Point = mathematics.geometry.d2.object.Point
10
+ Polygon = mathematics.geometry.d2.object.Polygon
11
+ Composite = mathematics.geometry.d2.object.Composite
12
+
13
+
14
+ class TestComposite:
15
+ def test_constructor_success(self, polygon: Polygon):
16
+ composite: Composite = Composite(polygon)
17
+
18
+ assert composite is not None
19
+ assert isinstance(composite, Composite)
20
+ assert composite.is_defined()
21
+
22
+ def test_empty_success(self):
23
+ composite: Composite = Composite.empty()
24
+
25
+ assert composite is not None
26
+ assert isinstance(composite, Composite)
27
+ assert isinstance(composite, Object)
28
+ assert composite.is_defined()
29
+ assert composite.is_empty()
30
+
31
+ def test_is_defined_success(self):
32
+ composite: Composite = Composite.undefined()
33
+
34
+ assert composite is not None
35
+ assert isinstance(composite, Composite)
36
+ assert isinstance(composite, Object)
37
+ assert composite.is_defined() is False
38
+
39
+ def test_comparators_success(
40
+ self,
41
+ composite: Composite,
42
+ polygon: Polygon,
43
+ ):
44
+ other_composite: Composite = Composite(polygon)
45
+
46
+ assert composite == composite
47
+ assert composite != other_composite
48
+ assert other_composite != composite
49
+
50
+ def test_addition_operator_success(
51
+ self,
52
+ composite: Composite,
53
+ polygon: Polygon,
54
+ ):
55
+ assert composite is not None
56
+ assert isinstance(composite, Composite)
57
+ assert composite.is_defined()
58
+ assert composite.get_object_count() == 2
59
+
60
+ with pytest.raises(RuntimeError):
61
+ other_composite = Composite.undefined() + composite
62
+
63
+ with pytest.raises(RuntimeError):
64
+ other_composite = composite + Composite.undefined()
65
+
66
+ composite += composite
67
+
68
+ assert isinstance(composite, Composite)
69
+ assert composite.is_defined()
70
+ assert composite.get_object_count() == 4
71
+
72
+ with pytest.raises(RuntimeError):
73
+ composite += Composite.undefined()
74
+
75
+ def test_is_success(
76
+ self,
77
+ composite: Composite,
78
+ polygon: Polygon,
79
+ ):
80
+ assert composite.is_point() is False
81
+ assert composite.is_polygon() is False
82
+
83
+ assert Composite(polygon).is_polygon()
84
+
85
+ def test_access_object_at_success(
86
+ self,
87
+ composite: Composite,
88
+ polygon: Polygon,
89
+ point: Point,
90
+ ):
91
+ assert composite.get_object_count() == 2
92
+ assert composite.access_object_at(0) == polygon
93
+ assert composite.access_object_at(1) == point
94
+
95
+ with pytest.raises(RuntimeError):
96
+ composite.access_object_at(2)
@@ -0,0 +1,57 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ import ostk.mathematics as mathematics
8
+
9
+
10
+ Object = mathematics.geometry.d2.Object
11
+ Point = mathematics.geometry.d2.object.Point
12
+ PointSet = mathematics.geometry.d2.object.PointSet
13
+ Line = mathematics.geometry.d2.object.Line
14
+
15
+
16
+ class TestLine:
17
+ def test_constructor_success(self):
18
+ line = Line(
19
+ Point(1.0, 2.0),
20
+ np.array((3.4, 1.0)),
21
+ )
22
+
23
+ assert line is not None
24
+ assert isinstance(line, Line)
25
+ assert isinstance(line, Object)
26
+ assert line.is_defined()
27
+
28
+ def test_contains_success_point_set(
29
+ self,
30
+ line: Line,
31
+ point_set: PointSet,
32
+ ):
33
+ assert line.contains(point_set) is True
34
+
35
+ def test_distance_to_success_point(
36
+ self,
37
+ line: Line,
38
+ ):
39
+ assert float(line.distance_to(Point(2.0, 3.0))) == pytest.approx(0.0, 1e-5)
40
+ assert float(line.distance_to(Point(1.0, 5.0))) == pytest.approx(2.12132, 1e-5)
41
+
42
+ def test_undefined_success(self):
43
+ line = Line.undefined()
44
+
45
+ assert line is not None
46
+ assert isinstance(line, Line)
47
+ assert isinstance(line, Object)
48
+ assert line.is_defined() is False
49
+
50
+ def test_points_success(
51
+ self,
52
+ line: Line,
53
+ ):
54
+ assert line is not None
55
+ assert isinstance(line, Line)
56
+ assert isinstance(line, Object)
57
+ assert line.is_defined() is True