pfc-geometry 0.2.3__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.
Files changed (27) hide show
  1. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/PKG-INFO +6 -3
  2. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/README.md +5 -2
  3. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/base.py +9 -5
  4. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/quaternion.py +5 -7
  5. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/PKG-INFO +6 -3
  6. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/setup.cfg +1 -1
  7. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/tests/test_quaternion.py +0 -21
  8. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/LICENSE +0 -0
  9. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/__init__.py +0 -0
  10. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/coordinate_frame.py +0 -0
  11. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/gps.py +0 -0
  12. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/mass.py +0 -0
  13. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/point.py +0 -0
  14. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/testing.py +0 -0
  15. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/time.py +0 -0
  16. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/geometry/transformation.py +0 -0
  17. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/SOURCES.txt +0 -0
  18. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/dependency_links.txt +0 -0
  19. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/requires.txt +0 -0
  20. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/pfc_geometry.egg-info/top_level.txt +0 -0
  21. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/setup.py +0 -0
  22. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/tests/test_base.py +0 -0
  23. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/tests/test_coord.py +0 -0
  24. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/tests/test_gps.py +0 -0
  25. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/tests/test_mass.py +0 -0
  26. {pfc_geometry-0.2.3 → pfc_geometry-0.2.4}/tests/test_point.py +0 -0
  27. {pfc_geometry-0.2.3 → 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
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
- now available on pypi:
25
+ Some examples are available here: https://pfcdocumentation.readthedocs.io/pyflightcoach/geometry.html
26
26
 
27
- pip install pfc-geometry
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
- now available on pypi:
12
+ Some examples are available here: https://pfcdocumentation.readthedocs.io/pyflightcoach/geometry.html
13
13
 
14
- pip install pfc-geometry
14
+ now available on pypi:
15
+ ```bash
16
+ pip install pfc-geometry
17
+ ```
@@ -10,7 +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 Type, List, Self
13
+ from typing import Self
14
14
  import numpy as np
15
15
  import numpy.typing as npt
16
16
  import pandas as pd
@@ -170,6 +170,10 @@ class Base:
170
170
  def __len__(self) -> int:
171
171
  return self.data.shape[0]
172
172
 
173
+ @property
174
+ def ends(self) -> Self:
175
+ return self.__class__(self.data[[0,-1], :])
176
+
173
177
  @dprep
174
178
  def __eq__(self, other):
175
179
  return np.all(self.data == other)
@@ -233,7 +237,7 @@ class Base:
233
237
  np.tile(dt, (len(self.__class__.cols),1)).T)
234
238
 
235
239
  def to_pandas(self, prefix='', suffix='', columns=None, index=None):
236
- if not columns is None:
240
+ if columns is not None:
237
241
  cols = columns
238
242
  else:
239
243
  cols = [prefix + col + suffix for col in self.__class__.cols]
@@ -317,10 +321,10 @@ class Base:
317
321
  from scipy.fft import fft, fftfreq
318
322
  if ts is None:
319
323
  ts = np.array(range(len(self)))
320
- N = len(self)
321
- T = (ts[-1] - ts[0]) / N
324
+ N = len(self)*2
325
+ T = (ts[-1] - ts[0]) / len(self)
322
326
 
323
- yf = fft(self.data, axis=0)
327
+ yf = fft(self.data, axis=0, n=N)
324
328
  xf = fftfreq(N, T)[:N//2]
325
329
 
326
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, P0
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: Union[Number, Quaternion, np.ndarray]) -> Quaternion:
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: Union[Number, np.ndarray]) -> Point:
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: Union[Number, np.ndarray]) -> Point:
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pfc_geometry
3
- Version: 0.2.3
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
- now available on pypi:
25
+ Some examples are available here: https://pfcdocumentation.readthedocs.io/pyflightcoach/geometry.html
26
26
 
27
- pip install pfc-geometry
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.3
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