gadget-framework / gadget3

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

Allow length in transform_fs #95

Closed lentinj closed 2 months ago

lentinj commented 1 year ago

Unlike any other dimensions, the result will need to produce lengthgroup vectors.

lentinj commented 1 year ago

@bthe In theory the issue-95-transformfs-length branch should add the length transform, but I've not really tested it at all beyond eyeballing the code that comes out. You're welcome to have a try if you like. Usage should be along the lines of:-

transform_fs = list(length = g3_formula(g3_param_array('reader1matrix', value = diag(10))[g3_idx(stock__length_idx),]))

Note that unlike with age the result of this needs to provide a lengthgroup vector. For each input length scalar, we're reconstituting a transformed lengthgroup vector.

lentinj commented 3 months ago

I've now merged an alternative implementation, that works by supplying a matrix:

        g3l_abundancedistribution("len",
            obsdata,
            function_f = g3l_distribution_sumofsquares(),
            stocks = list(prey_a),
            transform_fs = list(
                length = quote(diag(10 * prey_a__midlen)) ),
            report = TRUE),