scipy/scipy-stubs

`scipy.signal.find_peaks` returned dictionary type is missing the `'widths'` key

Closed this issue ยท 3 comments

The key is added here https://github.com/scipy/scipy/blob/main/scipy/signal/_peak_finding.py#L1000 when width is given as an input argument, but missing in the TypedDict here https://github.com/jorenham/scipy-stubs/blob/master/scipy-stubs/signal/_peak_finding.pyi#L24

Note that the key is also missing in the docstring in scipy. I submitted scipy/scipy#21800 to fix that.

Good catch! It's a 1-d array of float64 right?

Good catch! It's a 1-d array of float64 right?

Yes, The return type is defined in _peak_finding_utils.pyx
as np.float64_t[::1] widths I am not a cython export but that looks like a 1d array of float64

If it's the same syntax as numba uses, then the [::1] bit indeed indicates that it's 1-d (and contiguous, if I remember correctly) ๐Ÿ‘๐Ÿป