Skip to content

Conversation

ev-br
Copy link
Member

@ev-br ev-br commented Jul 18, 2024

Following up on the discussion at #20772 (comment), here is proposal to deprecate using object arrays and longdoubles in scipy.signal.{correlate,convolve,lfilter}.

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 https://github.com/scipy/scipy/blob/main/scipy/signal/_lfilter.c.in#L679).

Whether these are used in the wild is a tough question to answer. A gut feeling is "not much", and as a data point, we had no complaints when we recently (in the 1.11-1.14 timeframe) removed object and longdouble support in medfilt (#19673 and #18341). So most likely, it won't be a large loss if these are gone.

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.

@ev-br ev-br requested review from larsoner and ilayn as code owners July 18, 2024 15:20
@ev-br ev-br force-pushed the deprecate_objects_in_sigtools branch from c78d938 to 096a563 Compare July 18, 2024 15:21
Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to deprecate but could you post to the dev forum about this

@lucascolley lucascolley changed the title deprecate objects arrays and longdoubles in scipy.signal.{correlate,convolve,lfilter} DEP: signal.{correlate,convolve,lfilter}: deprecate objects arrays and longdoubles Jul 18, 2024
@lucascolley lucascolley changed the title DEP: signal.{correlate,convolve,lfilter}: deprecate objects arrays and longdoubles DEP: signal.{correlate,convolve,lfilter}: deprecate object arrays and longdoubles Jul 18, 2024
@lucascolley lucascolley added the deprecated Items related to behavior that has been deprecated label Jul 18, 2024
@ev-br
Copy link
Member Author

ev-br commented Jul 19, 2024

@ilayn
Copy link
Member

ilayn commented Jul 19, 2024

+1 from me too.

@ev-br ev-br force-pushed the deprecate_objects_in_sigtools branch from 5be85f0 to 69bebc4 Compare July 19, 2024 09:46
@lucascolley lucascolley added the needs-release-note a maintainer should add a release note written by a reviewer/author to the wiki label Jul 22, 2024
@lucascolley lucascolley removed request for ilayn and larsoner July 28, 2024 16:43
@lucascolley
Copy link
Member

I updated the error message to point users to the usable dtypes and added some tests for the deprecation warning (for float16 at least).

@rgommers
Copy link
Member

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.

float16 input does yield float16 output, so I'd say this is useful in principle - no need to deprecate I think? It's handy to have the upcasting internally and then downcast the result; better than having the user do it. Unlike object and longdouble, there is no real support burden for float16.

ev-br and others added 6 commits August 15, 2024 15:46
... of objects & longdoubles from correlate/convolve and lfilter.

Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
[skip cirrus]
@ev-br ev-br force-pushed the deprecate_objects_in_sigtools branch from 9543198 to 424e405 Compare August 15, 2024 13:01
@ev-br
Copy link
Member Author

ev-br commented Aug 15, 2024

OK, rolled back the float16 deprecation. With the ML (== discourse) thread silent for a month, I think we can land this one unless there are further comments.

Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after these changes!

Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! will merge if CI is green

@lucascolley lucascolley mentioned this pull request Aug 17, 2024
32 tasks
@lucascolley lucascolley merged commit bd23939 into scipy:main Aug 17, 2024
36 of 39 checks passed
anushkasuyal pushed a commit to anushkasuyal/scipy that referenced this pull request Sep 13, 2024
… longdoubles (scipy#21211)


Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
ev-br added a commit to ev-br/scipy that referenced this pull request Oct 14, 2024
This is a follow-up to scipygh-21211: we deprecated object arrays
as inputs to `lfilter`, but forgot or did not know about `sosfilt`.
These two should probably be in sync, hence follow the lfilter
deprecation in sosfilt.
@lucascolley lucascolley removed the needs-release-note a maintainer should add a release note written by a reviewer/author to the wiki label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated Items related to behavior that has been deprecated scipy.signal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants