c4dynamics 2.0.3__tar.gz → 2.2.0__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.
- c4dynamics-2.2.0/LICENSE +21 -0
- c4dynamics-2.2.0/PKG-INFO +169 -0
- c4dynamics-2.2.0/README.md +143 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/__init__.py +92 -17
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/datasets/__init__.py +21 -19
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/datasets/_manager.py +32 -15
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/datasets/_registry.py +5 -2
- c4dynamics-2.2.0/c4dynamics/detectors/__init__.py +26 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/detectors/yolo3_opencv.py +9 -31
- c4dynamics-2.2.0/c4dynamics/envs/__init__.py +13 -0
- c4dynamics-2.2.0/c4dynamics/envs/mountain_car.py +750 -0
- {c4dynamics-2.0.3/c4dynamics/detectors → c4dynamics-2.2.0/c4dynamics/eqm}/__init__.py +5 -6
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/eqm/derivs.py +2 -20
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/eqm/integrate.py +2 -20
- c4dynamics-2.2.0/c4dynamics/filters/__init__.py +118 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/filters/ekf.py +7 -25
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/filters/kalman.py +13 -29
- c4dynamics-2.2.0/c4dynamics/rotmat/__init__.py +36 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/rotmat/animate.py +16 -21
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/rotmat/rotmat.py +2 -21
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/sensors/__init__.py +14 -21
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/sensors/radar.py +2 -21
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/sensors/seeker.py +4 -28
- c4dynamics-2.2.0/c4dynamics/states/__init__.py +33 -0
- c4dynamics-2.2.0/c4dynamics/states/lib/__init__.py +40 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/states/lib/datapoint.py +11 -32
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/states/lib/pixelpoint.py +2 -20
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/states/lib/rigidbody.py +8 -38
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/states/state.py +129 -85
- c4dynamics-2.2.0/c4dynamics/utils/__init__.py +27 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/_struct.py +4 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/const.py +3 -20
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/cprint.py +4 -21
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/gen_gif.py +8 -20
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/idx2keys.py +4 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/images_loader.py +3 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/math.py +3 -20
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/plottools.py +5 -22
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/plottracks.py +3 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/printpts.py +3 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/slides_gen.py +3 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/tictoc.py +28 -21
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/video_gen.py +2 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/utils/vidgen.py +3 -0
- c4dynamics-2.2.0/c4dynamics.egg-info/PKG-INFO +169 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics.egg-info/SOURCES.txt +28 -3
- c4dynamics-2.2.0/c4dynamics.egg-info/requires.txt +13 -0
- c4dynamics-2.2.0/pyproject.toml +35 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/setup.py +2 -1
- c4dynamics-2.2.0/tests/test_animate.py +120 -0
- c4dynamics-2.2.0/tests/test_const.py +24 -0
- c4dynamics-2.2.0/tests/test_cprint.py +60 -0
- c4dynamics-2.2.0/tests/test_datapoint.py +86 -0
- c4dynamics-2.2.0/tests/test_datasets.py +124 -0
- c4dynamics-2.2.0/tests/test_derivs.py +58 -0
- c4dynamics-2.2.0/tests/test_ekf.py +104 -0
- c4dynamics-2.2.0/tests/test_gen_gif.py +116 -0
- c4dynamics-2.2.0/tests/test_integrate.py +65 -0
- c4dynamics-2.2.0/tests/test_kalman.py +144 -0
- c4dynamics-2.2.0/tests/test_lowpass.py +60 -0
- c4dynamics-2.2.0/tests/test_math.py +66 -0
- c4dynamics-2.2.0/tests/test_pixelpoint.py +69 -0
- c4dynamics-2.2.0/tests/test_plotdefaults.py +36 -0
- c4dynamics-2.2.0/tests/test_radar.py +66 -0
- c4dynamics-2.2.0/tests/test_rigidbody.py +112 -0
- c4dynamics-2.2.0/tests/test_rotmat.py +71 -0
- c4dynamics-2.2.0/tests/test_seeker.py +109 -0
- c4dynamics-2.2.0/tests/test_state.py +116 -0
- c4dynamics-2.2.0/tests/test_state_assignment.py +32 -0
- c4dynamics-2.2.0/tests/test_state_assignment_strict.py +58 -0
- c4dynamics-2.2.0/tests/test_tictoc.py +43 -0
- c4dynamics-2.2.0/tests/test_yolov3_opencv.py +81 -0
- c4dynamics-2.0.3/PKG-INFO +0 -128
- c4dynamics-2.0.3/README.md +0 -107
- c4dynamics-2.0.3/c4dynamics/detectors/yolo3_tf.py +0 -124
- c4dynamics-2.0.3/c4dynamics/eqm/__init__.py +0 -324
- c4dynamics-2.0.3/c4dynamics/filters/__init__.py +0 -1373
- c4dynamics-2.0.3/c4dynamics/filters/luenberger.py +0 -97
- c4dynamics-2.0.3/c4dynamics/rotmat/__init__.py +0 -141
- c4dynamics-2.0.3/c4dynamics/states/__init__.py +0 -327
- c4dynamics-2.0.3/c4dynamics/states/lib/__init__.py +0 -320
- c4dynamics-2.0.3/c4dynamics/utils/__init__.py +0 -44
- c4dynamics-2.0.3/c4dynamics.egg-info/PKG-INFO +0 -128
- c4dynamics-2.0.3/c4dynamics.egg-info/requires.txt +0 -7
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/filters/lowpass.py +0 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics/sensors/lineofsight.py +0 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics.egg-info/dependency_links.txt +0 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/c4dynamics.egg-info/top_level.txt +0 -0
- {c4dynamics-2.0.3 → c4dynamics-2.2.0}/setup.cfg +0 -0
c4dynamics-2.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 c4dynamics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: c4dynamics
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Python framework for state-space modeling and algorithm development
|
|
5
|
+
Author: c4dynamics
|
|
6
|
+
Author-email: Ziv Meri <zivmeri@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Requires-Python: >=3.8,<=3.12
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: imageio>=2.37.0
|
|
12
|
+
Requires-Dist: matplotlib>=3.10.3
|
|
13
|
+
Requires-Dist: natsort>=8.4.0
|
|
14
|
+
Requires-Dist: numpy>=2.3.1
|
|
15
|
+
Requires-Dist: opencv-python>=4.11.0.86
|
|
16
|
+
Requires-Dist: pooch>=1.8.2
|
|
17
|
+
Requires-Dist: scipy>=1.16.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: nbsphinx>=0.9.7; extra == "dev"
|
|
20
|
+
Requires-Dist: Sphinx>=8.1.3; extra == "dev"
|
|
21
|
+
Requires-Dist: sphinx-book-theme>=1.1.4; extra == "dev"
|
|
22
|
+
Requires-Dist: sphinx_design>=0.6.1; extra == "dev"
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-python
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
<img src="https://github.com/C4dynamics/C4dynamics/blob/main/docs/source/_icon/c4dlogotext.svg">
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Tsipor Dynamics
|
|
34
|
+
|
|
35
|
+
## Algorithms Engineering and Development
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Tsipor (bird) Dynamics (c4dynamics) is the Python framework for state-space modeling and algorithm development.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+

