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

Fix timestep bug #922

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/festim/stepsize.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def modify_value(self, value, nb_iterations, t=None):
if updated_value > time_to_milestone and not np.isclose(
t, next_milestone, atol=0
):
updated_value = next_milestone
updated_value = time_to_milestone

return updated_value

Expand Down
4 changes: 2 additions & 2 deletions test/test_stepsize.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_overshoot_milestone(nb_its=1, target=4):
"""

my_stepsize = F.Stepsize(initial_value=0.1)
my_stepsize.growth_factor = 2.0
my_stepsize.growth_factor = 5.0
my_stepsize.target_nb_iterations = target

my_stepsize.milestones = [1.3]
Expand All @@ -185,7 +185,7 @@ def test_overshoot_milestone(nb_its=1, target=4):
value=current_value, nb_iterations=nb_its, t=0.9
)

expected_value = 1.3
expected_value = 1.3 - current_value
RemDelaporteMathurin marked this conversation as resolved.
Show resolved Hide resolved

assert new_value == expected_value

Expand Down
Loading