pfc-geometry 0.2.21__py3-none-any.whl → 0.2.22__py3-none-any.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.
geometry/base.py CHANGED
@@ -265,9 +265,11 @@ class Base:
265
265
  if not pd.api.types.is_list_like(dt):
266
266
  dt = np.full(len(self), dt)
267
267
  self, dt = Base.length_check(self, dt)
268
- diff_method = np.gradient if method == "gradient" else np.diff
268
+ if method=="gradient":
269
+ data = np.gradient(self.data, axis=0) if len(self) >1 else np.zeros(self.data.shape)
270
+ else:
271
+ data = np.diff(self.data, axis=0)
269
272
 
270
- data = diff_method(self.data, axis=0)
271
273
  dt = dt if method == "gradient" else dt[:-1]
272
274
  return self.__class__(data / np.tile(dt, (len(self.__class__.cols), 1)).T)
273
275
 
geometry/utils.py CHANGED
@@ -86,6 +86,8 @@ def get_value(arr: npt.NDArray, index: Number):
86
86
 
87
87
  def apply_index_slice(index: npt.NDArray, value: slice | Number | npt.ArrayLike | None):
88
88
  if isinstance(value, slice):
89
+ if value.start is not None and value.stop is not None and value.start >= value.stop:
90
+ return np.array([], dtype=index.dtype)
89
91
  middle = pd.Index(index)[
90
92
  int(np.ceil(value.start)) if value.start is not None else None : int(
91
93
  np.ceil(value.stop)
@@ -93,9 +95,9 @@ def apply_index_slice(index: npt.NDArray, value: slice | Number | npt.ArrayLike
93
95
  if value.stop is not None
94
96
  else None
95
97
  ]
96
- if value.start is not None and middle[0] != value.start and value.start > index[0]:
98
+ if value.start is not None and (len(middle) == 0 or middle[0] != value.start) and value.start > index[0]:
97
99
  middle = np.concatenate([[get_value(index, value.start)], middle])
98
- if value.stop is not None and middle[-1] != value.stop and value.stop < index[-1]:
100
+ if value.stop is not None and (len(middle) == 0 or middle[-1] != value.stop) and value.stop < index[-1]:
99
101
  middle = np.concatenate([middle, [get_value(index, value.stop)]])
100
102
  return middle
101
103
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pfc-geometry
3
- Version: 0.2.21
3
+ Version: 0.2.22
4
4
  Summary: A library for working with 3D geometry.
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,7 +1,7 @@
1
1
  geometry/__init__.py,sha256=YT9pVH7zbfi26MLehrcCjcBf39aiCeq8aMuTtB3hC8Y,1133
2
2
  geometry/air.py,sha256=cmOoUiVYmCWccDAy_7u-bfOvkKnRW5gWUxcD8X-ukvM,443
3
3
  geometry/angles.py,sha256=OxuYcjFGexuOputr_eo9xHXnGCc44H3o3S5GQPp1geY,630
4
- geometry/base.py,sha256=6bM4J7VGhstel6qu-C4xU39vU4dZ71S9FZMY9Y7xDZY,14966
4
+ geometry/base.py,sha256=uHnQpOhv3Y9bXzpIttOODKRVUxFIlRbxmg4EbMRQa_s,15037
5
5
  geometry/checks.py,sha256=o8yMBAdU5Vy0EspBYaof4fPGgRSFZhRDhzBjRPsLd0M,375
6
6
  geometry/coordinate_frame.py,sha256=FeQn7TBAnbik4Rv0ErDUCaY-W480trVYspH46uS1NXw,4442
7
7
  geometry/gps.py,sha256=EsokABt40ZoltpAQfKrRc4kA-Lc2ScP_ltJNF7pvAWc,3654
@@ -11,8 +11,8 @@ geometry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  geometry/quaternion.py,sha256=dZwpViiVPwHUhRk7DhOwNab3pLhIWXyHk3DVh9mukSk,12143
12
12
  geometry/time.py,sha256=VQEklZtZkwMthMsrH5QT83V8e3n78S06fWjyEqLHYbk,2706
13
13
  geometry/transformation.py,sha256=-FQ_55l3_MykSQQuEIJ3MqWS5MHKR0HNWWCKpEEgRT0,5592
14
- geometry/utils.py,sha256=q7-aaxDzRDwl78-3XzdpcJuh5iL7I8lN5agk2WNWjSY,3443
15
- pfc_geometry-0.2.21.dist-info/METADATA,sha256=oDLhxh45eF3JL3JBtv_qZM8c9j9S6vgCqL8tt2xFzR4,1587
16
- pfc_geometry-0.2.21.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
- pfc_geometry-0.2.21.dist-info/licenses/LICENSE,sha256=z72U6pv-bQgJ_Svr4uCXnMjemsp38aSerhHEdEAOMJ4,7632
18
- pfc_geometry-0.2.21.dist-info/RECORD,,
14
+ geometry/utils.py,sha256=62MO2G6SzP63P_xRMb-wzGu9digyk-tSIBjpOypMRXE,3631
15
+ pfc_geometry-0.2.22.dist-info/METADATA,sha256=Jii_pLAE9vY-2-dbkOhZo8G3jmf7b3m58yAT1UQ4b_E,1587
16
+ pfc_geometry-0.2.22.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ pfc_geometry-0.2.22.dist-info/licenses/LICENSE,sha256=z72U6pv-bQgJ_Svr4uCXnMjemsp38aSerhHEdEAOMJ4,7632
18
+ pfc_geometry-0.2.22.dist-info/RECORD,,