Skip to content

Commit e5f1226

Browse files
authored
Merge pull request #78 from jorenham/stubtest/scipy.signal
fix `scipy.signal` stubtest
2 parents 233af53 + 829f010 commit e5f1226

24 files changed

+633
-176
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
"scipy.ndimage",
8989
"scipy.odr",
9090
"scipy.optimize",
91-
# "scipy.signal",
91+
"scipy.signal",
9292
# "scipy.sparse",
9393
"scipy.spatial",
9494
"scipy.special",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pip install scipy-stubs
9090
| `ndimage` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :full_moon: |
9191
| `odr` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :waxing_crescent_moon: |
9292
| `optimize` | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :first_quarter_moon: |
93-
| `signal` | :heavy_check_mark: | :x: | :x: | :x: | :new_moon: |
93+
| `signal` | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :waxing_crescent_moon: |
9494
| `sparse` | :heavy_check_mark: | :x: | :x: | :x: | :waxing_crescent_moon: |
9595
| `spatial` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :waxing_gibbous_moon: |
9696
| `special` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :first_quarter_moon: |

scipy-stubs/signal/__init__.pyi

Lines changed: 193 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,205 @@
11
from . import (
2-
bsplines as bsplines,
3-
filter_design as filter_design,
4-
fir_filter_design as fir_filter_design,
5-
lti_conversion as lti_conversion,
6-
ltisys as ltisys,
7-
signaltools as signaltools,
8-
spectral as spectral,
9-
spline as spline,
10-
waveforms as waveforms,
11-
wavelets as wavelets,
12-
windows as windows,
2+
bsplines,
3+
filter_design,
4+
fir_filter_design,
5+
lti_conversion,
6+
ltisys,
7+
signaltools,
8+
spectral,
9+
spline,
10+
waveforms,
11+
wavelets,
12+
windows,
1313
)
14+
from ._bsplines import *
1415
from ._czt import *
1516
from ._filter_design import *
1617
from ._fir_filter_design import *
1718
from ._lti_conversion import *
1819
from ._ltisys import *
19-
from ._max_len_seq import max_len_seq as max_len_seq
20+
from ._max_len_seq import max_len_seq
2021
from ._peak_finding import *
21-
from ._savitzky_golay import savgol_coeffs as savgol_coeffs, savgol_filter as savgol_filter
22+
from ._savitzky_golay import savgol_coeffs, savgol_filter
2223
from ._short_time_fft import *
2324
from ._signaltools import *
2425
from ._spectral_py import *
25-
from ._spline import sepfir2d as sepfir2d
26-
from ._spline_filters import *
27-
from ._upfirdn import upfirdn as upfirdn
26+
from ._spline import cspline2d, qspline2d, sepfir2d, symiirorder1, symiirorder2
27+
from ._upfirdn import upfirdn
2828
from ._waveforms import *
29-
from .windows import get_window as get_window
29+
from ._wavelets import *
30+
from .windows import get_window
31+
32+
__all__ = [
33+
"CZT",
34+
"BadCoefficients",
35+
"ShortTimeFFT",
36+
"StateSpace",
37+
"TransferFunction",
38+
"ZerosPolesGain",
39+
"ZoomFFT",
40+
"abcd_normalize",
41+
"argrelextrema",
42+
"argrelmax",
43+
"argrelmin",
44+
"band_stop_obj",
45+
"bessel",
46+
"besselap",
47+
"bilinear",
48+
"bilinear_zpk",
49+
"bode",
50+
"bsplines",
51+
"buttap",
52+
"butter",
53+
"buttord",
54+
"cascade",
55+
"cheb1ap",
56+
"cheb1ord",
57+
"cheb2ap",
58+
"cheb2ord",
59+
"cheby1",
60+
"cheby2",
61+
"check_COLA",
62+
"check_NOLA",
63+
"chirp",
64+
"choose_conv_method",
65+
"cmplx_sort",
66+
"coherence",
67+
"cont2discrete",
68+
"convolve",
69+
"convolve2d",
70+
"correlate",
71+
"correlate2d",
72+
"correlation_lags",
73+
"csd",
74+
"cspline1d",
75+
"cspline1d_eval",
76+
"cspline2d",
77+
"cwt",
78+
"czt",
79+
"czt_points",
80+
"daub",
81+
"dbode",
82+
"decimate",
83+
"deconvolve",
84+
"detrend",
85+
"dfreqresp",
86+
"dimpulse",
87+
"dlsim",
88+
"dlti",
89+
"dstep",
90+
"ellip",
91+
"ellipap",
92+
"ellipord",
93+
"fftconvolve",
94+
"filter_design",
95+
"filtfilt",
96+
"find_peaks",
97+
"find_peaks_cwt",
98+
"findfreqs",
99+
"fir_filter_design",
100+
"firls",
101+
"firwin",
102+
"firwin2",
103+
"freqresp",
104+
"freqs",
105+
"freqs_zpk",
106+
"freqz",
107+
"freqz_zpk",
108+
"gammatone",
109+
"gauss_spline",
110+
"gausspulse",
111+
"get_window",
112+
"group_delay",
113+
"hilbert",
114+
"hilbert2",
115+
"iircomb",
116+
"iirdesign",
117+
"iirfilter",
118+
"iirnotch",
119+
"iirpeak",
120+
"impulse",
121+
"invres",
122+
"invresz",
123+
"istft",
124+
"kaiser_atten",
125+
"kaiser_beta",
126+
"kaiserord",
127+
"lfilter",
128+
"lfilter_zi",
129+
"lfiltic",
130+
"lombscargle",
131+
"lp2bp",
132+
"lp2bp_zpk",
133+
"lp2bs",
134+
"lp2bs_zpk",
135+
"lp2hp",
136+
"lp2hp_zpk",
137+
"lp2lp",
138+
"lp2lp_zpk",
139+
"lsim",
140+
"lti",
141+
"lti_conversion",
142+
"ltisys",
143+
"max_len_seq",
144+
"medfilt",
145+
"medfilt2d",
146+
"minimum_phase",
147+
"morlet",
148+
"morlet2",
149+
"normalize",
150+
"oaconvolve",
151+
"order_filter",
152+
"peak_prominences",
153+
"peak_widths",
154+
"periodogram",
155+
"place_poles",
156+
"qmf",
157+
"qspline1d",
158+
"qspline1d_eval",
159+
"qspline2d",
160+
"remez",
161+
"resample",
162+
"resample_poly",
163+
"residue",
164+
"residuez",
165+
"ricker",
166+
"savgol_coeffs",
167+
"savgol_filter",
168+
"sawtooth",
169+
"sepfir2d",
170+
"signaltools",
171+
"sos2tf",
172+
"sos2zpk",
173+
"sosfilt",
174+
"sosfilt_zi",
175+
"sosfiltfilt",
176+
"sosfreqz",
177+
"spectral",
178+
"spectrogram",
179+
"spline",
180+
"spline_filter",
181+
"square",
182+
"ss2tf",
183+
"ss2zpk",
184+
"step",
185+
"stft",
186+
"sweep_poly",
187+
"symiirorder1",
188+
"symiirorder2",
189+
"tf2sos",
190+
"tf2ss",
191+
"tf2zpk",
192+
"unique_roots",
193+
"unit_impulse",
194+
"upfirdn",
195+
"vectorstrength",
196+
"waveforms",
197+
"wavelets",
198+
"welch",
199+
"wiener",
200+
"windows",
201+
"zoom_fft",
202+
"zpk2sos",
203+
"zpk2ss",
204+
"zpk2tf",
205+
]

