ezmsg-sigproc 2.0.0__py3-none-any.whl → 2.1.0__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.
- ezmsg/sigproc/__version__.py +2 -2
- ezmsg/sigproc/aggregate.py +21 -4
- ezmsg/sigproc/bandpower.py +8 -2
- {ezmsg_sigproc-2.0.0.dist-info → ezmsg_sigproc-2.1.0.dist-info}/METADATA +1 -1
- {ezmsg_sigproc-2.0.0.dist-info → ezmsg_sigproc-2.1.0.dist-info}/RECORD +7 -7
- {ezmsg_sigproc-2.0.0.dist-info → ezmsg_sigproc-2.1.0.dist-info}/WHEEL +0 -0
- {ezmsg_sigproc-2.0.0.dist-info → ezmsg_sigproc-2.1.0.dist-info}/licenses/LICENSE.txt +0 -0
ezmsg/sigproc/__version__.py
CHANGED
ezmsg/sigproc/aggregate.py
CHANGED
|
@@ -36,6 +36,7 @@ class AggregationFunction(OptionsEnum):
|
|
|
36
36
|
NANSUM = "nansum"
|
|
37
37
|
ARGMIN = "argmin"
|
|
38
38
|
ARGMAX = "argmax"
|
|
39
|
+
TRAPEZOID = "trapezoid"
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
AGGREGATORS = {
|
|
@@ -54,6 +55,9 @@ AGGREGATORS = {
|
|
|
54
55
|
AggregationFunction.NANSUM: np.nansum,
|
|
55
56
|
AggregationFunction.ARGMIN: np.argmin,
|
|
56
57
|
AggregationFunction.ARGMAX: np.argmax,
|
|
58
|
+
# Note: Some methods require x-coordinates and
|
|
59
|
+
# are handled specially in `_process`.
|
|
60
|
+
AggregationFunction.TRAPEZOID: np.trapezoid,
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
|
|
@@ -144,10 +148,23 @@ class RangedAggregateTransformer(
|
|
|
144
148
|
ax_idx = message.get_axis_idx(axis)
|
|
145
149
|
agg_func = AGGREGATORS[self.settings.operation]
|
|
146
150
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
if self.settings.operation in [
|
|
152
|
+
AggregationFunction.TRAPEZOID,
|
|
153
|
+
]:
|
|
154
|
+
# Special handling for methods that require x-coordinates.
|
|
155
|
+
out_data = [
|
|
156
|
+
agg_func(
|
|
157
|
+
slice_along_axis(message.data, sl, axis=ax_idx),
|
|
158
|
+
x=self._state.ax_vec[sl],
|
|
159
|
+
axis=ax_idx,
|
|
160
|
+
)
|
|
161
|
+
for sl in self._state.slices
|
|
162
|
+
]
|
|
163
|
+
else:
|
|
164
|
+
out_data = [
|
|
165
|
+
agg_func(slice_along_axis(message.data, sl, axis=ax_idx), axis=ax_idx)
|
|
166
|
+
for sl in self._state.slices
|
|
167
|
+
]
|
|
151
168
|
|
|
152
169
|
msg_out = replace(
|
|
153
170
|
message,
|
ezmsg/sigproc/bandpower.py
CHANGED
|
@@ -36,6 +36,9 @@ class BandPowerSettings(ez.Settings):
|
|
|
36
36
|
(min, max) tuples of band limits in Hz.
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
+
aggregation: AggregationFunction = AggregationFunction.MEAN
|
|
40
|
+
""":obj:`AggregationFunction` to apply to each band."""
|
|
41
|
+
|
|
39
42
|
|
|
40
43
|
class BandPowerTransformer(CompositeProcessor[BandPowerSettings, AxisArray, AxisArray]):
|
|
41
44
|
@staticmethod
|
|
@@ -50,7 +53,7 @@ class BandPowerTransformer(CompositeProcessor[BandPowerSettings, AxisArray, Axis
|
|
|
50
53
|
settings=RangedAggregateSettings(
|
|
51
54
|
axis="freq",
|
|
52
55
|
bands=settings.bands,
|
|
53
|
-
operation=
|
|
56
|
+
operation=settings.aggregation,
|
|
54
57
|
)
|
|
55
58
|
),
|
|
56
59
|
}
|
|
@@ -68,6 +71,7 @@ def bandpower(
|
|
|
68
71
|
(17, 30),
|
|
69
72
|
(70, 170),
|
|
70
73
|
],
|
|
74
|
+
aggregation: AggregationFunction = AggregationFunction.MEAN,
|
|
71
75
|
) -> BandPowerTransformer:
|
|
72
76
|
"""
|
|
73
77
|
Calculate the average spectral power in each band.
|
|
@@ -77,6 +81,8 @@ def bandpower(
|
|
|
77
81
|
"""
|
|
78
82
|
return BandPowerTransformer(
|
|
79
83
|
settings=BandPowerSettings(
|
|
80
|
-
spectrogram_settings=spectrogram_settings,
|
|
84
|
+
spectrogram_settings=spectrogram_settings,
|
|
85
|
+
bands=bands,
|
|
86
|
+
aggregation=aggregation,
|
|
81
87
|
)
|
|
82
88
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ezmsg-sigproc
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Timeseries signal processing implementations in ezmsg
|
|
5
5
|
Author-email: Griffin Milsap <griffin.milsap@gmail.com>, Preston Peranich <pperanich@gmail.com>, Chadwick Boulay <chadwick.boulay@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ezmsg/sigproc/__init__.py,sha256=8K4IcOA3-pfzadoM6s2Sfg5460KlJUocGgyTJTJl96U,52
|
|
2
|
-
ezmsg/sigproc/__version__.py,sha256=
|
|
2
|
+
ezmsg/sigproc/__version__.py,sha256=dseuoOPG9WZ1Ezr1SC3wS9_hczkX-b1NdE4TQPHFJso,511
|
|
3
3
|
ezmsg/sigproc/activation.py,sha256=qWAhpbFBxSoqbGy4P9JKE5LY-5v8rQI1U81OvNxBG2Y,2820
|
|
4
4
|
ezmsg/sigproc/adaptive_lattice_notch.py,sha256=3M65PrZpdgBlQtE7Ph4Gu2ISIyWw4j8Xxhm5PpSkLFw,9102
|
|
5
5
|
ezmsg/sigproc/affinetransform.py,sha256=WU495KoDKZfHPS3Dumh65rgf639koNlfDIx_torIByg,8662
|
|
6
|
-
ezmsg/sigproc/aggregate.py,sha256=
|
|
7
|
-
ezmsg/sigproc/bandpower.py,sha256=
|
|
6
|
+
ezmsg/sigproc/aggregate.py,sha256=KR3u9D9jx9KcOQlvI10I6krSxbZCIerG2i4u5Wu5qMI,6754
|
|
7
|
+
ezmsg/sigproc/bandpower.py,sha256=j-Y6iWjD2xkggfi-4HAFJVBPJHHBGvAZy1uM4murZkQ,2319
|
|
8
8
|
ezmsg/sigproc/base.py,sha256=PQr03O2P1v9LzcSR0GJLvPpBCLtnmGaz76gUeXphcH4,48753
|
|
9
9
|
ezmsg/sigproc/butterworthfilter.py,sha256=7ZP4CRsXBt3-5dzyUjD45vc0J3Fhpm4CLrk-ps28jhc,5305
|
|
10
10
|
ezmsg/sigproc/cheby.py,sha256=-aSauAwxJmmSSiRaw5qGY9rvYFOmk1bZlS4gGrS0jls,3737
|
|
@@ -45,7 +45,7 @@ ezmsg/sigproc/util/message.py,sha256=l_b1b6bXX8N6VF9RbUELzsHs73cKkDURBdIr0lt3CY0
|
|
|
45
45
|
ezmsg/sigproc/util/profile.py,sha256=KNJ_QkKelQHNEp2C8MhqzdhYydMNULc_NQq3ccMfzIk,5775
|
|
46
46
|
ezmsg/sigproc/util/sparse.py,sha256=8Ke0jh3jRPi_TwIdLTwLdojQiaqPs6QV-Edqpx81VoI,1036
|
|
47
47
|
ezmsg/sigproc/util/typeresolution.py,sha256=5R7xmG-F4CkdqQ5aoQnqM-htQb-VwAJl58jJgxtClys,3146
|
|
48
|
-
ezmsg_sigproc-2.
|
|
49
|
-
ezmsg_sigproc-2.
|
|
50
|
-
ezmsg_sigproc-2.
|
|
51
|
-
ezmsg_sigproc-2.
|
|
48
|
+
ezmsg_sigproc-2.1.0.dist-info/METADATA,sha256=DuXuzu_YGIIldSiNwz9g72hu5x8JAHjxhGGsy5JXkS0,2479
|
|
49
|
+
ezmsg_sigproc-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
50
|
+
ezmsg_sigproc-2.1.0.dist-info/licenses/LICENSE.txt,sha256=seu0tKhhAMPCUgc1XpXGGaCxY1YaYvFJwqFuQZAl2go,1100
|
|
51
|
+
ezmsg_sigproc-2.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|