libinephany 0.16.0__py3-none-any.whl → 0.16.2__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.
- libinephany/observations/observation_utils.py +14 -3
- {libinephany-0.16.0.dist-info → libinephany-0.16.2.dist-info}/METADATA +1 -1
- {libinephany-0.16.0.dist-info → libinephany-0.16.2.dist-info}/RECORD +6 -6
- {libinephany-0.16.0.dist-info → libinephany-0.16.2.dist-info}/WHEEL +0 -0
- {libinephany-0.16.0.dist-info → libinephany-0.16.2.dist-info}/licenses/LICENSE +0 -0
- {libinephany-0.16.0.dist-info → libinephany-0.16.2.dist-info}/top_level.txt +0 -0
@@ -4,6 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# ======================================================================================================================
|
6
6
|
|
7
|
+
import math
|
7
8
|
from enum import Enum
|
8
9
|
from itertools import chain
|
9
10
|
from typing import Any, Callable
|
@@ -54,15 +55,25 @@ class StatisticStorageTypes(Enum):
|
|
54
55
|
# ======================================================================================================================
|
55
56
|
|
56
57
|
|
57
|
-
def get_exponential_weighted_average(values: list[float]) -> float:
|
58
|
+
def get_exponential_weighted_average(values: list[int | float]) -> float:
|
58
59
|
"""
|
59
60
|
:param values: List of values to average via EWA.
|
60
61
|
:return: EWA of the given values.
|
61
62
|
"""
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
# Check for NaN and infinite values in input
|
65
|
+
valid_values = [float(val) for val in values if not math.isnan(float(val)) and not math.isinf(float(val))]
|
66
|
+
|
67
|
+
if not valid_values:
|
68
|
+
raise ValueError("Cannot compute exponential weighted average on empty list")
|
65
69
|
|
70
|
+
if len(valid_values) == 1:
|
71
|
+
return valid_values[0]
|
72
|
+
|
73
|
+
exp_weighted_average = pd.Series(valid_values).ewm(alpha=0.1).mean().iloc[-1]
|
74
|
+
assert isinstance(exp_weighted_average, float)
|
75
|
+
assert not math.isnan(exp_weighted_average)
|
76
|
+
assert not math.isinf(exp_weighted_average)
|
66
77
|
return exp_weighted_average
|
67
78
|
|
68
79
|
|
@@ -2,7 +2,7 @@ libinephany/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
libinephany/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
libinephany/aws/s3_functions.py,sha256=W8u85A6tDloo4FlJvydJbVHCUq_m9i8KDGdnKzy-Xpg,1745
|
4
4
|
libinephany/observations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
libinephany/observations/observation_utils.py,sha256=
|
5
|
+
libinephany/observations/observation_utils.py,sha256=z3WfEf7Dvj8sS0FmbPpjolPeFWX64SVUJF5Rydf3Whs,9949
|
6
6
|
libinephany/observations/observer_pipeline.py,sha256=RvMH-TTDTu1Nk4S_KSHDkII1YuIRMSOXkPhn6g4B9ow,12815
|
7
7
|
libinephany/observations/pipeline_coordinator.py,sha256=mw3c5jy_BWvNigUKNjIWMpReOjxFDblzOcWtsIkcls4,7907
|
8
8
|
libinephany/observations/statistic_manager.py,sha256=LLg1zSxnJr2oQQepYla3qoUuRy10rsthr9jta4wEbnc,8956
|
@@ -50,8 +50,8 @@ libinephany/utils/typing.py,sha256=rGbaPO3MaUndsWiC_wHzReD_TOLYqb43i01pKN-j7Xs,6
|
|
50
50
|
libinephany/web_apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
51
|
libinephany/web_apps/error_logger.py,sha256=gAQIaqerqP4ornXZwFF1cghjnd2mMZEt3aVrTuUCr34,16653
|
52
52
|
libinephany/web_apps/web_app_utils.py,sha256=qiq_lasPipgN1RgRudPJc342kYci8O_4RqppxmIX8NY,4095
|
53
|
-
libinephany-0.16.
|
54
|
-
libinephany-0.16.
|
55
|
-
libinephany-0.16.
|
56
|
-
libinephany-0.16.
|
57
|
-
libinephany-0.16.
|
53
|
+
libinephany-0.16.2.dist-info/licenses/LICENSE,sha256=pogfDoMBP07ehIOvWymuWIar8pg2YLUhqOHsJQU3wdc,9250
|
54
|
+
libinephany-0.16.2.dist-info/METADATA,sha256=Z2AWEXlxferKx485-LUssVO3KpfilmonaTJWzP2XBFI,8354
|
55
|
+
libinephany-0.16.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
56
|
+
libinephany-0.16.2.dist-info/top_level.txt,sha256=bYAOXQdJgIoLkO2Ui0kxe7pSYegS_e38u0dMscd7COQ,12
|
57
|
+
libinephany-0.16.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|