modusa 0.1.0__py3-none-any.whl → 0.2.1__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.
- modusa/.DS_Store +0 -0
- modusa/decorators.py +5 -5
- modusa/devtools/generate_template.py +80 -15
- modusa/devtools/main.py +6 -4
- modusa/devtools/templates/{engines.py → engine.py} +8 -7
- modusa/devtools/templates/{generators.py → generator.py} +8 -10
- modusa/devtools/templates/io.py +24 -0
- modusa/devtools/templates/{plugins.py → plugin.py} +7 -6
- modusa/devtools/templates/signal.py +40 -0
- modusa/devtools/templates/test.py +11 -0
- modusa/engines/.DS_Store +0 -0
- modusa/engines/__init__.py +1 -2
- modusa/generators/__init__.py +3 -1
- modusa/generators/audio_waveforms.py +227 -0
- modusa/generators/base.py +14 -25
- modusa/io/__init__.py +9 -0
- modusa/io/audio_converter.py +76 -0
- modusa/io/audio_loader.py +212 -0
- modusa/io/audio_player.py +72 -0
- modusa/io/base.py +43 -0
- modusa/io/plotter.py +430 -0
- modusa/io/youtube_downloader.py +139 -0
- modusa/main.py +15 -17
- modusa/plugins/__init__.py +1 -7
- modusa/signals/__init__.py +4 -6
- modusa/signals/audio_signal.py +421 -175
- modusa/signals/base.py +11 -271
- modusa/signals/frequency_domain_signal.py +329 -0
- modusa/signals/signal_ops.py +158 -0
- modusa/signals/spectrogram.py +465 -0
- modusa/signals/time_domain_signal.py +309 -0
- modusa/utils/excp.py +5 -0
- {modusa-0.1.0.dist-info → modusa-0.2.1.dist-info}/METADATA +16 -11
- modusa-0.2.1.dist-info/RECORD +47 -0
- modusa/devtools/templates/signals.py +0 -63
- modusa/engines/plot_1dsignal.py +0 -130
- modusa/engines/plot_2dmatrix.py +0 -159
- modusa/generators/basic_waveform.py +0 -185
- modusa/plugins/plot_1dsignal.py +0 -59
- modusa/plugins/plot_2dmatrix.py +0 -76
- modusa/plugins/plot_time_domain_signal.py +0 -59
- modusa/signals/signal1d.py +0 -311
- modusa/signals/signal2d.py +0 -226
- modusa/signals/uniform_time_domain_signal.py +0 -212
- modusa-0.1.0.dist-info/RECORD +0 -41
- {modusa-0.1.0.dist-info → modusa-0.2.1.dist-info}/WHEEL +0 -0
- {modusa-0.1.0.dist-info → modusa-0.2.1.dist-info}/entry_points.txt +0 -0
- {modusa-0.1.0.dist-info → modusa-0.2.1.dist-info}/licenses/LICENSE.md +0 -0
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
from modusa import excp
|
|
5
|
-
from modusa.decorators import immutable_property, validate_args_type
|
|
6
|
-
from modusa.signals.base import ModusaSignal
|
|
7
|
-
from typing import Self, Any
|
|
8
|
-
import numpy as np
|
|
9
|
-
import matplotlib.pyplot as plt
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class UniformTimeDomainSignal(ModusaSignal):
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
#--------Meta Information----------
|
|
18
|
-
name = "Uniform Time Domain Signal"
|
|
19
|
-
description = ""
|
|
20
|
-
author_name = "Ankit Anand"
|
|
21
|
-
author_email = "ankit0.anand0@gmail.com"
|
|
22
|
-
created_at = "2025-07-02"
|
|
23
|
-
#----------------------------------
|
|
24
|
-
|
|
25
|
-
@validate_args_type()
|
|
26
|
-
def __init__(self, y: np.ndarray, t: np.ndarray | None = None):
|
|
27
|
-
if y.ndim != 1:
|
|
28
|
-
raise excp.InputValueError(f"`y` must have 1 dimension not {y.ndim}.")
|
|
29
|
-
if y.shape[0] < 1:
|
|
30
|
-
raise excp.InputValueError(f"`y` must have atleast 1 element.")
|
|
31
|
-
|
|
32
|
-
if t is None:
|
|
33
|
-
t = np.arange(y.shape[0])
|
|
34
|
-
else:
|
|
35
|
-
if t.ndim != 1:
|
|
36
|
-
raise excp.InputValueError(f"`t` must have 1 dimension not {t.ndim}.")
|
|
37
|
-
if t.shape[0] != y.shape[0]:
|
|
38
|
-
raise excp.InputValueError(f"`t` and `y` must have same shape.")
|
|
39
|
-
|
|
40
|
-
super().__init__(data=y, data_idx=t) # Instantiating `ModusaSignal` class
|
|
41
|
-
|
|
42
|
-
self._y_unit = ""
|
|
43
|
-
self._t_unit = "index"
|
|
44
|
-
|
|
45
|
-
self._title = "aa"
|
|
46
|
-
self._y_label = ""
|
|
47
|
-
self._t_label = "Time"
|
|
48
|
-
|
|
49
|
-
def _with_data(self, new_data: np.ndarray, new_data_idx: np.ndarray) -> Self:
|
|
50
|
-
"""Subclasses must override this to return a copy with new data."""
|
|
51
|
-
Ts = new_data_idx[1] - new_data_idx[0]
|
|
52
|
-
new_signal = self.__class__(y=new_data, Ts=self.Ts)
|
|
53
|
-
new_signal.set_units(y_unit=self.y_unit, t_unit=self.t_unit)
|
|
54
|
-
new_signal.set_plot_labels(title=self.title, y_label=self.y_label, t_label=self.t_label)
|
|
55
|
-
|
|
56
|
-
return new_signal
|
|
57
|
-
|
|
58
|
-
#----------------------
|
|
59
|
-
# From methods
|
|
60
|
-
#----------------------
|
|
61
|
-
@classmethod
|
|
62
|
-
@validate_args_type()
|
|
63
|
-
def from_array(cls, y: np.ndarray, t: np.ndarray | None = None, t_unit: str | None = None) -> Self:
|
|
64
|
-
|
|
65
|
-
signal: Self = cls(y=y, t=t)
|
|
66
|
-
|
|
67
|
-
if t_unit is not None:
|
|
68
|
-
signal.set_units(t_unit=t_unit)
|
|
69
|
-
|
|
70
|
-
return signal
|
|
71
|
-
|
|
72
|
-
@classmethod
|
|
73
|
-
@validate_args_type()
|
|
74
|
-
def from_array_with_Ts(cls, y: np.ndarray, Ts: float | None = None, t_unit: str | None = None) -> Self:
|
|
75
|
-
|
|
76
|
-
t = np.arange(y.shape[0]) * Ts
|
|
77
|
-
signal: Self = cls(y=y, t=t)
|
|
78
|
-
|
|
79
|
-
if t_unit is not None:
|
|
80
|
-
signal.set_units(t_unit=t_unit)
|
|
81
|
-
|
|
82
|
-
return signal
|
|
83
|
-
|
|
84
|
-
#----------------------
|
|
85
|
-
# Setters
|
|
86
|
-
#----------------------
|
|
87
|
-
|
|
88
|
-
@validate_args_type()
|
|
89
|
-
def set_units(
|
|
90
|
-
self,
|
|
91
|
-
y_unit: str | None = None,
|
|
92
|
-
t_unit: str | None = None,
|
|
93
|
-
) -> Self:
|
|
94
|
-
if y_unit is not None:
|
|
95
|
-
self._y_unit = y_unit
|
|
96
|
-
if t_unit is not None:
|
|
97
|
-
self._t_unit = t_unit
|
|
98
|
-
|
|
99
|
-
return self
|
|
100
|
-
|
|
101
|
-
@validate_args_type()
|
|
102
|
-
def set_plot_labels(
|
|
103
|
-
self,
|
|
104
|
-
title: str | None = None,
|
|
105
|
-
y_label: str | None = None,
|
|
106
|
-
t_label: str | None = None
|
|
107
|
-
) -> Self:
|
|
108
|
-
""""""
|
|
109
|
-
if title is not None:
|
|
110
|
-
self._title = title
|
|
111
|
-
if y_label is not None:
|
|
112
|
-
self._y_label = y_label
|
|
113
|
-
if t_label is not None:
|
|
114
|
-
self._t_label = t_label
|
|
115
|
-
|
|
116
|
-
return self
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
#----------------------
|
|
121
|
-
# Properties
|
|
122
|
-
#----------------------
|
|
123
|
-
|
|
124
|
-
@immutable_property("Create a new object instead.")
|
|
125
|
-
def y(self) -> np.ndarray:
|
|
126
|
-
return self.data
|
|
127
|
-
|
|
128
|
-
@immutable_property("Create a new object instead.")
|
|
129
|
-
def t(self) -> np.ndarray:
|
|
130
|
-
return self.data_idx
|
|
131
|
-
|
|
132
|
-
@immutable_property("Use `.set_t` instead.")
|
|
133
|
-
def y_unit(self) -> str:
|
|
134
|
-
return self._y_unit
|
|
135
|
-
|
|
136
|
-
@immutable_property("Use `.set_t` instead.")
|
|
137
|
-
def t_unit(self) -> str:
|
|
138
|
-
return self._t_unit
|
|
139
|
-
|
|
140
|
-
@immutable_property("Use `.labels` instead.")
|
|
141
|
-
def title(self) -> str:
|
|
142
|
-
return self._title
|
|
143
|
-
|
|
144
|
-
@immutable_property("Use `.set_t` instead.")
|
|
145
|
-
def y_label(self) -> str:
|
|
146
|
-
return self._y_label
|
|
147
|
-
|
|
148
|
-
@immutable_property("Use `.set_t` instead.")
|
|
149
|
-
def t_label(self) -> str:
|
|
150
|
-
return self._t_label
|
|
151
|
-
|
|
152
|
-
@immutable_property("Use `.resample` instead.")
|
|
153
|
-
def Ts(self) -> float:
|
|
154
|
-
"""Sampling period of the signal."""
|
|
155
|
-
return self.t[1] - self.t[0]
|
|
156
|
-
|
|
157
|
-
@immutable_property("Use `.resample` instead.")
|
|
158
|
-
def sr(self) -> float:
|
|
159
|
-
"""
|
|
160
|
-
Sampling rate of the signal.
|
|
161
|
-
"""
|
|
162
|
-
return 1.0 / self.Ts
|
|
163
|
-
|
|
164
|
-
@immutable_property(error_msg="Use `.set_labels` instead.")
|
|
165
|
-
def labels(self) -> tuple[str, str, str]:
|
|
166
|
-
"""Labels in a format appropriate for the plots."""
|
|
167
|
-
return (self.title, f"{self.y_label} ({self.y_unit})", f"{self.t_label} ({self.t_unit})")
|
|
168
|
-
|
|
169
|
-
#----------------------
|
|
170
|
-
# Plugins Access
|
|
171
|
-
#----------------------
|
|
172
|
-
@validate_args_type()
|
|
173
|
-
def plot(
|
|
174
|
-
self,
|
|
175
|
-
scale_y: tuple[float, float] | None = None,
|
|
176
|
-
scale_t: tuple[float, float] | None = None,
|
|
177
|
-
ax: plt.Axes | None = None,
|
|
178
|
-
color: str = "b",
|
|
179
|
-
marker: str | None = None,
|
|
180
|
-
linestyle: str | None = None,
|
|
181
|
-
stem: bool | None = None,
|
|
182
|
-
labels: tuple[str, str, str] | None = None,
|
|
183
|
-
legend_loc: str | None = None,
|
|
184
|
-
zoom: tuple[float, float] | None = None,
|
|
185
|
-
highlight: list[tuple[float, float]] | None = None,
|
|
186
|
-
) -> plt.Figure:
|
|
187
|
-
"""
|
|
188
|
-
Applies `modusa.plugins.PlotTimeDomainSignal` Plugin.
|
|
189
|
-
"""
|
|
190
|
-
|
|
191
|
-
from modusa.plugins import PlotTimeDomainSignalPlugin
|
|
192
|
-
|
|
193
|
-
labels = labels or self.labels
|
|
194
|
-
stem = stem or False
|
|
195
|
-
|
|
196
|
-
fig: plt.Figure | None = PlotTimeDomainSignalPlugin().apply(
|
|
197
|
-
signal=self,
|
|
198
|
-
scale_y=scale_y,
|
|
199
|
-
scale_t=scale_t,
|
|
200
|
-
ax=ax,
|
|
201
|
-
color=color,
|
|
202
|
-
marker=marker,
|
|
203
|
-
linestyle=linestyle,
|
|
204
|
-
stem=stem,
|
|
205
|
-
labels=labels,
|
|
206
|
-
legend_loc=legend_loc,
|
|
207
|
-
zoom=zoom,
|
|
208
|
-
highlight=highlight
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
return fig
|
|
212
|
-
|
modusa-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
modusa-0.1.0.dist-info/METADATA,sha256=gJkbRke4vQ91d1kGiOAEOZxTABmPRHUsK8DFF979Abc,2026
|
|
2
|
-
modusa-0.1.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
-
modusa-0.1.0.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
|
|
4
|
-
modusa-0.1.0.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
|
|
5
|
-
modusa/.DS_Store,sha256=XmYb59Z5I9QAhS9vvksVzCbsHT2q9D4A3oZtrgkDWsA,8196
|
|
6
|
-
modusa/__init__.py,sha256=bfQKVSpAXlKmKvMRIU6WSRQW2qoJsaZsdNJ8E69ghn0,37
|
|
7
|
-
modusa/config.py,sha256=bTqK4t00FZqERVITrxW_q284aDDJAa9aMSfFknfR-oU,280
|
|
8
|
-
modusa/decorators.py,sha256=r2r411sXHjl29zFVwoCvcQ5Pb8war-drSuDinHfPYq4,5905
|
|
9
|
-
modusa/devtools/generate_template.py,sha256=X_9VC87LBrd9x4_GNkisJ6S9bimp8AdNmv7esdd4Ad0,2567
|
|
10
|
-
modusa/devtools/list_authors.py,sha256=FWBQKOLznVthvMYMASrx2Gw5lqKHEOccQpBisDZ53Dw,24
|
|
11
|
-
modusa/devtools/list_plugins.py,sha256=g-R5hoaCzHfClY_Sfa788IQ9CAKzQGTfyqmthXDZQqw,1729
|
|
12
|
-
modusa/devtools/main.py,sha256=L9KpdX4ob1CW7KNCULgVes7LIfHUn25Wo5Jp5mMgX5g,1704
|
|
13
|
-
modusa/devtools/templates/engines.py,sha256=ut3-jyRI5TmwJlni3nu4HQ7t0do_VtQuTS1sdkCePxI,512
|
|
14
|
-
modusa/devtools/templates/generators.py,sha256=qXvsxJ6tTj6LLlUYpXnKsDfXT2dz3wDrBzv5ZhPO1do,457
|
|
15
|
-
modusa/devtools/templates/plugins.py,sha256=n451iIlTOuQtpHywI8c_teyGMSMd3QCLYDUyLmg0v8Y,839
|
|
16
|
-
modusa/devtools/templates/signals.py,sha256=Sv0D5Irhvgnn7Q0kWKF9ryTgPmNie9kvUxOnjZCgUTQ,1210
|
|
17
|
-
modusa/engines/__init__.py,sha256=cKVTJjAwhlLF2x5tpvYAmxIR9B6CFOGeYsVKKJoUm2I,115
|
|
18
|
-
modusa/engines/base.py,sha256=gHeGTbvcPhTxwUwt16OLpepMkbG40rv19vs8tN8xqgA,297
|
|
19
|
-
modusa/engines/plot_1dsignal.py,sha256=0qaRuMDP5ZLnxrE53v1D-0aHu2hcpH-dMfPRRKAUVhY,3589
|
|
20
|
-
modusa/engines/plot_2dmatrix.py,sha256=q_k08170ras9lBjI37SYArrDkQjlKd2wicVc_iykvsU,4393
|
|
21
|
-
modusa/generators/__init__.py,sha256=0tr-StwA50XArEfz7jDASyQhd7Au-d4RuNhzooAYuhQ,74
|
|
22
|
-
modusa/generators/base.py,sha256=F0xUu97A6LJ3AIZ3VcxRw-oMMpjK13zotHprM0_WJa8,1185
|
|
23
|
-
modusa/generators/basic_waveform.py,sha256=FtglesHsLGflIJ2ROO1mYoDTgouXoDE_896qB9J1_2Y,4540
|
|
24
|
-
modusa/main.py,sha256=X3uq5nfHt89_EsnyRHNMkX-j5dxSuaTMF3EPu6XPr48,665
|
|
25
|
-
modusa/plugins/__init__.py,sha256=bGPEyqRaNR2uhrRbX0n_FWK4IqjlZ42akUNIbe_WUe8,211
|
|
26
|
-
modusa/plugins/base.py,sha256=Bh_1Bja7fOymFsCgwhXDbV6ys3D8muNrPwrfDrG_G_A,2382
|
|
27
|
-
modusa/plugins/plot_1dsignal.py,sha256=_Annn_4QgVTAlWanY2nctw0MIQyoEhR8u8gx8WAMd5c,1885
|
|
28
|
-
modusa/plugins/plot_2dmatrix.py,sha256=FXmQvUhod66Q4-jWIKb6IrP8aVmC67V7urxMSV4LJSg,2135
|
|
29
|
-
modusa/plugins/plot_time_domain_signal.py,sha256=fiyFQZ4VS_uvaVOm8LBryqxuWd57sf4vvKB25YqriPU,1804
|
|
30
|
-
modusa/signals/__init__.py,sha256=QjJUuEjbJR9UHbPPYXJVZ7oZP1YnDy1DPRl1HWqEP50,220
|
|
31
|
-
modusa/signals/audio_signal.py,sha256=8QaXt-LdTc_yVDLXXExlWCzzqgR-MxgwPEk30CXuanQ,5576
|
|
32
|
-
modusa/signals/base.py,sha256=fXPYPsaTcvZ323hkzjigKR1EZfNw6ZTxOUonbuzACnA,8362
|
|
33
|
-
modusa/signals/signal1d.py,sha256=sjUuRO4BEhhfJFdA3rJfIBYQxSwR_9u0Ym1_RZQQvRI,7711
|
|
34
|
-
modusa/signals/signal2d.py,sha256=7GvmsYEgavoMTSyacbQHva9eyc2aSII3aqOcbKzOG7A,5677
|
|
35
|
-
modusa/signals/uniform_time_domain_signal.py,sha256=lws6n3eYOg5Bwgb-iwZwUgvN6kbxKE4n15rCqOODguA,5250
|
|
36
|
-
modusa/utils/.DS_Store,sha256=nLXMwF7QJNuglLI_Gk74F7vl5Dyus2Wd74Mgowijmdo,6148
|
|
37
|
-
modusa/utils/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
|
|
38
|
-
modusa/utils/config.py,sha256=cuGbqbovx5WDQq5rw3hIKcv3CnE5NttjacSOWnP1yu4,576
|
|
39
|
-
modusa/utils/excp.py,sha256=3HkCyyvwE035hAq5-0srb-82AYSI-_8vszKU6Fe3O3k,1189
|
|
40
|
-
modusa/utils/logger.py,sha256=K0rsnObeNKCxlNeSnVnJeRhgfmob6riB2uyU7h3dDmA,571
|
|
41
|
-
modusa-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|