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

Add mortality in dynamical equations and change default parameter values. #72

Merged
merged 27 commits into from Dec 16, 2022

Conversation

ismael-lajaaiti
Copy link
Collaborator

Main features of this PR:

  • add a mortality term (incorporated in ModelParameters and dBdt!)
  • change the default parameters values for the attack rates and handling time to match Miele et al. 2019
  • correct the classic functional response by multiplying the denominator by predator body-mass (again see Miele et al. 2019)

@ismael-lajaaiti
Copy link
Collaborator Author

Just made a new commit to export two functions that I need for the StabilityMetrics package and thought that these functions could be useful for the users.

Copy link
Collaborator

@iago-lito iago-lito left a comment

Choose a reason for hiding this comment

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

Great :) Again this is good work and I see no problem with the implementation so I can only nitpick here and there. I'm still confused why a new method for the functor is needed (with (B, network) signature), can you explain?

Unrelatedly, you have made use of |> operator which I'm unfamiliar with.. and which I think could improve the package ergonomics a lot from the user POV. Cheers! Stay tuned :D [EDIT] see #73

src/inputs/functional_response.jl Outdated Show resolved Hide resolved
src/inputs/functional_response.jl Show resolved Hide resolved
test/inputs/test-functional_response.jl Outdated Show resolved Hide resolved
test/inputs/test-functional_response.jl Show resolved Hide resolved
src/inputs/biological_rates.jl Show resolved Hide resolved
test/inputs/test-functional_response.jl Show resolved Hide resolved
test/inputs/test-functional_response.jl Outdated Show resolved Hide resolved
src/inputs/functional_response.jl Outdated Show resolved Hide resolved
src/inputs/functional_response.jl Outdated Show resolved Hide resolved
@@ -492,6 +495,22 @@ function (F::FunctionalResponse)(B)
end
(F::FunctionalResponse)(B, _::EcologicalNetwork) = F(B)

function (F::ClassicResponse)(B, network::FoodWeb)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm sorry I don't understand why this new method is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Long version in a comment below.
Short version: to compute the classic functional response, I need the species biomasses M which is stored in the network.

@ismael-lajaaiti
Copy link
Collaborator Author

Great :) Again this is good work and I see no problem with the implementation so I can only nitpick here and there. I'm still confused why a new method for the functor is needed (with (B, network) signature), can you explain?

Unrelatedly, you have made use of |> operator which I'm unfamiliar with.. and which I think could improve the package ergonomics a lot from the user POV. Cheers! Stay tuned :D

Thanks for your review, I'm gonna incorporate the changes you suggested. Let you know when it's done.

For the new signature, now I also need to pass the network to the the functional response (specifically to the ClassicResponse) because that response depends on the species body-mass M and M is stored in the network<:EcologicalNetwork object.

For the pipe operator do you think of things like foodweb |> MultiplexNetwork (to convert a foodweb to a MultiplexNetwork). If so, I already had this in mind and I think that in some cases it can be very neat, but most of the time the user would like to also provide keyword arguments, and in this case I'm not sure the pipe syntax can be used (maybe wrong).

@iago-lito
Copy link
Collaborator

Yes, I would reserve pipe syntax for functions with only 1 argument.. or with very, very, overly-used defaults. See #73 about that ;)

@ismael-lajaaiti
Copy link
Collaborator Author

ismael-lajaaiti commented Nov 16, 2022

Here is the modifications you requested @iago-lito (last commit).
Let me know if it's good for you, and thanks again for your comments! :)

ismael-lajaaiti and others added 11 commits December 15, 2022 10:33
+ some tambouille about sol.k
- Reference #65 to explain why setting `B[i_extinct] = 0` is needed in `dBdt!`.
- Simplify calculation of initial `extinct_sp` values.
- Avoid checking `isa(extinction_threshold, Number)` on every timestep.
Not yet integrated in the ODEs.
Also added few tests.
Still have to update the doc.
Forgot one term in the denominator of the classic functional response.
@iago-lito iago-lito merged commit db1c874 into BecksLab:develop Dec 16, 2022
@ismael-lajaaiti ismael-lajaaiti deleted the miele2019_params branch December 16, 2022 16:03
This was linked to issues Jan 13, 2023
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.

Default argument values Add mortality term to the ODEs
3 participants