timelined_array 1.0.7__tar.gz → 1.0.9__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-1.0.7 → timelined_array-1.0.9}/PKG-INFO +1 -1
- {timelined_array-1.0.7 → timelined_array-1.0.9}/pyproject.toml +2 -2
- {timelined_array-1.0.7 → timelined_array-1.0.9}/pyproject.toml.orig +2 -2
- {timelined_array-1.0.7 → timelined_array-1.0.9}/src/timelined_array/__init__.py +1 -1
- {timelined_array-1.0.7 → timelined_array-1.0.9}/src/timelined_array/time.py +17 -16
- {timelined_array-1.0.7 → timelined_array-1.0.9}/README.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: timelined_array
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.9
|
|
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: Timothe Jost
|
|
6
6
|
Author-email: Timothe Jost <44769559+JostTim@users.noreply.github.com>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "timelined_array"
|
|
3
3
|
description = "Manage easily 1 or multidimensionnal samples numpy arrays that are time related. Extends numpy without removing any of it's abilities on such arrays."
|
|
4
|
-
version = "1.0.
|
|
4
|
+
version = "1.0.9"
|
|
5
5
|
dependencies = ["numpy>=2"]
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
readme = "README.md"
|
|
@@ -54,7 +54,7 @@ omit = [
|
|
|
54
54
|
]
|
|
55
55
|
|
|
56
56
|
[tool.bumpversion]
|
|
57
|
-
current_version = "1.0.
|
|
57
|
+
current_version = "1.0.9"
|
|
58
58
|
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
|
|
59
59
|
serialize = ["{major}.{minor}.{patch}"]
|
|
60
60
|
search = "{current_version}"
|
|
@@ -4,7 +4,7 @@ description = "Manage easily 1 or multidimensionnal samples numpy arrays that ar
|
|
|
4
4
|
authors = [
|
|
5
5
|
{ name = "Timothe Jost", email = "44769559+JostTim@users.noreply.github.com" },
|
|
6
6
|
]
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.9"
|
|
8
8
|
dependencies = ["numpy>=2"]
|
|
9
9
|
requires-python = ">=3.12"
|
|
10
10
|
readme = "README.md"
|
|
@@ -45,7 +45,7 @@ testpaths = ["tests"]
|
|
|
45
45
|
omit = [".vscode/*", ".tests/*"]
|
|
46
46
|
|
|
47
47
|
[tool.bumpversion]
|
|
48
|
-
current_version = "1.0.
|
|
48
|
+
current_version = "1.0.9"
|
|
49
49
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
50
50
|
serialize = ["{major}.{minor}.{patch}"]
|
|
51
51
|
search = "{current_version}"
|
|
@@ -233,10 +233,12 @@ class TimeIndexer[A: "BaseTimeArray"]:
|
|
|
233
233
|
Raises:
|
|
234
234
|
ValueError: If the input time type is not supported.
|
|
235
235
|
"""
|
|
236
|
-
# argument index may be a slice or a scalar. Units of index should be in
|
|
237
|
-
#
|
|
236
|
+
# argument index may be a slice or a scalar. Units of index should be in your time unit.
|
|
237
|
+
# Returns a slice as index
|
|
238
|
+
# this is sort of a wrapper for the different types of indices objects,
|
|
239
|
+
# around get_time_slice that does the heavy lifting.
|
|
238
240
|
# this function just makes sure to pass arguments to it corectly depending
|
|
239
|
-
# on
|
|
241
|
+
# on the according index object type.
|
|
240
242
|
|
|
241
243
|
if isinstance(time, slice):
|
|
242
244
|
# if we get a slice of times, we return a slice of indices
|
|
@@ -267,8 +269,6 @@ class TimeIndexer[A: "BaseTimeArray"]:
|
|
|
267
269
|
def max_step(self) -> np.floating:
|
|
268
270
|
return abs(self.array.timeline.max_step)
|
|
269
271
|
|
|
270
|
-
seconds_to_index = time_to_index
|
|
271
|
-
|
|
272
272
|
def insert_time_index_into_full_index[T: "int | slice | np.ndarray"](
|
|
273
273
|
self, time_index: T
|
|
274
274
|
) -> tuple[slice | T, ...]:
|
|
@@ -316,7 +316,8 @@ class TimeIndexer[A: "BaseTimeArray"]:
|
|
|
316
316
|
if hasattr(index, "__iter__"):
|
|
317
317
|
# if not isinstance(index,(int,float,slice,np.integer,np.floating)):
|
|
318
318
|
raise ValueError(
|
|
319
|
-
"
|
|
319
|
+
"TimeIndexer only allows indexing on time dimension. "
|
|
320
|
+
"Index must be either int, float or slice, not iterable"
|
|
320
321
|
)
|
|
321
322
|
|
|
322
323
|
index_time = self.time_to_index(index)
|
|
@@ -389,12 +390,12 @@ class TimeIndexer[A: "BaseTimeArray"]:
|
|
|
389
390
|
time_stop: float | None = None,
|
|
390
391
|
time_step: float | None = None,
|
|
391
392
|
) -> slice:
|
|
392
|
-
"""Get the index range based on the given start, stop, and step values in
|
|
393
|
+
"""Get the index range based on the given start, stop, and step values in time unit.
|
|
393
394
|
|
|
394
395
|
Args:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
time_start (float): The start time, in your time units. If None, start index will be will be set to the first point of the timeline (0).
|
|
397
|
+
time_stop (float): The stop time, in your time units. If None, the stop index will be set to the final point of the timeline.
|
|
398
|
+
time_step (float): The step size, in your time units. If None, the index step size will be 1.
|
|
398
399
|
|
|
399
400
|
Returns:
|
|
400
401
|
slice: A slice object representing the index range based on the given start, stop, and step values.
|
|
@@ -767,14 +768,14 @@ class BaseTimeArray(np.ndarray): # All time arrays are numpy arrays
|
|
|
767
768
|
aligned_arrays = [item.align_trace(start, maxlen) for item in iterable]
|
|
768
769
|
return cls(aligned_arrays)
|
|
769
770
|
|
|
770
|
-
def max_time(self) -> float:
|
|
771
|
-
"""Return the
|
|
771
|
+
def max_time(self) -> float:
|
|
772
|
+
"""Return the maximum time (in time units) from the timeline."""
|
|
772
773
|
|
|
773
774
|
# get maximum time
|
|
774
775
|
return self.timeline.max()
|
|
775
776
|
|
|
776
|
-
def min_time(self) -> float:
|
|
777
|
-
"""Get the minimum time from the timeline."""
|
|
777
|
+
def min_time(self) -> float:
|
|
778
|
+
"""Get the minimum time (in time units) from the timeline."""
|
|
778
779
|
|
|
779
780
|
# get minimum time
|
|
780
781
|
return self.timeline.min()
|
|
@@ -1236,8 +1237,8 @@ class TimelinedArray(BaseTimeArray):
|
|
|
1236
1237
|
timeline_step: This method returns the average time difference between each consecutive value in the timeline.
|
|
1237
1238
|
|
|
1238
1239
|
TimelinedArrayIndexer class, which has several methods, including:
|
|
1239
|
-
time_to_index: This method converts time in
|
|
1240
|
-
get_time_slice: This method converts time in
|
|
1240
|
+
time_to_index: This method converts time in time units, to integer index value.
|
|
1241
|
+
get_time_slice: This method converts time in time units, to an integer slice object representing time.
|
|
1241
1242
|
|
|
1242
1243
|
__new__ : This method is used to creates a new instance of the TimelinedArray class. It takes several optional
|
|
1243
1244
|
arguments: timeline, time_dimension, arange_timeline, and timeline_is_arranged.
|
|
File without changes
|