modusa 0.3.21__py3-none-any.whl → 0.3.22__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/tools/plotter.py +20 -8
- {modusa-0.3.21.dist-info → modusa-0.3.22.dist-info}/METADATA +1 -1
- {modusa-0.3.21.dist-info → modusa-0.3.22.dist-info}/RECORD +6 -8
- modusa/main.py +0 -3
- modusa/tmp.py +0 -98
- {modusa-0.3.21.dist-info → modusa-0.3.22.dist-info}/WHEEL +0 -0
- {modusa-0.3.21.dist-info → modusa-0.3.22.dist-info}/entry_points.txt +0 -0
- {modusa-0.3.21.dist-info → modusa-0.3.22.dist-info}/licenses/LICENSE.md +0 -0
modusa/tools/plotter.py
CHANGED
|
@@ -59,7 +59,7 @@ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylab
|
|
|
59
59
|
plt.Figure
|
|
60
60
|
Matplolib figure.
|
|
61
61
|
"""
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
for arg in args:
|
|
64
64
|
if len(arg) not in [1, 2]: # 1 if it just provides values, 2 if it provided axis as well
|
|
65
65
|
raise ValueError(f"1D signal needs to have max 2 arrays (y, x) or simply (y, )")
|
|
@@ -115,9 +115,16 @@ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylab
|
|
|
115
115
|
width = end - start
|
|
116
116
|
rect = Rectangle((start, 0), width, 1, color=color, alpha=0.7)
|
|
117
117
|
annotation_ax.add_patch(rect)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
|
|
119
|
+
text_obj = annotation_ax.text(
|
|
120
|
+
(start + end) / 2, 0.5, tag,
|
|
121
|
+
ha='center', va='center',
|
|
122
|
+
fontsize=10, color='white', fontweight='bold', zorder=10, clip_on=True
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
text_obj.set_clip_path(rect)
|
|
126
|
+
|
|
127
|
+
|
|
121
128
|
# Add vlines
|
|
122
129
|
if events is not None:
|
|
123
130
|
for xpos in events:
|
|
@@ -140,7 +147,7 @@ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylab
|
|
|
140
147
|
if ylabel is not None:
|
|
141
148
|
signal_ax.set_ylabel(ylabel)
|
|
142
149
|
|
|
143
|
-
#
|
|
150
|
+
# Remove the boundaries and ticks from an axis
|
|
144
151
|
if ann is not None:
|
|
145
152
|
annotation_ax.tick_params(left=False, bottom=False, labelleft=False, labelbottom=False)
|
|
146
153
|
else:
|
|
@@ -296,9 +303,14 @@ def plot2d(*args, ann=None, events=None, xlim=None, ylim=None, origin="lower", M
|
|
|
296
303
|
width = end - start
|
|
297
304
|
rect = Rectangle((start, 0), width, 1, color=color, alpha=0.7)
|
|
298
305
|
annotation_ax.add_patch(rect)
|
|
299
|
-
annotation_ax.text(
|
|
300
|
-
|
|
301
|
-
|
|
306
|
+
text_obj = annotation_ax.text(
|
|
307
|
+
(start + end) / 2, 0.5, tag,
|
|
308
|
+
ha='center', va='center',
|
|
309
|
+
fontsize=10, color='white', fontweight='bold', zorder=10, clip_on=True
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
text_obj.set_clip_path(rect)
|
|
313
|
+
|
|
302
314
|
# Add vlines
|
|
303
315
|
if events is not None:
|
|
304
316
|
for xpos in events:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
modusa-0.3.
|
|
2
|
-
modusa-0.3.
|
|
3
|
-
modusa-0.3.
|
|
4
|
-
modusa-0.3.
|
|
1
|
+
modusa-0.3.22.dist-info/METADATA,sha256=uKAnJIVUJhOqOl4eXWXtvytJ7dACKCk3Te-0bctAzCA,1369
|
|
2
|
+
modusa-0.3.22.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
modusa-0.3.22.dist-info/entry_points.txt,sha256=fmKpleVXj6CdaBVL14WoEy6xx7JQCs85jvzwTi3lePM,73
|
|
4
|
+
modusa-0.3.22.dist-info/licenses/LICENSE.md,sha256=JTaXAjx5awk76VArKCx5dUW8vmLEWsL_ZlR7-umaHbA,1078
|
|
5
5
|
modusa/.DS_Store,sha256=_gm6qJREwfMi8dE7n5S89_RG46u5t3xHyD-smNhtNoM,6148
|
|
6
6
|
modusa/__init__.py,sha256=AALG_17vibpDZbo0MymvGoQroaLp3uVm_onZaESONQA,257
|
|
7
7
|
modusa/config.py,sha256=bTqK4t00FZqERVITrxW_q284aDDJAa9aMSfFknfR-oU,280
|
|
@@ -27,7 +27,6 @@ modusa/generators/s2d.py,sha256=kU67dZj4tdIDSUFJeheXm_JKbyHpZZOGmW5jya6w0wo,6874
|
|
|
27
27
|
modusa/generators/s_ax.py,sha256=4CTFp_KwYnl4HDno-ATpTXOfKR9WEVOV45nwuk2OoVk,2221
|
|
28
28
|
modusa/generators/t_ax.py,sha256=X-XOJuGWw99dPAVsCVzNTfBFr81Vw56aZlGDmcl5q3k,1478
|
|
29
29
|
modusa/generators/tds.py,sha256=eGvzcjXyWaw5NVzM3D098r3xkoMcX8Ma9YoDUdL30Mo,5960
|
|
30
|
-
modusa/main.py,sha256=v9oOhnPcbw8ULfkKRoantEfHw7MqOETJwXC-odx3dnA,25
|
|
31
30
|
modusa/models/__init__.py,sha256=G8sNOnBnTKqPmC4Z46ximBhc_pfBOF_G6AIfxT8DFzw,271
|
|
32
31
|
modusa/models/__pycache__/signal1D.cpython-312.pyc.4443461152,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
32
|
modusa/models/audio.py,sha256=IcNx3h8tb5Jt6KZug_TQKM5iufVk3i7Ug37iKG4gsJ0,2411
|
|
@@ -41,14 +40,13 @@ modusa/models/t_ax.py,sha256=ZUhvZPUW1TkdZYuUd6Ucm-vsv0JqtZ9yEe3ab67Ma6w,8022
|
|
|
41
40
|
modusa/models/tds.py,sha256=FAGfibjyyE_lkEuQp-vSCuqQnopOjmy_IXqUjRlg9kc,11677
|
|
42
41
|
modusa/plugins/__init__.py,sha256=r1Bf5mnrVKRIwxboutY1iGzDy4EPQhqpk1kSW7iJj_Q,54
|
|
43
42
|
modusa/plugins/base.py,sha256=Bh_1Bja7fOymFsCgwhXDbV6ys3D8muNrPwrfDrG_G_A,2382
|
|
44
|
-
modusa/tmp.py,sha256=zPwgFVk5Oh6Rp6GUCbWJdkmwo6vYvhSqI35QVhW5xQM,3180
|
|
45
43
|
modusa/tools/__init__.py,sha256=jOFL7PJ1IztN6F7aMdrVKNMTid2yUmoSlSST-WFf0Cc,199
|
|
46
44
|
modusa/tools/audio_converter.py,sha256=415qBoPm2sBIuBSI7m1XBKm0AbmVmPydIPPr-uO8D3c,1778
|
|
47
45
|
modusa/tools/audio_loader.py,sha256=DrCzq0pdiQrUDIG-deLJGcu8EaylO5yRtwT4lr8WSf8,2166
|
|
48
46
|
modusa/tools/audio_player.py,sha256=GP04TWW4jBwQBjANkfR_cJtEy7cIhvbu8RTwnf9hD6E,2817
|
|
49
47
|
modusa/tools/base.py,sha256=C0ESJ0mIfjjRlAkRbSetNtMoOfS6IrHBjexRp3l_Mh4,1293
|
|
50
48
|
modusa/tools/math_ops.py,sha256=ZZ7U4DgqT7cOeE7_Lzi_Qq-48WYfwR9_osbZwTmE9eg,8690
|
|
51
|
-
modusa/tools/plotter.py,sha256=
|
|
49
|
+
modusa/tools/plotter.py,sha256=pmB9l_CTXnxC25fML_6M4jiBV1l645GtpZP4Ewoeo4E,10735
|
|
52
50
|
modusa/tools/youtube_downloader.py,sha256=hB_X8-7nOHXOlxg6vv3wyhBLoAsWyomrULP6_uCQL7s,1698
|
|
53
51
|
modusa/utils/.DS_Store,sha256=nLXMwF7QJNuglLI_Gk74F7vl5Dyus2Wd74Mgowijmdo,6148
|
|
54
52
|
modusa/utils/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
|
|
@@ -57,4 +55,4 @@ modusa/utils/excp.py,sha256=L9vhaGjKpv9viJYdmC9n5ndmk2GVbUBuFyZyhAQZmWY,906
|
|
|
57
55
|
modusa/utils/logger.py,sha256=K0rsnObeNKCxlNeSnVnJeRhgfmob6riB2uyU7h3dDmA,571
|
|
58
56
|
modusa/utils/np_func_cat.py,sha256=TyIFgRc6bARRMDnZxlVURO5Z0I-GWhxRONYyIv-Vwxs,1007
|
|
59
57
|
modusa/utils/plot.py,sha256=s_vNdxvKfwxEngvJPgrF1PcmxZNnNaaXPViHWjyjJ-c,5335
|
|
60
|
-
modusa-0.3.
|
|
58
|
+
modusa-0.3.22.dist-info/RECORD,,
|
modusa/main.py
DELETED
modusa/tmp.py
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#def autocorr(self) -> Self:
|
|
2
|
-
# """
|
|
3
|
-
#
|
|
4
|
-
# """
|
|
5
|
-
# raise NotImplementedError
|
|
6
|
-
# r = np.correlate(self.data, self.data, mode="full")
|
|
7
|
-
# r = r[self.data.shape[0] - 1:]
|
|
8
|
-
# r_signal = self.__class__(data=r, sr=self.sr, t0=self.t0, title=self.title + " [Autocorr]")
|
|
9
|
-
# return r_signal
|
|
10
|
-
|
|
11
|
-
# #----------------------------
|
|
12
|
-
# # To different signals
|
|
13
|
-
# #----------------------------
|
|
14
|
-
# def to_audio_signal(self) -> "AudioSignal":
|
|
15
|
-
# """
|
|
16
|
-
# Moves TimeDomainSignal to AudioSignal
|
|
17
|
-
# """
|
|
18
|
-
# raise NotImplementedError
|
|
19
|
-
# from modusa.signals.audio_signal import AudioSignal
|
|
20
|
-
#
|
|
21
|
-
# return AudioSignal(data=self.data, sr=self.sr, t0=self.t0, title=self.title)
|
|
22
|
-
#
|
|
23
|
-
# def to_spectrogram(
|
|
24
|
-
# self,
|
|
25
|
-
# n_fft: int = 2048,
|
|
26
|
-
# hop_length: int = 512,
|
|
27
|
-
# win_length: int | None = None,
|
|
28
|
-
# window: str = "hann"
|
|
29
|
-
# ) -> "Spectrogram":
|
|
30
|
-
# """
|
|
31
|
-
# Compute the Short-Time Fourier Transform (STFT) and return a Spectrogram object.
|
|
32
|
-
#
|
|
33
|
-
# Parameters
|
|
34
|
-
# ----------
|
|
35
|
-
# n_fft : int
|
|
36
|
-
# FFT size.
|
|
37
|
-
# win_length : int or None
|
|
38
|
-
# Window length. Defaults to `n_fft` if None.
|
|
39
|
-
# hop_length : int
|
|
40
|
-
# Hop length between frames.
|
|
41
|
-
# window : str
|
|
42
|
-
# Type of window function to use (e.g., 'hann', 'hamming').
|
|
43
|
-
#
|
|
44
|
-
# Returns
|
|
45
|
-
# -------
|
|
46
|
-
# Spectrogram
|
|
47
|
-
# Spectrogram object containing S (complex STFT), t (time bins), and f (frequency bins).
|
|
48
|
-
# """
|
|
49
|
-
# raise NotImplementedError
|
|
50
|
-
# import warnings
|
|
51
|
-
# warnings.filterwarnings("ignore", category=UserWarning, module="librosa.core.intervals")
|
|
52
|
-
#
|
|
53
|
-
# from modusa.signals.feature_time_domain_signal import FeatureTimeDomainSignal
|
|
54
|
-
# import librosa
|
|
55
|
-
#
|
|
56
|
-
# S = librosa.stft(self.data, n_fft=n_fft, win_length=win_length, hop_length=hop_length, window=window)
|
|
57
|
-
# f = librosa.fft_frequencies(sr=self.sr, n_fft=n_fft)
|
|
58
|
-
# t = librosa.frames_to_time(np.arange(S.shape[1]), sr=self.sr, hop_length=hop_length)
|
|
59
|
-
# frame_rate = self.sr / hop_length
|
|
60
|
-
# spec = FeatureTimeDomainSignal(data=S, feature=f, feature_label="Freq (Hz)", frame_rate=frame_rate, t0=self.t0, time_label="Time (sec)", title=self.title)
|
|
61
|
-
# if self.title != self._name: # Means title of the audio was reset so we pass that info to spec
|
|
62
|
-
# spec = spec.set_meta_info(title=self.title)
|
|
63
|
-
#
|
|
64
|
-
# return spec
|
|
65
|
-
# #=====================================
|
|
66
|
-
|
|
67
|
-
#=====================================
|
|
68
|
-
|
|
69
|
-
#--------------------------
|
|
70
|
-
# Other signal ops
|
|
71
|
-
#--------------------------
|
|
72
|
-
|
|
73
|
-
# def interpolate(self, to: TimeDomainSignal, kind: str = "linear", fill_value: str | float = "extrapolate") -> TimeDomainSignal:
|
|
74
|
-
# """
|
|
75
|
-
# Interpolate the current signal to match the time axis of `to`.
|
|
76
|
-
#
|
|
77
|
-
# Parameters:
|
|
78
|
-
# to (TimeDomainSignal): The signal whose time axis will be used.
|
|
79
|
-
# kind (str): Interpolation method ('linear', 'nearest', etc.)
|
|
80
|
-
# fill_value (str or float): Value used to fill out-of-bounds.
|
|
81
|
-
#
|
|
82
|
-
# Returns:
|
|
83
|
-
# TimeDomainSignal: A new signal with values interpolated at `to.t`.
|
|
84
|
-
# """
|
|
85
|
-
# assert self.y.ndim == 1, "Only 1D signals supported for interpolation"
|
|
86
|
-
#
|
|
87
|
-
# interpolator = interp1d(
|
|
88
|
-
# self.t,
|
|
89
|
-
# self.y,
|
|
90
|
-
# kind=kind,
|
|
91
|
-
# fill_value=fill_value,
|
|
92
|
-
# bounds_error=False,
|
|
93
|
-
# assume_sorted=True
|
|
94
|
-
# )
|
|
95
|
-
#
|
|
96
|
-
# y_interp = interpolator(to.y)
|
|
97
|
-
|
|
98
|
-
# return self.__class__(y=y_interp, sr=to.sr, t0=to.t0, title=f"{self.title} → interpolated")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|