scipy-stubs/signal/_arraytools.pyi

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
from scipy._typing import Untyped
1+
from typing import TypeVar
2+
3+
import numpy as np
4+
import numpy.typing as npt
5+
import optype as op
6+
from scipy._typing import AnyInt
7+
8+
_SCT = TypeVar("_SCT", bound=np.generic)
29

310
def axis_slice(
4-
a, start: Untyped | None = None, stop: Untyped | None = None, step: Untyped | None = None, axis: int = -1
5-
) -> Untyped: ...
6-
def axis_reverse(a, axis: int = -1) -> Untyped: ...
7-
def odd_ext(x, n, axis: int = -1) -> Untyped: ...
8-
def even_ext(x, n, axis: int = -1) -> Untyped: ...
9-
def const_ext(x, n, axis: int = -1) -> Untyped: ...
10-
def zero_ext(x, n, axis: int = -1) -> Untyped: ...
11+
a: npt.NDArray[_SCT],
12+
start: op.CanIndex | None = None,
13+
stop: op.CanIndex | None = None,
14+
step: op.CanIndex | None = None,
15+
axis: op.CanIndex = -1,
16+
) -> npt.NDArray[_SCT]: ...
17+
def axis_reverse(a: npt.NDArray[_SCT], axis: op.CanIndex = -1) -> npt.NDArray[_SCT]: ...
18+
def odd_ext(x: npt.NDArray[_SCT], n: AnyInt, axis: op.CanIndex = -1) -> npt.NDArray[_SCT]: ...
19+
def even_ext(x: npt.NDArray[_SCT], n: AnyInt, axis: op.CanIndex = -1) -> npt.NDArray[_SCT]: ...
20+
def const_ext(x: npt.NDArray[_SCT], n: AnyInt, axis: op.CanIndex = -1) -> npt.NDArray[_SCT]: ...
21+
def zero_ext(x: npt.NDArray[_SCT], n: AnyInt, axis: op.CanIndex = -1) -> npt.NDArray[_SCT]: ...