|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
[Documentation](https://c4dynamics.github.io/C4dynamics/)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Why c4dynamics?
|
|
59
|
+
|
|
60
|
+
✅ State objects for easy modeling
|
|
61
|
+
|
|
62
|
+
✅ Built-in functions for Kalman filters
|
|
63
|
+
|
|
64
|
+
✅ Integrated sensors and object detection models
|
|
65
|
+
|
|
66
|
+
✅ Out-of-the-box environments for reinforcement learning
|
|
67
|
+
|
|
68
|
+
✅ Seamless integration with OpenCV & Open3D
|
|
69
|
+
|
|
70
|
+
✅ Optimization for Monte Carlo simulations
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
**c4dynamics** is designed to
|
|
76
|
+
simplify the development of algorithms for dynamic systems,
|
|
77
|
+
using state space representations.
|
|
78
|
+
It offers engineers and researchers a systematic approach to model,
|
|
79
|
+
simulate, and control systems in fields like
|
|
80
|
+
``robotics, aerospace,`` and ``navigation``.
|
|
81
|
+
|
|
82
|
+
The framework introduces ``state objects,`` which are foundational
|
|
83
|
+
data structures that encapsulate state vectors and provide
|
|
84
|
+
the tools for managing data, simulating system behavior,
|
|
85
|
+
and analyzing results.
|
|
86
|
+
|
|
87
|
+
With integrated modules for sensors,
|
|
88
|
+
detectors, and filters,
|
|
89
|
+
c4dynamics accelerates algorithm development
|
|
90
|
+
while maintaining flexibility and scalability.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
- 3.8 <= Python <= 3.12
|
|
96
|
+
- Required packages are listed in [requirements.txt](requirements.txt)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## Installation
|
|
101
|
+
|
|
102
|
+
For detailed instructions on installing c4dynamics, including setup for virtual environments, Python version requirements, and troubleshooting, refer to the [c4dynamics setup guide](c4dynamics_setup.ipynb).
|
|
103
|
+
|
|
104
|
+
* [PIP](https://pypi.org/project/c4dynamics/)
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
>>> pip install c4dynamics
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
* [GitHub](https://github.com/C4dynamics/C4dynamics)
|
|
113
|
+
|
|
114
|
+
To run the latest GitHub version, download the repo and install required packages:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
>>> pip install -r requirements.txt
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Quickstart
|
|
125
|
+
|
|
126
|
+
Import c4dynamics:
|
|
127
|
+
```
|
|
128
|
+
>>> import c4dynamics as c4d
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Define state space object of two variables in the state space (y, vy) with initial conditions (change the state with your variables):
|
|
132
|
+
```
|
|
133
|
+
>>> s = c4d.state(y = 1, vy = 0.5)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Multiply the state vector by a matrix and store:
|
|
137
|
+
```
|
|
138
|
+
>>> F = [[1, 1],
|
|
139
|
+
[0, 1]]
|
|
140
|
+
>>> s.X += F @ s.X
|
|
141
|
+
>>> s.store(t = 1)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Print the state variables, the state vector, and the stored data:
|
|
145
|
+
```
|
|
146
|
+
>>> print(s)
|
|
147
|
+
[ y vy ]
|
|
148
|
+
>>> s.X
|
|
149
|
+
[2.5 1]
|
|
150
|
+
>>> s.data('y')
|
|
151
|
+
([0, 1], [1, 2.5])
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Support
|
|
155
|
+
If you encounter problems, have questions, or would like to suggest improvements,
|
|
156
|
+
please open an Issue in this repository.
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## New in Block 2
|
|
160
|
+
|
|
161
|
+
Enhancements and modules in latest release:
|
|
162
|
+
|
|
163
|
+
- Complete state space objects mechanism
|
|
164
|
+
- Seeker and radar measurements
|
|
165
|
+
- Kalman filter and Extended Kalman filter
|
|
166
|
+
- YOLOv3 object detection API
|
|
167
|
+
- Datasets fetching to run examples
|
|
168
|
+
- Documentation
|
|
169
|
+
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://github.com/C4dynamics/C4dynamics/blob/main/docs/source/_icon/c4dlogotext.svg">
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Tsipor Dynamics
|
|
8
|
+
|
|
9
|
+
## Algorithms Engineering and Development
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Tsipor (bird) Dynamics (c4dynamics) is the Python framework for state-space modeling and algorithm development.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+

|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
[Documentation](https://c4dynamics.github.io/C4dynamics/)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Why c4dynamics?
|
|
33
|
+
|
|
34
|
+
✅ State objects for easy modeling
|
|
35
|
+
|
|
36
|
+
✅ Built-in functions for Kalman filters
|
|
37
|
+
|
|
38
|
+
✅ Integrated sensors and object detection models
|
|
39
|
+
|
|
40
|
+
✅ Out-of-the-box environments for reinforcement learning
|
|
41
|
+
|
|
42
|
+
✅ Seamless integration with OpenCV & Open3D
|
|
43
|
+
|
|
44
|
+
✅ Optimization for Monte Carlo simulations
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
**c4dynamics** is designed to
|
|
50
|
+
simplify the development of algorithms for dynamic systems,
|
|
51
|
+
using state space representations.
|
|
52
|
+
It offers engineers and researchers a systematic approach to model,
|
|
53
|
+
simulate, and control systems in fields like
|
|
54
|
+
``robotics, aerospace,`` and ``navigation``.
|
|
55
|
+
|
|
56
|
+
The framework introduces ``state objects,`` which are foundational
|
|
57
|
+
data structures that encapsulate state vectors and provide
|
|
58
|
+
the tools for managing data, simulating system behavior,
|
|
59
|
+
and analyzing results.
|
|
60
|
+
|
|
61
|
+
With integrated modules for sensors,
|
|
62
|
+
detectors, and filters,
|
|
63
|
+
c4dynamics accelerates algorithm development
|
|
64
|
+
while maintaining flexibility and scalability.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Requirements
|
|
69
|
+
- 3.8 <= Python <= 3.12
|
|
70
|
+
- Required packages are listed in [requirements.txt](requirements.txt)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
For detailed instructions on installing c4dynamics, including setup for virtual environments, Python version requirements, and troubleshooting, refer to the [c4dynamics setup guide](c4dynamics_setup.ipynb).
|
|
77
|
+
|
|
78
|
+
* [PIP](https://pypi.org/project/c4dynamics/)
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
>>> pip install c4dynamics
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
* [GitHub](https://github.com/C4dynamics/C4dynamics)
|
|
87
|
+
|
|
88
|
+
To run the latest GitHub version, download the repo and install required packages:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
>>> pip install -r requirements.txt
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Quickstart
|
|
99
|
+
|
|
100
|
+
Import c4dynamics:
|
|
101
|
+
```
|
|
102
|
+
>>> import c4dynamics as c4d
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Define state space object of two variables in the state space (y, vy) with initial conditions (change the state with your variables):
|
|
106
|
+
```
|
|
107
|
+
>>> s = c4d.state(y = 1, vy = 0.5)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Multiply the state vector by a matrix and store:
|
|
111
|
+
```
|
|
112
|
+
>>> F = [[1, 1],
|
|
113
|
+
[0, 1]]
|
|
114
|
+
>>> s.X += F @ s.X
|
|
115
|
+
>>> s.store(t = 1)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Print the state variables, the state vector, and the stored data:
|
|
119
|
+
```
|
|
120
|
+
>>> print(s)
|
|
121
|
+
[ y vy ]
|
|
122
|
+
>>> s.X
|
|
123
|
+
[2.5 1]
|
|
124
|
+
>>> s.data('y')
|
|
125
|
+
([0, 1], [1, 2.5])
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Support
|
|
129
|
+
If you encounter problems, have questions, or would like to suggest improvements,
|
|
130
|
+
please open an Issue in this repository.
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
## New in Block 2
|
|
134
|
+
|
|
135
|
+
Enhancements and modules in latest release:
|
|
136
|
+
|
|
137
|
+
- Complete state space objects mechanism
|
|
138
|
+
- Seeker and radar measurements
|
|
139
|
+
- Kalman filter and Extended Kalman filter
|
|
140
|
+
- YOLOv3 object detection API
|
|
141
|
+
- Datasets fetching to run examples
|
|
142
|
+
- Documentation
|
|
143
|
+
|
|
@@ -20,11 +20,11 @@ Available subpackages
|
|
|
20
20
|
sensors
|
|
21
21
|
Models of EO and EM sensors.
|
|
22
22
|
detectors
|
|
23
|
-
Objects detection models
|
|
23
|
+
Objects detection models.
|
|
24
24
|
filters
|
|
25
25
|
Kalman and lowpass filters.
|
|
26
26
|
eqm
|
|
27
|
-
Runge Kutta solvers for integrating the equations of motion
|
|
27
|
+
Runge Kutta solvers for integrating the equations of motion.
|
|
28
28
|
rotmat
|
|
29
29
|
Rotation matrices and rotational operations.
|
|
30
30
|
'''
|
|
@@ -43,7 +43,7 @@ from .states.state import state
|
|
|
43
43
|
from .states.lib.pixelpoint import pixelpoint
|
|
44
44
|
from .states.lib.datapoint import datapoint, create
|
|
45
45
|
from . import rotmat
|
|
46
|
-
# rotmat is required to
|
|
46
|
+
# rotmat is required to importing rigidbody:
|
|
47
47
|
from .states.lib.rigidbody import rigidbody # rotmat is required to import rigidbody.
|
|
48
48
|
|
|
49
49
|
#
|
|
@@ -74,12 +74,16 @@ from . import filters
|
|
|
74
74
|
from . import detectors
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
#
|
|
78
|
+
# reinforcement learning
|
|
79
|
+
##
|
|
80
|
+
from . import envs
|
|
77
81
|
|
|
78
82
|
|
|
79
83
|
#
|
|
80
84
|
# version
|
|
81
85
|
##
|
|
82
|
-
__version__ = '2.0.
|
|
86
|
+
__version__ = '2.2.0' # update also in pyproject.toml
|
|
83
87
|
|
|
84
88
|
|
|
85
89
|
#
|
|
@@ -89,9 +93,9 @@ j = os.path.join
|
|
|
89
93
|
|
|
90
94
|
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
'''
|
|
97
|
+
WARNINGS
|
|
98
|
+
'''
|
|
95
99
|
class c4warn(UserWarning): pass
|
|
96
100
|
|
|
97
101
|
# customize the warning messages:
|
|
@@ -114,24 +118,29 @@ def show_warning(message, category, filename, lineno, file = None, line = None):
|
|
|
114
118
|
|
|
115
119
|
warnings.showwarning = show_warning
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
'''
|
|
122
|
+
TESTING
|
|
123
|
+
'''
|
|
118
124
|
|
|
119
125
|
class IgnoreOutputChecker(doctest.OutputChecker):
|
|
120
126
|
from typing import Union
|
|
121
127
|
|
|
122
128
|
IGNORE_OUTPUT = doctest.register_optionflag("IGNORE_OUTPUT") # 2048
|
|
123
|
-
NUMPY_FORMAT = doctest.register_optionflag("NUMPY_FORMAT")
|
|
129
|
+
NUMPY_FORMAT = doctest.register_optionflag("NUMPY_FORMAT") # 4096
|
|
124
130
|
|
|
125
131
|
def check_output(self, want, got, optionflags):
|
|
126
132
|
|
|
133
|
+
|
|
127
134
|
# If the IGNORE_OUTPUT flag is set, always return True
|
|
128
135
|
if optionflags & self.IGNORE_OUTPUT:
|
|
129
136
|
return True
|
|
130
137
|
|
|
131
138
|
# If NUMPY_FORMAT flag is set, compare NumPy arrays with formatting tolerance
|
|
132
139
|
if optionflags & self.NUMPY_FORMAT:
|
|
140
|
+
|
|
133
141
|
want = self._convert_to_array(want)
|
|
134
142
|
got = self._convert_to_array(got)
|
|
143
|
+
|
|
135
144
|
if want is not None and got is not None:
|
|
136
145
|
|
|
137
146
|
abs_tol = 1e-3
|
|
@@ -155,27 +164,90 @@ class IgnoreOutputChecker(doctest.OutputChecker):
|
|
|
155
164
|
|
|
156
165
|
import re
|
|
157
166
|
|
|
158
|
-
|
|
159
167
|
"""Attempt to convert text to a NumPy array for comparison."""
|
|
160
168
|
try:
|
|
161
169
|
|
|
162
170
|
if ',' not in text:
|
|
163
171
|
text = re.sub(r'\s+', ',', text.strip())
|
|
164
172
|
|
|
165
|
-
# Remove
|
|
166
|
-
|
|
167
|
-
# Remove
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
# Remove 'np.type'
|
|
174
|
+
text = re.sub(r'np\.\w+', '', text)
|
|
175
|
+
# Remove 'array(' and strip leading/trailing whitespace characters
|
|
176
|
+
text = re.sub(r'(array\()', '', text).strip()
|
|
177
|
+
# Remove brackets and parantheses
|
|
178
|
+
text = re.sub(r'[\[\]\(\)]', '', text)
|
|
179
|
+
# remove ellipsis
|
|
180
|
+
text = re.sub(r'\.\.\.', '', text)
|
|
170
181
|
# Convert to NumPy array
|
|
171
|
-
return np.fromstring(
|
|
182
|
+
return np.fromstring(text, sep = ',')
|
|
172
183
|
|
|
173
184
|
except ValueError:
|
|
185
|
+
print(f"\n \033[31m DOCSTRING ERROR: Could not convert to an array \033[0m", file = sys.stderr)
|
|
174
186
|
return None # Return None if conversion fails
|
|
175
187
|
|
|
176
188
|
|
|
177
|
-
# just find the package root folder:
|
|
178
189
|
|
|
190
|
+
# Filter out tests for the animate method by overriding the testmod.
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def testmod_filtering(module, filter_functions = [], **kwargs):
|
|
194
|
+
|
|
195
|
+
tests = []
|
|
196
|
+
|
|
197
|
+
for test in doctest.DocTestFinder().find(module):
|
|
198
|
+
filtfunc = False
|
|
199
|
+
for func in filter_functions:
|
|
200
|
+
if func == test.name:
|
|
201
|
+
filtfunc = True
|
|
202
|
+
break
|
|
203
|
+
if filtfunc: continue
|
|
204
|
+
tests.append(test)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
runner = doctest.DocTestRunner(**kwargs)
|
|
208
|
+
for test in tests:
|
|
209
|
+
runner.run(test)
|
|
210
|
+
return runner.summarize()
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def rundoctests(module, exclude_functions = []):
|
|
214
|
+
import doctest, contextlib, os
|
|
215
|
+
from c4dynamics import IgnoreOutputChecker, cprint
|
|
216
|
+
from matplotlib import pyplot as plt
|
|
217
|
+
from pathlib import Path
|
|
218
|
+
|
|
219
|
+
tofile = False
|
|
220
|
+
# pltbe = plt.get_backend()
|
|
221
|
+
# plt.switch_backend("tkAgg")
|
|
222
|
+
|
|
223
|
+
# Register the custom OutputChecker
|
|
224
|
+
doctest.OutputChecker = IgnoreOutputChecker
|
|
225
|
+
|
|
226
|
+
optionflags = doctest.FAIL_FAST
|
|
227
|
+
np.set_printoptions(legacy = "1.25")
|
|
228
|
+
|
|
229
|
+
if tofile:
|
|
230
|
+
with open(os.path.join('tests', '_out', 'output.txt'), 'w') as f:
|
|
231
|
+
with contextlib.redirect_stdout(f), contextlib.redirect_stderr(f):
|
|
232
|
+
# result = doctest.testmod(optionflags = optionflags)
|
|
233
|
+
result = testmod_filtering(module, exclude_functions, optionflags = optionflags)
|
|
234
|
+
else:
|
|
235
|
+
# result = doctest.testmod(optionflags = optionflags)
|
|
236
|
+
result = testmod_filtering(module, exclude_functions, optionflags = optionflags)
|
|
237
|
+
|
|
238
|
+
if result.failed == 0:
|
|
239
|
+
cprint(Path(module.__file__).parts[-1] + ": all tests passed!", 'g')
|
|
240
|
+
else:
|
|
241
|
+
print(f"{result.failed}")
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
# plt.switch_backend(pltbe)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
'''
|
|
248
|
+
ROOT FOLDER
|
|
249
|
+
'''
|
|
250
|
+
# just find the package root folder:
|
|
179
251
|
def c4dir(dir, addpath = ''):
|
|
180
252
|
# dirname and basename are supplamentary:
|
|
181
253
|
# c:\dropbox\c4dynamics\text.txt
|
|
@@ -194,6 +266,9 @@ def c4dir(dir, addpath = ''):
|
|
|
194
266
|
return c4dir(os.path.dirname(dir), addpath)
|
|
195
267
|
|
|
196
268
|
|
|
269
|
+
'''
|
|
270
|
+
KEYWORDS
|
|
271
|
+
'''
|
|
197
272
|
#
|
|
198
273
|
# TODO BUG FIXME HACK NOTE XXX
|
|
199
274
|
#
|
|
@@ -71,25 +71,27 @@ from c4dynamics.datasets._manager import sha256, image, video, nn_model, d3_mode
|
|
|
71
71
|
|
|
72
72
|
if __name__ == "__main__":
|
|
73
73
|
|
|
74
|
-
import doctest, contextlib
|
|
75
|
-
from c4dynamics import IgnoreOutputChecker, cprint
|
|
74
|
+
# import doctest, contextlib
|
|
75
|
+
# from c4dynamics import IgnoreOutputChecker, cprint
|
|
76
76
|
|
|
77
|
-
# Register the custom OutputChecker
|
|
78
|
-
doctest.OutputChecker = IgnoreOutputChecker
|
|
79
|
-
|
|
80
|
-
tofile = False
|
|
81
|
-
optionflags = doctest.FAIL_FAST
|
|
82
|
-
|
|
83
|
-
if tofile:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
else:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if result.failed == 0:
|
|
91
|
-
|
|
92
|
-
else:
|
|
93
|
-
|
|
77
|
+
# # Register the custom OutputChecker
|
|
78
|
+
# doctest.OutputChecker = IgnoreOutputChecker
|
|
79
|
+
|
|
80
|
+
# tofile = False
|
|
81
|
+
# optionflags = doctest.FAIL_FAST
|
|
82
|
+
|
|
83
|
+
# if tofile:
|
|
84
|
+
# with open(os.path.join('tests', '_out', 'output.txt'), 'w') as f:
|
|
85
|
+
# with contextlib.redirect_stdout(f), contextlib.redirect_stderr(f):
|
|
86
|
+
# result = doctest.testmod(optionflags = optionflags)
|
|
87
|
+
# else:
|
|
88
|
+
# result = doctest.testmod(optionflags = optionflags)
|
|
89
|
+
|
|
90
|
+
# if result.failed == 0:
|
|
91
|
+
# cprint(os.path.basename(__file__) + ": all tests passed!", 'g')
|
|
92
|
+
# else:
|
|
93
|
+
# print(f"{result.failed}")
|
|
94
|
+
from c4dynamics import rundoctests
|
|
95
|
+
rundoctests(sys.modules[__name__])
|
|
94
96
|
|
|
95
97
|
|
|
@@ -572,25 +572,42 @@ def sha256(filename: str) -> str:
|
|
|
572
572
|
|
|
573
573
|
if __name__ == "__main__":
|
|
574
574
|
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
try:
|
|
578
|
+
import open3d as o3d # OPEN3D AVAILABLE
|
|
579
|
+
|
|
580
|
+
except ImportError: # OPEN3D UNAVAILABLE
|
|
581
|
+
# remove the doctests for d3_model if open3d is not available
|
|
582
|
+
|
|
583
|
+
current_module = sys.modules[__name__]
|
|
584
|
+
if hasattr(current_module, "d3_model"):
|
|
585
|
+
current_module.d3_model.__doc__ = "" # clears doctest examples
|
|
586
|
+
|
|
587
|
+
|
|
575
588
|
import doctest, contextlib
|
|
576
589
|
from c4dynamics import IgnoreOutputChecker, cprint
|
|
577
|
-
|
|
578
|
-
# Register the custom OutputChecker
|
|
579
|
-
doctest.OutputChecker = IgnoreOutputChecker
|
|
580
590
|
|
|
581
|
-
tofile = False
|
|
582
|
-
optionflags = doctest.FAIL_FAST
|
|
583
591
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
with contextlib.redirect_stdout(f), contextlib.redirect_stderr(f):
|
|
587
|
-
result = doctest.testmod(optionflags = optionflags)
|
|
588
|
-
else:
|
|
589
|
-
result = doctest.testmod(optionflags = optionflags)
|
|
592
|
+
# # Register the custom OutputChecker
|
|
593
|
+
# doctest.OutputChecker = IgnoreOutputChecker
|
|
590
594
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
+
# tofile = False
|
|
596
|
+
# optionflags = doctest.FAIL_FAST
|
|
597
|
+
|
|
598
|
+
# if tofile:
|
|
599
|
+
# with open(os.path.join('tests', '_out', 'output.txt'), 'w') as f:
|
|
600
|
+
# with contextlib.redirect_stdout(f), contextlib.redirect_stderr(f):
|
|
601
|
+
# result = doctest.testmod(optionflags = optionflags)
|
|
602
|
+
# else:
|
|
603
|
+
# result = doctest.testmod(optionflags = optionflags)
|
|
604
|
+
|
|
605
|
+
# if result.failed == 0:
|
|
606
|
+
# cprint(os.path.basename(__file__) + ": all tests passed!", 'g')
|
|
607
|
+
# else:
|
|
608
|
+
# print(f"{result.failed}")
|
|
609
|
+
|
|
610
|
+
from c4dynamics import rundoctests
|
|
611
|
+
rundoctests(sys.modules[__name__])
|
|
595
612
|
|
|
596
613
|
|
|
@@ -30,10 +30,13 @@ nn_register = pooch.create(
|
|
|
30
30
|
path = CACHE_DIR
|
|
31
31
|
, base_url = ''
|
|
32
32
|
, registry = {
|
|
33
|
-
'yolov3.weights': '523e4e69e1d015393a1b0a441cef1d9c7659e3eb2d7e15f793f060a21b32f297'
|
|
33
|
+
# 'yolov3.weights': '523e4e69e1d015393a1b0a441cef1d9c7659e3eb2d7e15f793f060a21b32f297'
|
|
34
|
+
'yolov3.weights': '523e4e69e1d015393a1b0a441cef1d9c7659e3eb2d7e15f793f060a21b32f297'
|
|
35
|
+
|
|
34
36
|
}
|
|
35
37
|
, urls = {
|
|
36
|
-
'yolov3.weights': 'https://pjreddie.com/media/files/yolov3.weights'
|
|
38
|
+
# 'yolov3.weights': 'https://pjreddie.com/media/files/yolov3.weights'
|
|
39
|
+
'yolov3.weights': 'https://huggingface.co/spaces/Epitech/Scarecrow/resolve/main/yolov3.weights'
|
|
37
40
|
}
|
|
38
41
|
, retry_if_failed = 1
|
|
39
42
|
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'''
|
|
2
|
+
|
|
3
|
+
`c4dynamics` provides an API to third party object detection models.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.. list-table::
|
|
7
|
+
:header-rows: 0
|
|
8
|
+
|
|
9
|
+
* - :class:`YOLOv3 <c4dynamics.detectors.yolo3_opencv.yolov3>`
|
|
10
|
+
- Realtime object detection model based on YOLO (You Only Look Once) approach with 80 pre-trained COCO classes
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
'''
|
|
14
|
+
|
|
15
|
+
import os, sys
|
|
16
|
+
sys.path.append('.')
|
|
17
|
+
|
|
18
|
+
from c4dynamics.detectors.yolo3_opencv import yolov3
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
|
|
22
|
+
from c4dynamics import rundoctests
|
|
23
|
+
rundoctests(sys.modules[__name__])
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|