Skip to content

Commit

Permalink
In defaults edition 2, get_gamma_default() ensures a feeding level …
Browse files Browse the repository at this point in the history
…of `f0` for larvae also if `interaction_resource` is not equal to 1. Closes #238
  • Loading branch information
gustavdelius committed Jul 15, 2022
1 parent c6abdb1 commit a9e4ff2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

* Improved defaults can now be implemented while keeping backwards compatibility
via `defaults_edition()`.
* New defaults edition 2: catchability = 0.3 instead of 1, initial effort = 1
instead of 0.
* In defaults edition 2, `get_gamma_default()` ensures a feeding level of `f0`
for larvae also if `interaction_resource` is not equal to 1.
* The entries of the interaction matrix and of interaction_resource are not
longer restricted to be less or equal to 1. #232
* If user supplies no row names in the interaction matrix but give column names
Expand Down
11 changes: 7 additions & 4 deletions R/species_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ get_h_default <- function(params) {

#' Get default value for gamma
#'
#' Fills in any missing values for gamma so that if the prey abundance was
#' described by the power law \eqn{\kappa w^{-\lambda}} then the encounter rate
#' would lead to the feeding level \eqn{f_0}. Only for internal use.
#' Fills in any missing values for gamma so that fish feeding on a resource
#' spectrum described by the power law \eqn{\kappa w^{-\lambda}} achieve a
#' feeding level \eqn{f_0}. Only for internal use.
#'
#' @param params A MizerParams object
#' @return A vector with the values of gamma for all species
Expand Down Expand Up @@ -280,7 +280,10 @@ get_gamma_default <- function(params) {
params <- setSearchVolume(params)
# and setting a power-law prey spectrum
params@initial_n[] <- 0
params@species_params$interaction_resource <- 1
if (defaults_edition() < 2) {
# See issue #238
params@species_params$interaction_resource <- 1
}
params@initial_n_pp[] <- params@resource_params$kappa *
params@w_full^(-params@resource_params$lambda)
avail_energy <- getEncounter(params)[, length(params@w)] /
Expand Down
16 changes: 8 additions & 8 deletions docs/dev/reference/get_gamma_default.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/get_gamma_default.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9e4ff2

Please sign in to comment.