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

Simulation time milestones #568

Merged
merged 11 commits into from
Oct 13, 2023
Merged

Simulation time milestones #568

merged 11 commits into from
Oct 13, 2023

Conversation

RemDelaporteMathurin
Copy link
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin commented Aug 22, 2023

Proposed changes

Often it is required to have the simulation hit some time milestones.
For instance, I want the simulation to simulate t=100s explicitely, not 80s, not 150s, 100s.

So far, we could use TXT exports that would modify the stepsize accordingly.
We can now do it directly in festim.Stepsize by specifying milestones.

Usage

my_model.dt = F.Stepsize(
    initial_value=15,
    milestones=[90, 100],
)

In the current implementation, the TXT export don't modify the stepsize anymore. Meaning that users must add milestones if they want to be sure to export the TXT at these specific times.

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)

@RemDelaporteMathurin RemDelaporteMathurin marked this pull request as draft August 22, 2023 18:32
@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (616d96c) 99.07% compared to head (9035525) 98.90%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #568      +/-   ##
==========================================
- Coverage   99.07%   98.90%   -0.18%     
==========================================
  Files          56       56              
  Lines        2053     2096      +43     
==========================================
+ Hits         2034     2073      +39     
- Misses         19       23       +4     
Files Coverage Δ
festim/exports/exports.py 97.72% <100.00%> (+0.05%) ⬆️
festim/exports/txt_export.py 98.03% <100.00%> (-1.97%) ⬇️
festim/generic_simulation.py 100.00% <100.00%> (ø)
festim/h_transport_problem.py 93.25% <100.00%> (ø)
festim/stepsize.py 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

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

@RemDelaporteMathurin RemDelaporteMathurin marked this pull request as ready for review October 9, 2023 01:21
@RemDelaporteMathurin RemDelaporteMathurin added this to the , , milestone Oct 9, 2023
@RemDelaporteMathurin RemDelaporteMathurin modified the milestones: , ,, v1.0 Oct 9, 2023
Copy link
Collaborator

@jhdark jhdark left a comment

Choose a reason for hiding this comment

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

This looks great to me, I know some people who've asked for this feature.

@RemDelaporteMathurin RemDelaporteMathurin merged commit 13b0959 into main Oct 13, 2023
3 of 4 checks passed
@RemDelaporteMathurin RemDelaporteMathurin deleted the timestamps branch October 13, 2023 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants