gadget-framework / gadget3

TMB-based gadget implemtation
GNU General Public License v2.0
8 stars 6 forks source link

g3a_initialconditions_normalcv #123

Closed lentinj closed 9 months ago

lentinj commented 9 months ago

@bthe I was thinking of defining a g3a_initialconditions_normalcv as:

# normalparam, but with a cv_f instead of stddev_f
g3a_initialconditions_normalcv <- function (
        stock,
        factor_f = g3a_renewal_initabund(by_stock = by_stock),
        mean_f = g3a_renewal_vonb_t0(by_stock = by_stock),
        cv_f = g3_parameterized('lencv', by_stock = by_stock, value = 0.1, optimise = FALSE),
        alpha_f = g3_parameterized('walpha', by_stock = wgt_by_stock),
        beta_f = g3_parameterized('wbeta', by_stock = wgt_by_stock),
        age_offset = quote( cur_step_size ),
        by_stock = TRUE,
        by_age = FALSE,
        wgt_by_stock = TRUE,
        run_f = ~cur_time == 0L,
        run_at = 0) {
    g3a_initialconditions_normalparam(
        stock = stock,
        factor_f = factor_f,
        mean_f = mean_f,
        stddev_f = f_substitute(quote(mean_f * cv_f), list(mean_f = mean_f, cv_f = cv_f)),
        alpha_f = alpha_f,
        beta_f = beta_f,
        age_offset = age_offset,
        run_f = run_f,
        run_at = run_at)
}

Any objections? Any preferences to what it's called?

bthe commented 9 months ago

Looks good to me, and is definitely going to simplify the setup.

lentinj commented 9 months ago

I've made g3a_renewal_normalcv too since it was easy. You don't seem to have anything in bling to do similar though.