scipy-stubs/signal/_bsplines.pyi

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from typing import Any, overload
2+
from typing_extensions import TypeVar
3+
4+
import numpy as np
5+
import numpy.typing as npt
6+
from numpy._typing import _ArrayLike, _ArrayLikeComplex_co, _ArrayLikeFloat_co, _ArrayLikeInt_co
7+
from scipy._typing import AnyInt, AnyReal
8+
9+
__all__ = ["cspline1d", "cspline1d_eval", "gauss_spline", "qspline1d", "qspline1d_eval", "spline_filter"]
10+
11+
_SCT_fc = TypeVar("_SCT_fc", np.float64, np.float32, np.complex128, np.complex64)
12+
13+
@overload
14+
def gauss_spline(x: _ArrayLikeInt_co, n: AnyInt) -> npt.NDArray[np.float64]: ...
15+
@overload
16+
def gauss_spline(x: _ArrayLike[_SCT_fc], n: AnyInt) -> npt.NDArray[_SCT_fc]: ...
17+
@overload
18+
def gauss_spline(x: _ArrayLikeFloat_co, n: AnyInt) -> npt.NDArray[np.floating[Any]]: ...
19+
@overload
20+
def gauss_spline(x: _ArrayLikeComplex_co, n: AnyInt) -> npt.NDArray[np.inexact[Any]]: ...
21+
def spline_filter(Iin: _ArrayLike[_SCT_fc], lmbda: AnyReal = 5.0) -> npt.NDArray[_SCT_fc]: ...
22+
def cspline1d(signal: npt.NDArray[_SCT_fc], lamb: AnyReal = 0.0) -> npt.NDArray[_SCT_fc]: ...
23+
def qspline1d(signal: npt.NDArray[_SCT_fc], lamb: AnyReal = 0.0) -> npt.NDArray[_SCT_fc]: ...
24+
def cspline1d_eval(
25+
cj: npt.NDArray[_SCT_fc],
26+
newx: _ArrayLikeFloat_co,
27+
dx: AnyReal = 1.0,
28+
x0: AnyInt = 0,
29+
) -> npt.NDArray[_SCT_fc]: ...
30+
def qspline1d_eval(
31+
cj: npt.NDArray[_SCT_fc],
32+
newx: _ArrayLikeFloat_co,
33+
dx: AnyReal = 1.0,
34+
x0: AnyInt = 0,
35+
) -> npt.NDArray[_SCT_fc]: ...

scipy-stubs/signal/_czt.pyi

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,53 @@
1-
from scipy._typing import Untyped
2-
from scipy.fft import fft as fft, ifft as ifft, next_fast_len as next_fast_len
1+
from collections.abc import Sequence
32

4-
def czt_points(m, w: Untyped | None = None, a: complex = ...) -> Untyped: ...
3+
import numpy as np
4+
import numpy.typing as npt
5+
from numpy._typing import _ArrayLikeComplex_co
6+
from scipy._typing import AnyComplex, AnyReal
7+
8+
__all__ = ["CZT", "ZoomFFT", "czt", "czt_points", "zoom_fft"]
59

610
class CZT:
7-
def __init__(self, n, m: Untyped | None = None, w: Untyped | None = None, a: complex = ...): ...
8-
def __call__(self, x, *, axis: int = -1) -> Untyped: ...
9-
def points(self) -> Untyped: ...
11+
def __init__(self, n: int, m: int | None = None, w: AnyComplex | None = None, a: AnyComplex = 1 + 0j) -> None: ...
12+
def __call__(self, x: _ArrayLikeComplex_co, *, axis: int = -1) -> npt.NDArray[np.complex128 | np.complex64]: ...
13+
def points(self) -> npt.NDArray[np.complex128 | np.complex64]: ...
1014

1115
class ZoomFFT(CZT):
12-
w: Untyped
13-
a: Untyped
14-
def __init__(self, n, fn, m: Untyped | None = None, *, fs: int = 2, endpoint: bool = False): ...
16+
w: complex
17+
a: complex
18+
19+
m: int
20+
n: int
21+
22+
f1: AnyReal
23+
f2: AnyReal
24+
fs: AnyReal
25+
26+
def __init__(
27+
self,
28+
n: int,
29+
fn: Sequence[AnyReal] | AnyReal,
30+
m: int | None = None,
31+
*,
32+
fs: AnyReal = 2,
33+
endpoint: bool = False,
34+
) -> None: ...
1535

16-
def czt(x, m: Untyped | None = None, w: Untyped | None = None, a: complex = ..., *, axis: int = -1) -> Untyped: ...
17-
def zoom_fft(x, fn, m: Untyped | None = None, *, fs: int = 2, endpoint: bool = False, axis: int = -1) -> Untyped: ...
36+
def czt_points(m: int, w: AnyComplex | None = None, a: AnyComplex = ...) -> npt.NDArray[np.complex128 | np.complex64]: ...
37+
def czt(
38+
x: _ArrayLikeComplex_co,
39+
m: int | None = None,
40+
w: AnyComplex | None = None,
41+
a: AnyComplex = 1 + 0j,
42+
*,
43+
axis: int = -1,
44+
) -> npt.NDArray[np.complex128 | np.complex64]: ...
45+
def zoom_fft(
46+
x: _ArrayLikeComplex_co,
47+
fn: Sequence[AnyReal] | AnyReal,
48+
m: int | None = None,
49+
*,
50+
fs: int = 2,
51+
endpoint: bool = False,
52+
axis: int = -1,
53+
) -> npt.NDArray[np.float64 | np.float32 | np.complex128 | np.complex64]: ...

0 commit comments

Comments
 (0)