Skip to content
Snippets Groups Projects
Commit cb0aac87 authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

backported hybrid function fixes

parent 5d25236b
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,6 @@ sigmoid(const struct cats_vital_rate *rate_info,
assert(rate_info != NULL);
if (rate_info->environment_set == NULL) {
log_message(LOG_ERROR, "%s: environment is NULL", __func__);
exit_cats(EXIT_FAILURE);
......@@ -92,7 +91,6 @@ sigmoid(const struct cats_vital_rate *rate_info,
const cats_dt_rates max_rate = rate_info->max_rate;
if (max_rate == 0.0) {
return max_rate;
}
......@@ -100,7 +98,6 @@ sigmoid(const struct cats_vital_rate *rate_info,
cats_dt_rates scale = get_rate_scale_factor(rate_info, species_parameter);
const cats_dt_rates rate_at_OT = max_rate * scale;
assert(max_rate >= 0);
......@@ -126,15 +123,6 @@ sigmoid(const struct cats_vital_rate *rate_info,
+ expl(ds * (OT - suitability))
* (max_rate / rate_at_OT - 1.0)
);
/*
if (rate_info->is_carrying_capacity) {
printf("* %Lf scale %Lf, suit %Lf, N %Lf, K %Lf, OT %Lf, ds %Lf\n",rate, scale, suitability, N, K,OT, ds);
}
*/
const cats_dt_rates density = hybrid_density_multiplier(rate_info, species_parameter, suitability, N, K);
......@@ -146,18 +134,15 @@ sigmoid(const struct cats_vital_rate *rate_info,
assert(K >= 0);
switch (rate_info->density) {
case DENSITY_DEP_NEGATIVE:
assert(K >= 0);
assert(N >= 0);
if (K == 0) return 0.0;
rate = min_rates(rate, rate * density + ((N / K) * rate_at_OT)); // was: max_rate * scale;
rate = min_rates(rate, rate * density + ((N / K) * rate_at_OT));
break;
case DENSITY_DEP_POSITIVE:
if (K == 0) return 0.0;
rate = rate * density + (1.0 - (N / K)) * rate_at_OT; // was: max_rate * scale;
rate = max_rates(rate, rate * density + (1.0 - (N / K)) * rate_at_OT);
break;
case NO_DENSITY_DEP:
break;
......@@ -217,8 +202,5 @@ cats_dt_rates linear_rate(const struct cats_vital_rate *rate_info,
rate = min_rates(rate, rate * density + ((N / K) * rate_at_OT)); // was: max_rate * scale;
return rate;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment