-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adding non-predation mortality and semelparity to the Animal Module. #422
Conversation
…fixing schema and conftest to include reproductive_type.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #422 +/- ##
===========================================
+ Coverage 94.62% 94.69% +0.06%
===========================================
Files 69 69
Lines 3666 3732 +66
===========================================
+ Hits 3469 3534 +65
- Misses 197 198 +1 ☔ 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.
I've added a few comments here and there, bur it looks good to me. To be honest, it's a fascinating topic!
# TODO: the use of ceil here might have unintended outcomes, keep an eye on it | ||
number_dead = ceil(pop_size * (1 - exp(-u_t * dt))) |
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.
I'm curious: what are the unexpected consequences?
pop_size * (1 - exp(-u_t * dt))
can be, at most, pop_size
, so there's no risk of going above the population size when using ceil
. And I guess that, at the lower end, it makes sense that a fraction of individual dead is a full individual dead, so sort a reasonable behaviour also there, right?
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.
The issue is more apparent when you consider very large bodied animals. Consider, for example, a cohort of 20 mature adult elephants. The non-predation mortality will always be >0 and mortality is calculated every month with our current time-stepping. This means that, at minimum, one adult elephant dies every month regardless of environmental quality, a mortality rate significantly higher than real realized mortality rates.
I was considering a random draw for results under 1 individual, does that make sense to you?
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.
I see...
You're already using probabilistic events in other parts of the code, so I guess it might make sense. In that case, you will have a certain number of dead individuals for sure (might be none) and 1 more that might or might not be dead. This would be rather irrelevant for ants but might make a whole difference for elephants, as you say.
) -> float: | ||
"""Mortality from body-mass loss. | ||
|
||
There is a error in the madingley paper that does not follow their source code. The |
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.
The paper seems to be full of errors 😄
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.
There have been some unpleasant surprises! When I get to doing the final parametrization, I'm going to comb through all of their actual C# code to make sure.
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.
It should be them publishing an addendum...
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!
Description
This adds a new trait to functional groups, reproductive type, which is broken into two variations, iteroparity (reproducing multiple times) and semelparity (reproducing once and then dying). Iteroparous organisms reproduce as before, semelparous organisms also use some of their non-reproductive mass in the reproductive event and then the cohort dies.
This PR also expands non-predation mortality to include a fixed background mortality, senescence mortality, and starvation mortality. There were small errors in the Madingley paper for the latter two mortalities so you may notice an excess of diagnostics in the testing from when I was trying to figure out if I had gone mad. I left them in, in case they might be useful later. Let me know if you think I should remove them.
Fixes # (issue)
Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks