1
- from typing import Any , Literal , overload
1
+ from typing import Any , Literal , TypeAlias , overload
2
2
3
3
import numpy as np
4
4
import optype .numpy as onp
5
- from scipy ._typing import Untyped , UntypedArray
5
+ from scipy ._typing import CorrelateMode , Untyped , UntypedArray
6
+ from ._ltisys import dlti
6
7
7
8
__all__ = [
8
9
"choose_conv_method" ,
@@ -40,72 +41,140 @@ __all__ = [
40
41
"wiener" ,
41
42
]
42
43
43
- def correlate (in1 : Untyped , in2 : Untyped , mode : str = "full" , method : str = "auto" ) -> Untyped : ...
44
- def correlation_lags (in1_len : Untyped , in2_len : Untyped , mode : str = "full" ) -> Untyped : ...
45
- def fftconvolve (in1 : Untyped , in2 : Untyped , mode : str = "full" , axes : Untyped | None = None ) -> Untyped : ...
46
- def oaconvolve (in1 : Untyped , in2 : Untyped , mode : str = "full" , axes : Untyped | None = None ) -> Untyped : ...
47
- def choose_conv_method (in1 : Untyped , in2 : Untyped , mode : str = "full" , measure : bool = False ) -> Untyped : ...
48
- def convolve (in1 : Untyped , in2 : Untyped , mode : str = "full" , method : str = "auto" ) -> Untyped : ...
44
+ _CorrelateMethod : TypeAlias = Literal ["auto" , "direct" , "fft" ]
45
+ _BoundaryConditions : TypeAlias = Literal ["fill" , "wrap" , "symm" ]
46
+ _ResidueType : TypeAlias = Literal ["avg" , "min" , "max" ]
47
+ _RootType : TypeAlias = Literal [_ResidueType , "maximum" , "avg" , "mean" ]
48
+ _Domain : TypeAlias = Literal ["time" , "freq" ]
49
+ _TrendType : TypeAlias = Literal ["linear" , "constant" ]
50
+ _PadType : TypeAlias = Literal ["constant" , "line" , "mean" , "median" , "maximum" , "minimum" , "symmetric" , "reflect" , "edge" , "wrap" ]
51
+ _FiltFiltPadType : TypeAlias = Literal ["odd" , "even" , "constant" ]
52
+ _ResidualKind : TypeAlias = Literal ["lowpass" , "all" ]
53
+ _FilterType : TypeAlias = Literal ["iir" , "fir" ] | dlti
54
+
55
+ ###
56
+
57
+ # TODO(jorenham): deprecate `longdouble` and `object_` input
58
+ def choose_conv_method (in1 : Untyped , in2 : Untyped , mode : CorrelateMode = "full" , measure : bool = False ) -> Untyped : ...
59
+ def correlate (in1 : Untyped , in2 : Untyped , mode : CorrelateMode = "full" , method : _CorrelateMethod = "auto" ) -> Untyped : ...
60
+ def convolve (in1 : Untyped , in2 : Untyped , mode : CorrelateMode = "full" , method : _CorrelateMethod = "auto" ) -> Untyped : ...
61
+ def lfilter (b : Untyped , a : Untyped , x : Untyped , axis : int = - 1 , zi : Untyped | None = None ) -> Untyped : ...
62
+ def sosfilt (sos : Untyped , x : Untyped , axis : int = - 1 , zi : Untyped | None = None ) -> Untyped : ...
63
+
64
+ #
65
+ def correlation_lags (in1_len : Untyped , in2_len : Untyped , mode : CorrelateMode = "full" ) -> Untyped : ...
66
+ def fftconvolve (in1 : Untyped , in2 : Untyped , mode : CorrelateMode = "full" , axes : Untyped | None = None ) -> Untyped : ...
67
+ def oaconvolve (in1 : Untyped , in2 : Untyped , mode : CorrelateMode = "full" , axes : Untyped | None = None ) -> Untyped : ...
68
+
69
+ #
49
70
def order_filter (a : Untyped , domain : Untyped , rank : Untyped ) -> Untyped : ...
71
+
72
+ #
50
73
def medfilt (volume : Untyped , kernel_size : Untyped | None = None ) -> Untyped : ...
51
- def wiener (im : Untyped , mysize : Untyped | None = None , noise : Untyped | None = None ) -> Untyped : ...
52
- def convolve2d (in1 : Untyped , in2 : Untyped , mode : str = "full" , boundary : str = "fill" , fillvalue : int = 0 ) -> Untyped : ...
53
- def correlate2d (in1 : Untyped , in2 : Untyped , mode : str = "full" , boundary : str = "fill" , fillvalue : int = 0 ) -> Untyped : ...
54
74
def medfilt2d (input : Untyped , kernel_size : int = 3 ) -> Untyped : ...
55
- def lfilter (b : Untyped , a : Untyped , x : Untyped , axis : int = - 1 , zi : Untyped | None = None ) -> Untyped : ...
75
+
76
+ #
77
+ def wiener (im : Untyped , mysize : Untyped | None = None , noise : Untyped | None = None ) -> Untyped : ...
78
+
79
+ #
80
+ def convolve2d (
81
+ in1 : Untyped ,
82
+ in2 : Untyped ,
83
+ mode : CorrelateMode = "full" ,
84
+ boundary : _BoundaryConditions = "fill" ,
85
+ fillvalue : onp .ToComplex = 0 ,
86
+ ) -> Untyped : ...
87
+ def correlate2d (
88
+ in1 : Untyped ,
89
+ in2 : Untyped ,
90
+ mode : CorrelateMode = "full" ,
91
+ boundary : _BoundaryConditions = "fill" ,
92
+ fillvalue : onp .ToComplex = 0 ,
93
+ ) -> Untyped : ...
94
+
95
+ #
56
96
def lfiltic (b : Untyped , a : Untyped , y : Untyped , x : Untyped | None = None ) -> Untyped : ...
97
+
98
+ #
57
99
def deconvolve (signal : Untyped , divisor : Untyped ) -> Untyped : ...
100
+
101
+ #
58
102
def hilbert (x : Untyped , N : Untyped | None = None , axis : int = - 1 ) -> Untyped : ...
59
103
def hilbert2 (x : Untyped , N : Untyped | None = None ) -> Untyped : ...
60
- def unique_roots (p : Untyped , tol : float = 0.001 , rtype : str = "min" ) -> Untyped : ...
61
- def invres (r : Untyped , p : Untyped , k : Untyped , tol : float = 0.001 , rtype : str = "avg" ) -> Untyped : ...
62
- def residue (b : Untyped , a : Untyped , tol : float = 0.001 , rtype : str = "avg" ) -> Untyped : ...
63
- def residuez (b : Untyped , a : Untyped , tol : float = 0.001 , rtype : str = "avg" ) -> Untyped : ...
64
- def invresz (r : Untyped , p : Untyped , k : Untyped , tol : float = 0.001 , rtype : str = "avg" ) -> Untyped : ...
104
+
105
+ #
106
+ def unique_roots (p : Untyped , tol : float = 0.001 , rtype : _RootType = "min" ) -> Untyped : ...
107
+
108
+ #
109
+ def residue (b : Untyped , a : Untyped , tol : float = 0.001 , rtype : _ResidueType = "avg" ) -> Untyped : ...
110
+ def residuez (b : Untyped , a : Untyped , tol : float = 0.001 , rtype : _ResidueType = "avg" ) -> Untyped : ...
111
+
112
+ #
113
+ def invres (r : Untyped , p : Untyped , k : Untyped , tol : float = 0.001 , rtype : _ResidueType = "avg" ) -> Untyped : ...
114
+ def invresz (r : Untyped , p : Untyped , k : Untyped , tol : float = 0.001 , rtype : _ResidueType = "avg" ) -> Untyped : ...
115
+
116
+ #
65
117
def resample (
66
118
x : Untyped ,
67
119
num : Untyped ,
68
120
t : Untyped | None = None ,
69
121
axis : int = 0 ,
70
122
window : Untyped | None = None ,
71
- domain : str = "time" ,
123
+ domain : _Domain = "time" ,
72
124
) -> Untyped : ...
73
125
def resample_poly (
74
126
x : Untyped ,
75
127
up : Untyped ,
76
128
down : Untyped ,
77
129
axis : int = 0 ,
78
130
window : Untyped = ("kaiser" , 5.0 ),
79
- padtype : str = "constant" ,
131
+ padtype : _PadType = "constant" ,
80
132
cval : Untyped | None = None ,
81
133
) -> Untyped : ...
134
+
135
+ #
82
136
def vectorstrength (events : Untyped , period : Untyped ) -> Untyped : ...
137
+
138
+ #
83
139
def detrend (
84
140
data : UntypedArray ,
85
141
axis : int = - 1 ,
86
- type : Literal [ "linear" , "constant" ] = "linear" ,
142
+ type : _TrendType = "linear" ,
87
143
bp : onp .ToJustInt | onp .ToJustIntND = 0 ,
88
144
overwrite_data : bool = False ,
89
145
) -> UntypedArray : ...
146
+
147
+ #
90
148
def lfilter_zi (b : Untyped , a : Untyped ) -> Untyped : ...
91
149
def sosfilt_zi (sos : Untyped ) -> Untyped : ...
150
+
151
+ #
92
152
def filtfilt (
93
153
b : Untyped ,
94
154
a : Untyped ,
95
155
x : Untyped ,
96
156
axis : int = - 1 ,
97
- padtype : str = "odd" ,
98
- padlen : Untyped | None = None ,
99
- method : str = "pad" ,
100
- irlen : Untyped | None = None ,
157
+ padtype : _FiltFiltPadType = "odd" ,
158
+ padlen : int | None = None ,
159
+ method : Literal [ "pad" , "gust" ] = "pad" ,
160
+ irlen : int | None = None ,
101
161
) -> Untyped : ...
102
- def sosfilt (sos : Untyped , x : Untyped , axis : int = - 1 , zi : Untyped | None = None ) -> Untyped : ...
103
- def sosfiltfilt (sos : Untyped , x : Untyped , axis : int = - 1 , padtype : str = "odd" , padlen : Untyped | None = None ) -> Untyped : ...
162
+
163
+ #
164
+ def sosfiltfilt (
165
+ sos : Untyped ,
166
+ x : Untyped ,
167
+ axis : int = - 1 ,
168
+ padtype : _FiltFiltPadType = "odd" ,
169
+ padlen : int | None = None ,
170
+ ) -> Untyped : ...
171
+
172
+ #
104
173
def decimate (
105
174
x : Untyped ,
106
- q : Untyped ,
107
- n : Untyped | None = None ,
108
- ftype : str = "iir" ,
175
+ q : int ,
176
+ n : int | None = None ,
177
+ ftype : _FilterType = "iir" ,
109
178
axis : int = - 1 ,
110
179
zero_phase : bool = True ,
111
180
) -> Untyped : ...
@@ -119,7 +188,7 @@ def envelope(
119
188
* ,
120
189
n_out : int | None = None ,
121
190
squared : bool = False ,
122
- residual : Literal [ "lowpass" , "all" ] | None = "lowpass" ,
191
+ residual : _ResidualKind | None = "lowpass" ,
123
192
axis : int = - 1 ,
124
193
) -> onp .ArrayND [np .floating [Any ]]: ...
125
194
@overload
@@ -129,6 +198,6 @@ def envelope(
129
198
* ,
130
199
n_out : int | None = None ,
131
200
squared : bool = False ,
132
- residual : Literal [ "lowpass" , "all" ] | None = "lowpass" ,
201
+ residual : _ResidualKind | None = "lowpass" ,
133
202
axis : int = - 1 ,
134
203
) -> onp .ArrayND [np .inexact [Any ]]: ...
0 commit comments