Deprecate object and longdouble arrays in scipy.signal.{correlate,convolve,lfilter}

Hi,

In the scipy 1.11-1.13 timeframe, we removed the support for object arrays and longdoubles from scipy.signal.medfilt [1, 2, 3]. So far this did not seem to have caused any user issues.

There is other usage of object arrays in scipy.signal: scipy.signal.correlate and scipy.signal.lfilter have special code paths for object arrays. If the test suite is any guide, the intended use case is lfilter-ing arrays of Decimal objects.

[1] Mailman 3 [SciPy-Dev] Possibly reduce duplication between `signal` and `ndimage` filtering routines - SciPy-Dev - python.org

[2] DEP: signal: deprecate using medfilt and order_filter with float128 and object dtypes by ev-br · Pull Request #18341 · scipy/scipy · GitHub

[3] https://github.com/scipy/scipy/pull/19673
Following up on the discussion at [#20772 (comment)]

The intended use cases were, judging by tests, dealing with arrays of Decimals. The relevant C code has been there “forever” (since when multipack was a thing), and is very likely buggy since then (cf this comment scipy/scipy/signal/_lfilter.c.in at main · scipy/scipy · GitHub).

Here is a proposal to deprecate and later remove support for non-numeric arrays from both correlate/convolve and lfilter: DEP: signal.{correlate,convolve,lfilter}: deprecate object arrays and longdoubles by ev-br · Pull Request #21211 · scipy/scipy · GitHub

This PR is currently also removes float16 support. This might be a bit on a too-wide-sweep side, and I’m happy to roll it back. OTOH, the “support” currently seems to be just upcasting to wider float types, so this deprecation might be okay, too.

If you’re using this functionality, please do let us know! So far this seems to be not used at all.

Cheers,

Evgeni

1 Like

+1 from me! (post must be at least 20 chars)

I’m not, but could it be useful for fixed-point signal processing emulation/simulations?

Potentially, sure. Do we know if somebody actually does?
And they do, is there a benefit in using object arrays in place of just lists?

1 Like