-
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
Use rounding for treatments #225
Open
wenzeslaus
wants to merge
10
commits into
main
Choose a base branch
from
round-treatments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of floor or ceil, always round to the nearest integer value as soon as the floating point calculation is finished. This changes results in r.pops.spread and presumably in rpops, too.
…use treatment of infected is based on mortality groups
This causes some, but not much changes in r.pops.spread test results:
|
Two tests with mortality in r.pops.spread fail: def test_outputs_mortality_treatment(self):
"""Check mortality together with treatment"""
# ...
def test_outputs_mortality_pesticide_treatment(self):
"""Check mortality together with pesticide treatment (all_infected_in_cell)"""
# ... The other two treatment tests without mortality pass even with this change: def test_sei_treatments_removal_ratio_to_all(self):
"""Check outputs with SEI and treatment_length == 0"""
# ...
def test_sei_treatments_pesticide_ratio_to_all(self):
"""Check outputs with SEI and treatment_length != 0 (pesticide)"""
# ... |
…quires using mortality groups in calculations. Specifically, treatments use mortality groups directly to consistently apply the treatment function. When mortality is not active, we still need to behave the same, so we now consider all infected to be a part of one mortality group when asked for it. This allows treatments to use mortality groups to get infected even when mortality is disabled. The functions in host pool which accept mortality groups for a cell as an input are now ignoring mortality groups when mortality is not active (before they were relying on input mortality vector being empty). Alternative implementation, or just possible improvement in addtion to this new API, would be to allow treatments to pass a function to reduce the different values, but treatments uses different functions for different pools, so that would require at least two functions passed which is possible, but may be hard to read.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaced flooring by rounding in all treatments.