@@ -8,8 +8,12 @@ from .windows._windows import _ToWindow
8
8
9
9
__all__ = ["ShortTimeFFT" ]
10
10
11
+ ###
12
+
11
13
_InexactND : TypeAlias = onp .ArrayND [np .inexact [Any ]]
12
14
15
+ _PadType : TypeAlias = Literal ["zeros" , "edge" , "even" , "odd" ]
16
+ _FFTModeType : TypeAlias = Literal ["twosided" , "centered" , "onesided" , "onesided2X" ]
13
17
_ScaleTo : TypeAlias = Literal ["magnitude" , "psd" ]
14
18
_Detr : TypeAlias = (
15
19
Literal ["linear" , "constant" ]
@@ -19,77 +23,100 @@ _Detr: TypeAlias = (
19
23
20
24
###
21
25
22
- # awkward naming, but this matches the "attempts at type-aliases" in the implementation
23
- PAD_TYPE : TypeAlias = Literal ["zeros" , "edge" , "even" , "odd" ]
24
- FFT_MODE_TYPE : TypeAlias = Literal ["twosided" , "centered" , "onesided" , "onesided2X" ]
25
-
26
26
class ShortTimeFFT :
27
- def __init__ (
28
- self ,
29
- / ,
30
- win : _InexactND ,
31
- hop : int ,
32
- fs : float ,
33
- * ,
34
- fft_mode : FFT_MODE_TYPE = "onesided" ,
35
- mfft : int | None = None ,
36
- dual_win : _InexactND | None = None ,
37
- scale_to : _ScaleTo | None = None ,
38
- phase_shift : int | None = 0 ,
39
- ) -> None : ...
40
- @classmethod
41
- def from_dual (
42
- cls ,
43
- dual_win : _InexactND ,
44
- hop : int ,
45
- fs : float ,
46
- * ,
47
- fft_mode : FFT_MODE_TYPE = "onesided" ,
48
- mfft : int | None = None ,
49
- scale_to : _ScaleTo | None = None ,
50
- phase_shift : int | None = 0 ,
51
- ) -> Self : ...
52
- @classmethod
53
- def from_window (
54
- cls ,
55
- win_param : _ToWindow ,
56
- fs : float ,
57
- nperseg : int ,
58
- noverlap : int ,
59
- * ,
60
- symmetric_win : bool = False ,
61
- fft_mode : FFT_MODE_TYPE = "onesided" ,
62
- mfft : int | None = None ,
63
- scale_to : _ScaleTo | None = None ,
64
- phase_shift : int | None = 0 ,
65
- ) -> Self : ...
66
27
@property
67
28
def win (self , / ) -> _InexactND : ...
68
29
@property
30
+ def dual_win (self , / ) -> _InexactND : ...
31
+ @property
69
32
def hop (self , / ) -> int : ...
70
33
@property
34
+ def invertible (self , / ) -> bool : ...
35
+ @property
36
+ def fac_magnitude (self , / ) -> float : ...
37
+ @property
38
+ def fac_psd (self , / ) -> float : ...
39
+ @property
40
+ def m_num (self , / ) -> int : ...
41
+ @property
42
+ def m_num_mid (self , / ) -> int : ...
43
+ @property
44
+ def k_min (self , / ) -> int : ...
45
+ @property
46
+ def p_min (self , / ) -> int : ...
47
+ @property
48
+ def lower_border_end (self , / ) -> tuple [int , int ]: ...
49
+ @property
50
+ def delta_t (self , / ) -> float : ...
51
+ @property
52
+ def delta_f (self , / ) -> float : ...
53
+ @property
54
+ def f_pts (self , / ) -> int : ...
55
+ @property
56
+ def f (self , / ) -> _InexactND : ...
57
+ @property
58
+ def onesided_fft (self , / ) -> bool : ...
59
+
60
+ #
61
+ @property
71
62
def T (self , / ) -> float : ...
72
63
@T .setter
73
64
def T (self , / , v : float ) -> None : ...
65
+
66
+ #
74
67
@property
75
68
def fs (self , / ) -> float : ...
76
69
@fs .setter
77
70
def fs (self , / , v : float ) -> None : ...
71
+
72
+ #
78
73
@property
79
- def fft_mode (self , / ) -> FFT_MODE_TYPE : ...
74
+ def fft_mode (self , / ) -> _FFTModeType : ...
80
75
@fft_mode .setter
81
- def fft_mode (self , / , t : FFT_MODE_TYPE ) -> None : ...
76
+ def fft_mode (self , / , t : _FFTModeType ) -> None : ...
77
+
78
+ #
82
79
@property
83
80
def mfft (self , / ) -> int : ...
84
81
@mfft .setter
85
82
def mfft (self , / , n_ : int ) -> None : ...
86
- @property
87
- def scaling (self , / ) -> _ScaleTo | None : ...
88
- def scale_to (self , / , scaling : _ScaleTo ) -> None : ...
83
+
84
+ #
89
85
@property
90
86
def phase_shift (self , / ) -> int | None : ...
91
87
@phase_shift .setter
92
88
def phase_shift (self , / , v : int | None ) -> None : ...
89
+
90
+ #
91
+ @property
92
+ def scaling (self , / ) -> _ScaleTo | None : ...
93
+
94
+ #
95
+ def __init__ (
96
+ self ,
97
+ / ,
98
+ win : _InexactND ,
99
+ hop : int ,
100
+ fs : float ,
101
+ * ,
102
+ fft_mode : _FFTModeType = "onesided" ,
103
+ mfft : int | None = None ,
104
+ dual_win : _InexactND | None = None ,
105
+ scale_to : _ScaleTo | None = None ,
106
+ phase_shift : int | None = 0 ,
107
+ ) -> None : ...
108
+
109
+ #
110
+ def k_max (self , / , n : int ) -> int : ...
111
+ def p_max (self , / , n : int ) -> int : ...
112
+ def p_num (self , / , n : int ) -> int : ...
113
+ def nearest_k_p (self , / , k : int , left : bool = True ) -> int : ...
114
+ def upper_border_begin (self , / , n : int ) -> tuple [int , int ]: ...
115
+ def p_range (self , / , n : int , p0 : int | None = None , p1 : int | None = None ) -> tuple [int , int ]: ...
116
+ def t (self , / , n : int , p0 : int | None = None , p1 : int | None = None , k_offset : int = 0 ) -> _InexactND : ...
117
+ def scale_to (self , / , scaling : _ScaleTo ) -> None : ...
118
+
119
+ #
93
120
def stft (
94
121
self ,
95
122
/ ,
@@ -98,9 +125,19 @@ class ShortTimeFFT:
98
125
p1 : int | None = None ,
99
126
* ,
100
127
k_offset : int = 0 ,
101
- padding : PAD_TYPE = "zeros" ,
128
+ padding : _PadType = "zeros" ,
102
129
axis : int = - 1 ,
103
130
) -> _InexactND : ...
131
+ def istft (
132
+ self ,
133
+ / ,
134
+ S : _InexactND ,
135
+ k0 : int = 0 ,
136
+ k1 : int | None = None ,
137
+ * ,
138
+ f_axis : int = - 2 ,
139
+ t_axis : int = - 1 ,
140
+ ) -> _InexactND : ...
104
141
def stft_detrend (
105
142
self ,
106
143
/ ,
@@ -110,7 +147,7 @@ class ShortTimeFFT:
110
147
p1 : int | None = None ,
111
148
* ,
112
149
k_offset : int = 0 ,
113
- padding : PAD_TYPE = "zeros" ,
150
+ padding : _PadType = "zeros" ,
114
151
axis : int = - 1 ,
115
152
) -> _InexactND : ...
116
153
def spectrogram (
@@ -123,58 +160,41 @@ class ShortTimeFFT:
123
160
p0 : int | None = None ,
124
161
p1 : int | None = None ,
125
162
k_offset : int = 0 ,
126
- padding : PAD_TYPE = "zeros" ,
163
+ padding : _PadType = "zeros" ,
127
164
axis : int = - 1 ,
128
165
) -> _InexactND : ...
129
- @property
130
- def dual_win (self , / ) -> _InexactND : ...
131
- @property
132
- def invertible (self , / ) -> bool : ...
133
- def istft (
134
- self ,
135
- / ,
136
- S : _InexactND ,
137
- k0 : int = 0 ,
138
- k1 : int | None = None ,
139
- * ,
140
- f_axis : int = - 2 ,
141
- t_axis : int = - 1 ,
142
- ) -> _InexactND : ...
143
- @property
144
- def fac_magnitude (self , / ) -> float : ...
145
- @property
146
- def fac_psd (self , / ) -> float : ...
147
- @property
148
- def m_num (self , / ) -> int : ...
149
- @property
150
- def m_num_mid (self , / ) -> int : ...
151
- @property
152
- def k_min (self , / ) -> int : ...
153
- @property
154
- def p_min (self , / ) -> int : ...
155
- def k_max (self , / , n : int ) -> int : ...
156
- def p_max (self , / , n : int ) -> int : ...
157
- def p_num (self , / , n : int ) -> int : ...
158
- @property
159
- def lower_border_end (self , / ) -> tuple [int , int ]: ...
160
- def upper_border_begin (self , / , n : int ) -> tuple [int , int ]: ...
161
- @property
162
- def delta_t (self , / ) -> float : ...
163
- def p_range (self , / , n : int , p0 : int | None = None , p1 : int | None = None ) -> tuple [int , int ]: ...
164
- def t (self , / , n : int , p0 : int | None = None , p1 : int | None = None , k_offset : int = 0 ) -> _InexactND : ...
165
- def nearest_k_p (self , / , k : int , left : bool = True ) -> int : ...
166
- @property
167
- def delta_f (self , / ) -> float : ...
168
- @property
169
- def f_pts (self , / ) -> int : ...
170
- @property
171
- def onesided_fft (self , / ) -> bool : ...
172
- @property
173
- def f (self , / ) -> _InexactND : ...
174
166
def extent (
175
167
self ,
176
168
/ ,
177
169
n : int ,
178
170
axes_seq : Literal ["tf" , "ft" ] = "tf" ,
179
171
center_bins : bool = False ,
180
172
) -> tuple [float , float , float , float ]: ...
173
+
174
+ #
175
+ @classmethod
176
+ def from_dual (
177
+ cls ,
178
+ dual_win : _InexactND ,
179
+ hop : int ,
180
+ fs : float ,
181
+ * ,
182
+ fft_mode : _FFTModeType = "onesided" ,
183
+ mfft : int | None = None ,
184
+ scale_to : _ScaleTo | None = None ,
185
+ phase_shift : int | None = 0 ,
186
+ ) -> Self : ...
187
+ @classmethod
188
+ def from_window (
189
+ cls ,
190
+ win_param : _ToWindow ,
191
+ fs : float ,
192
+ nperseg : int ,
193
+ noverlap : int ,
194
+ * ,
195
+ symmetric_win : bool = False ,
196
+ fft_mode : _FFTModeType = "onesided" ,
197
+ mfft : int | None = None ,
198
+ scale_to : _ScaleTo | None = None ,
199
+ phase_shift : int | None = 0 ,
200
+ ) -> Self : ...
0 commit comments