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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: timelined_array
3
- Version: 0.1.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
  ![PyPI - Version](https://img.shields.io/pypi/v/timelined_array)
17
17
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/JostTim/timelined_array/publish.yml?label=Publishing)
18
18
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/JostTim/timelined_array/test.yml?label=Testing)
19
- ![Codecov](https://img.shields.io/codecov/c/github/JostTim/timelined_array)
19
+ [![Codecov](https://img.shields.io/codecov/c/github/JostTim/timelined_array)](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
  ![PyPI - Version](https://img.shields.io/pypi/v/timelined_array)
5
5
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/JostTim/timelined_array/publish.yml?label=Publishing)
6
6
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/JostTim/timelined_array/test.yml?label=Testing)
7
- ![Codecov](https://img.shields.io/codecov/c/github/JostTim/timelined_array)
7
+ [![Codecov](https://img.shields.io/codecov/c/github/JostTim/timelined_array)](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.-->
@@ -10,7 +10,7 @@ dependencies = [
10
10
  requires-python = ">=3.11"
11
11
  readme = "README.md"
12
12
  dynamic = []
13
- version = "0.1.1"
13
+ version = "0.1.2"
14
14
 
15
15
  [project.license]
16
16
  text = "MIT"
@@ -1,3 +1,3 @@
1
- __version__ = "0.1.1"
1
+ __version__ = "0.1.2"
2
2
 
3
3
  from .time import TimelinedArray, MaskedTimelinedArray, Timeline
@@ -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:][:element_nb] # type: ignore
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