timelined_array 0.1.1__tar.gz → 0.1.2__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.
- {timelined_array-0.1.1 → timelined_array-0.1.2}/PKG-INFO +2 -2
- {timelined_array-0.1.1 → timelined_array-0.1.2}/README.md +1 -1
- {timelined_array-0.1.1 → timelined_array-0.1.2}/pyproject.toml +1 -1
- {timelined_array-0.1.1 → timelined_array-0.1.2}/src/timelined_array/__init__.py +1 -1
- {timelined_array-0.1.1 → timelined_array-0.1.2}/src/timelined_array/time.py +8 -4
- {timelined_array-0.1.1 → timelined_array-0.1.2}/LICENSE +0 -0
- {timelined_array-0.1.1 → timelined_array-0.1.2}/tests/__init__.py +0 -0
- {timelined_array-0.1.1 → timelined_array-0.1.2}/tests/test_timelined_array.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: timelined_array
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Manage easily 1 or multidimensionnal samples numpy arrays that are time related. Extends numpy without removing any of it's abilities on such arrays.
|
|
5
5
|
Author-Email: Timothe Jost <44769559+JostTim@users.noreply.github.com>
|
|
6
6
|
License: MIT
|
|
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
|
|
|
16
16
|

|
|
17
17
|

|
|
18
18
|

|
|
19
|
-

|
|
19
|
+
[](https://codecov.io/gh/JostTim/timelined_array)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
<!-- eventually, add ?cache-bust=1 to badges url above, and update the value of cache-bust randomly at git commits (or based on the commit name) so that we always see the latest badge produced, and not the cached badge in the browser.-->
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|

|
|
7
|
-

|
|
7
|
+
[](https://codecov.io/gh/JostTim/timelined_array)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
<!-- eventually, add ?cache-bust=1 to badges url above, and update the value of cache-bust randomly at git commits (or based on the commit name) so that we always see the latest badge produced, and not the cached badge in the browser.-->
|
|
@@ -7,7 +7,9 @@ import operator
|
|
|
7
7
|
|
|
8
8
|
from numpy.typing import NDArray
|
|
9
9
|
from types import MethodType
|
|
10
|
-
from typing import Tuple, List, Protocol, Type, Callable, Any, Optional
|
|
10
|
+
from typing import Tuple, List, Protocol, Type, Callable, Any, Optional, TypeVar, Sequence
|
|
11
|
+
|
|
12
|
+
Tp = TypeVar("Tp", bound="TimelinedArray")
|
|
11
13
|
|
|
12
14
|
OperatorType = Callable[[Any, Any], bool]
|
|
13
15
|
|
|
@@ -635,8 +637,10 @@ class BaseTimeArray(TimeMixin, np.ndarray):
|
|
|
635
637
|
Returns:
|
|
636
638
|
TimelinedArray: The synchronized and cut arrray.
|
|
637
639
|
"""
|
|
640
|
+
# this slice is to select the number of elements, on the time_dimension
|
|
641
|
+
slices = tuple(slice(None) if i != self.time_dimension else slice(None, element_nb) for i in range(self.ndim))
|
|
638
642
|
|
|
639
|
-
return self.itime[start:][
|
|
643
|
+
return self.itime[start:][slices] # type: ignore
|
|
640
644
|
|
|
641
645
|
def shift_values(
|
|
642
646
|
self,
|
|
@@ -829,7 +833,7 @@ class BaseTimeArray(TimeMixin, np.ndarray):
|
|
|
829
833
|
def all_axes(self):
|
|
830
834
|
return tuple([i for i in range(self.ndim)])
|
|
831
835
|
|
|
832
|
-
def mean(self, axis: int | Tuple[int, ...] | None = None, dtype=None, out=None, keepdims=False):
|
|
836
|
+
def mean(self: Tp, axis: int | Tuple[int, ...] | None = None, dtype=None, out=None, keepdims=False) -> Tp:
|
|
833
837
|
"""Calculates the mean along the specified axis.
|
|
834
838
|
|
|
835
839
|
Args:
|
|
@@ -1238,7 +1242,7 @@ class TimelinedArray(BaseTimeArray):
|
|
|
1238
1242
|
return type(self).__name__ + np.asarray(self).__str__()
|
|
1239
1243
|
|
|
1240
1244
|
@staticmethod
|
|
1241
|
-
def align_from_iterable(iterable) -> "TimelinedArray":
|
|
1245
|
+
def align_from_iterable(iterable: "Sequence[TimelinedArray]") -> "TimelinedArray":
|
|
1242
1246
|
"""Aligns arrays from an iterable based on their timelines.
|
|
1243
1247
|
|
|
1244
1248
|
Args:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|