-
Notifications
You must be signed in to change notification settings - Fork 2
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
Convert duplicated code into helper functions #199
Conversation
dea8411
to
61d0e35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff. Also
> cyclocomp::cyclocomp(simulate_chains )
[1] 15
so can switch the lintr on again.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #199 +/- ##
==========================================
+ Coverage 98.90% 98.94% +0.04%
==========================================
Files 8 8
Lines 550 571 +21
==========================================
+ Hits 544 565 +21
Misses 6 6 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good. Just one last comment.
Co-authored-by: Sebastian Funk <[email protected]>
Co-authored-by: Sebastian Funk <[email protected]>
ac0717b
to
62df189
Compare
It refactors
simulate_chains()
,simulate_summary()
, andlikelihood()
to remove duplicated code by converting them into internal helper functions follows:.init_susc_pop()
,.sample_possible_offspring()
, and.get_susceptible_offspring()
..check_sim_args()
, which checks the shared arguments of thesimulate_* ()
functions, and 2 smaller functions,.check_statistic_args()
which checksstat_max
andstatistic
together in multiple functions, and.check_time_args()
, which checks the time-related arguments:generation_time
,t0
, andtf
.Tests and documentation, where necessary, have been added.
This is a refactoring exercise and leads to no user-facing behaviour change.
What is the new behaviour (if this is a feature change)?
This is a refactoring exercise and leads to no user-facing behaviour change.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No.
chain_sim()
#44.