pfc-geometry 0.2.2__tar.gz → 0.2.4__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.
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/PKG-INFO +6 -3
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/README.md +5 -2
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/base.py +9 -6
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/quaternion.py +5 -7
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/time.py +5 -1
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/transformation.py +3 -2
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/PKG-INFO +7 -4
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/setup.cfg +1 -1
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_quaternion.py +0 -21
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/LICENSE +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/__init__.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/coordinate_frame.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/gps.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/mass.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/point.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/geometry/testing.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/SOURCES.txt +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/dependency_links.txt +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/requires.txt +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/top_level.txt +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/setup.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_base.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_coord.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_gps.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_mass.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_point.py +0 -0
- {pfc_geometry-0.2.2 → pfc_geometry-0.2.4}/tests/test_transform.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pfc_geometry
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A package for handling 3D geometry with a nice interface
|
|
5
5
|
Home-page: https://github.com/PyFlightCoach/geometry
|
|
6
6
|
Author: Thomas David
|
|
@@ -22,6 +22,9 @@ Magic methods are used extensively and the function of operators are logical for
|
|
|
22
22
|
Many convenience methods and constructors are available. Documentation is limited but if you need something it has probably already been written so check the code first.
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Some examples are available here: https://pfcdocumentation.readthedocs.io/pyflightcoach/geometry.html
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
now available on pypi:
|
|
28
|
+
```bash
|
|
29
|
+
pip install pfc-geometry
|
|
30
|
+
```
|
|
@@ -9,6 +9,9 @@ Magic methods are used extensively and the function of operators are logical for
|
|
|
9
9
|
Many convenience methods and constructors are available. Documentation is limited but if you need something it has probably already been written so check the code first.
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Some examples are available here: https://pfcdocumentation.readthedocs.io/pyflightcoach/geometry.html
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
now available on pypi:
|
|
15
|
+
```bash
|
|
16
|
+
pip install pfc-geometry
|
|
17
|
+
```
|
|
@@ -10,8 +10,7 @@ You should have received a copy of the GNU General Public License along with
|
|
|
10
10
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
-
from typing import
|
|
14
|
-
from typing_extensions import Self
|
|
13
|
+
from typing import Self
|
|
15
14
|
import numpy as np
|
|
16
15
|
import numpy.typing as npt
|
|
17
16
|
import pandas as pd
|
|
@@ -171,6 +170,10 @@ class Base:
|
|
|
171
170
|
def __len__(self) -> int:
|
|
172
171
|
return self.data.shape[0]
|
|
173
172
|
|
|
173
|
+
@property
|
|
174
|
+
def ends(self) -> Self:
|
|
175
|
+
return self.__class__(self.data[[0,-1], :])
|
|
176
|
+
|
|
174
177
|
@dprep
|
|
175
178
|
def __eq__(self, other):
|
|
176
179
|
return np.all(self.data == other)
|
|
@@ -234,7 +237,7 @@ class Base:
|
|
|
234
237
|
np.tile(dt, (len(self.__class__.cols),1)).T)
|
|
235
238
|
|
|
236
239
|
def to_pandas(self, prefix='', suffix='', columns=None, index=None):
|
|
237
|
-
if
|
|
240
|
+
if columns is not None:
|
|
238
241
|
cols = columns
|
|
239
242
|
else:
|
|
240
243
|
cols = [prefix + col + suffix for col in self.__class__.cols]
|
|
@@ -318,10 +321,10 @@ class Base:
|
|
|
318
321
|
from scipy.fft import fft, fftfreq
|
|
319
322
|
if ts is None:
|
|
320
323
|
ts = np.array(range(len(self)))
|
|
321
|
-
N = len(self)
|
|
322
|
-
T = (ts[-1] - ts[0]) /
|
|
324
|
+
N = len(self)*2
|
|
325
|
+
T = (ts[-1] - ts[0]) / len(self)
|
|
323
326
|
|
|
324
|
-
yf = fft(self.data, axis=0)
|
|
327
|
+
yf = fft(self.data, axis=0, n=N)
|
|
325
328
|
xf = fftfreq(N, T)[:N//2]
|
|
326
329
|
|
|
327
330
|
|
|
@@ -10,18 +10,16 @@ You should have received a copy of the GNU General Public License along with
|
|
|
10
10
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
11
11
|
"""
|
|
12
12
|
from __future__ import annotations
|
|
13
|
-
from .point import Point
|
|
13
|
+
from .point import Point
|
|
14
14
|
from .base import Base
|
|
15
15
|
from geometry import PZ
|
|
16
|
-
from typing import Union, Tuple
|
|
17
16
|
import numpy as np
|
|
18
|
-
import pandas as pd
|
|
19
17
|
import numpy.typing as npt
|
|
18
|
+
import pandas as pd
|
|
20
19
|
from warnings import warn
|
|
21
20
|
from numbers import Number
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
|
|
25
23
|
class Quaternion(Base):
|
|
26
24
|
cols=["w", "x", "y", "z"]
|
|
27
25
|
|
|
@@ -46,7 +44,7 @@ class Quaternion(Base):
|
|
|
46
44
|
def inverse(self):
|
|
47
45
|
return self.conjugate().norm()
|
|
48
46
|
|
|
49
|
-
def __mul__(self, other:
|
|
47
|
+
def __mul__(self, other: Number | Quaternion | npt.NDArray) -> Quaternion:
|
|
50
48
|
if isinstance(other, Quaternion):
|
|
51
49
|
a, b = Quaternion.length_check(self, Quaternion.type_check(other))
|
|
52
50
|
w = a.w * b.w - a.axis.dot(b.axis)
|
|
@@ -181,7 +179,7 @@ class Quaternion(Base):
|
|
|
181
179
|
def body_rotate(self, rate: Point) -> Quaternion:
|
|
182
180
|
return (self * Quaternion.from_axis_angle(rate)).norm()
|
|
183
181
|
|
|
184
|
-
def diff(self, dt:
|
|
182
|
+
def diff(self, dt: Number | npt.NDArray) -> Point:
|
|
185
183
|
"""differentiate in the world frame"""
|
|
186
184
|
if not pd.api.types.is_list_like(dt):
|
|
187
185
|
dt = np.full(len(self), dt)
|
|
@@ -194,7 +192,7 @@ class Quaternion(Base):
|
|
|
194
192
|
) / dt[:-1]
|
|
195
193
|
return Point(np.vstack([ps.data, ps.data[-1,:]]))
|
|
196
194
|
|
|
197
|
-
def body_diff(self, dt:
|
|
195
|
+
def body_diff(self, dt: Number | npt.NDArray) -> Point:
|
|
198
196
|
"""differentiate in the body frame"""
|
|
199
197
|
if not pd.api.types.is_list_like(dt):
|
|
200
198
|
dt = np.full(len(self), dt)
|
|
@@ -13,7 +13,11 @@ class Time(Base):
|
|
|
13
13
|
if isinstance(t, Number):
|
|
14
14
|
return Time(t, 1/30)
|
|
15
15
|
else:
|
|
16
|
-
|
|
16
|
+
if len(t) == 1:
|
|
17
|
+
dt = np.array([1/30])
|
|
18
|
+
else:
|
|
19
|
+
arr = np.diff(t)
|
|
20
|
+
dt = np.concatenate([arr, [arr[-1]]])
|
|
17
21
|
return Time(t, dt)
|
|
18
22
|
|
|
19
23
|
def scale(self, duration) -> Self:
|
|
@@ -9,10 +9,11 @@ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
9
9
|
You should have received a copy of the GNU General Public License along with
|
|
10
10
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
11
11
|
"""
|
|
12
|
-
from geometry import Base, Point, Quaternion,
|
|
12
|
+
from geometry import Base, Point, Quaternion, P0, Q0, Coord
|
|
13
13
|
|
|
14
14
|
import numpy as np
|
|
15
|
-
from typing import Union
|
|
15
|
+
from typing import Union
|
|
16
|
+
from typing import Self
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class Transformation(Base):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.2.
|
|
2
|
+
Name: pfc_geometry
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A package for handling 3D geometry with a nice interface
|
|
5
5
|
Home-page: https://github.com/PyFlightCoach/geometry
|
|
6
6
|
Author: Thomas David
|
|
@@ -22,6 +22,9 @@ Magic methods are used extensively and the function of operators are logical for
|
|
|
22
22
|
Many convenience methods and constructors are available. Documentation is limited but if you need something it has probably already been written so check the code first.
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Some examples are available here: https://pfcdocumentation.readthedocs.io/pyflightcoach/geometry.html
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
now available on pypi:
|
|
28
|
+
```bash
|
|
29
|
+
pip install pfc-geometry
|
|
30
|
+
```
|
|
@@ -5,7 +5,7 @@ author_email = thomasdavid0@gmail.com
|
|
|
5
5
|
description = A package for handling 3D geometry with a nice interface
|
|
6
6
|
long_description = file: README.md
|
|
7
7
|
long_description_content_type = text/markdown
|
|
8
|
-
version = 0.2.
|
|
8
|
+
version = 0.2.4
|
|
9
9
|
url = https://github.com/PyFlightCoach/geometry
|
|
10
10
|
|
|
11
11
|
[options]
|
|
@@ -6,8 +6,6 @@ from geometry import Euler, Euldeg
|
|
|
6
6
|
from geometry.testing import assert_almost_equal
|
|
7
7
|
import pandas as pd
|
|
8
8
|
import numpy as np
|
|
9
|
-
import quaternion
|
|
10
|
-
from scipy.spatial.transform import Rotation as R
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
|
|
@@ -37,14 +35,6 @@ def test_mul():
|
|
|
37
35
|
err_msg="failed to do Quaternions * Quaternions"
|
|
38
36
|
)
|
|
39
37
|
|
|
40
|
-
def test_from_euler():
|
|
41
|
-
parr = np.random.random((20, 3))
|
|
42
|
-
|
|
43
|
-
np.testing.assert_array_almost_equal(
|
|
44
|
-
Quaternion.from_euler(Point(parr)).xyzw,
|
|
45
|
-
R.from_euler('xyz', parr).as_quat()
|
|
46
|
-
)
|
|
47
|
-
|
|
48
38
|
|
|
49
39
|
def test_from_euler_unwrap():
|
|
50
40
|
q = Q0(10).rotate(PZ()*np.radians(np.linspace(0,360, 10)))
|
|
@@ -54,17 +44,6 @@ def test_from_euler_unwrap():
|
|
|
54
44
|
)
|
|
55
45
|
|
|
56
46
|
|
|
57
|
-
def test_to_euler():
|
|
58
|
-
qarr = Quaternion(np.random.random((2, 4))).norm()
|
|
59
|
-
eulers = qarr.to_euler()
|
|
60
|
-
|
|
61
|
-
checks = np.array([R.from_euler("xyz", eul.data[0]).as_quat() for eul in eulers])
|
|
62
|
-
|
|
63
|
-
np.testing.assert_array_almost_equal(
|
|
64
|
-
checks,
|
|
65
|
-
qarr.xyzw
|
|
66
|
-
)
|
|
67
|
-
|
|
68
47
|
|
|
69
48
|
def test_norm():
|
|
70
49
|
qarr = Quaternion(np.random.random( (2,4)))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|