8000 ENH: `integrate.solve_ivp`: add option to gracefully handle exceptions by arichar6 · Pull Request #21008 · scipy/scipy · GitHub
[go: up one dir, main page]

Skip to content

ENH: integrate.solve_ivp: add option to gracefully handle exceptions #21008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

arichar6
Copy link
Contributor

Reference issue

None

What does this implement/fix?

This code allows the solve_ivp function catch any exceptions that might be thrown during the call to solver.step(). This is useful for the case where the function that calculates the RHS of the ODE runs into some issue and raises and exception. Rather than just failing entirely (and losing the solution up to the point of failure), the code stops the integration, and returns the solution up until the time that the exception was raised.

Additional information

The default behavior of solve_ivp is unchanged. In order to use the new exception-catching behavior, the user must pass the new optional parameter catch_exceptions=True when they call solve_ivp.

@arichar6 arichar6 requested a review from steppi as a code owner June 20, 2024 18:54
@lucascolley lucascolley added the enhancement A new feature or improvement label Jun 20, 2024
@lucascolley lucascolley changed the title Modify solve_ivp to gracefully handle exceptions ENH: integrate.solve_ivp: add option to gracefully handle exceptions Jun 20, 2024
@arichar6 arichar6 requested a review from nmayorov August 30, 2024 14:49
@arichar6 arichar6 requested a review from tylerjereddy October 30, 2024 13:41
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.

Thanks @arichar6 I think this would also require a test to show this new option functions correctly

Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.integrate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0