Skip to content
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

max_stepsize attribute for festim.Stepsize #698

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

KulaginVladimir
Copy link
Collaborator

@KulaginVladimir KulaginVladimir commented Feb 10, 2024

Proposed changes

As discussed in #507, this PR introduces max_stepsize attribute for festim.Stepsize instead of t_stop and stepsize_stop_max. The old parameters are left unchanged, but a DeprecationWarning is added. With this change, the basic usage now becomes:

my_stepsize = F.Stepsize(
    initial_value=0.5,
    stepsize_change_ratio=1.1,
    max_stepsize=lambda t: None if t < 1 else 2,
    dt_min=1e-05,
)

Types of changes

What types of changes does your code introduce to FESTIM?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

  • Black formatted
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Copy link

codecov bot commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (49d18e8) 99.47% compared to head (cd9945d) 99.47%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #698   +/-   ##
=======================================
  Coverage   99.47%   99.47%           
=======================================
  Files          58       58           
  Lines        2280     2284    +4     
=======================================
+ Hits         2268     2272    +4     
  Misses         12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

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

Hi @KulaginVladimir thanks for this!

I made a few comments + refactoring idea. Tell me what you think!

docs/source/userguide/stepsize.rst Outdated Show resolved Hide resolved
festim/stepsize.py Show resolved Hide resolved
test/unit/test_stepsize.py Outdated Show resolved Hide resolved
test/unit/test_stepsize.py Outdated Show resolved Hide resolved
test/unit/test_stepsize.py Outdated Show resolved Hide resolved
test/unit/test_stepsize.py Outdated Show resolved Hide resolved
@RemDelaporteMathurin RemDelaporteMathurin added the enhancement New feature or request label Feb 12, 2024
@RemDelaporteMathurin RemDelaporteMathurin linked an issue Feb 12, 2024 that may be closed by this pull request
Copy link
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

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

just a small comment for code readability

festim/stepsize.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @KulaginVladimir

As usual, I'll leave the PR open a little while longer to give everyone the chance to jump in

@RemDelaporteMathurin RemDelaporteMathurin merged commit 211b0e8 into festim-dev:main Feb 13, 2024
5 checks passed
@KulaginVladimir KulaginVladimir deleted the Stepsize branch February 27, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stepsize should have a adapt_when argument
2 participants