Skip to contents

Size spectra at end of simulation

Usage

finalN(sim)

finalNResource(sim)

idxFinalT(sim)

Arguments

sim

A MizerSim object

Value

For finalN(): An ArraySpeciesBySize object (species x size) holding the consumer number densities at the end of the simulation

For finalNResource(): A vector holding the resource number densities at the end of the simulation for all size classes

For idxFinalT(): An integer giving the index for extracting the results for the final time step

Examples

str(finalN(NS_sim))
#>  'ArraySpeciesBySize' num [1:12, 1:100] 1.53e+13 5.89e+12 1.10e+14 1.37e+13 1.16e+11 ...
#>  - attr(*, "dimnames")=List of 2
#>   ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>  - attr(*, "value_name")= chr "Number density"
#>  - attr(*, "params")=Formal class 'MizerParams' [package "mizer"] with 46 slots
#>   .. ..@ metadata               : list()
#>   .. ..@ mizer_version          :Classes 'package_version', 'numeric_version'  hidden list of 1
#>   .. .. ..$ : int [1:4] 2 5 4 9126
#>   .. ..@ extensions             : chr(0) 
#>   .. ..@ time_created           : POSIXct[1:1], format: "2021-09-03 20:30:02"
#>   .. ..@ time_modified          : POSIXct[1:1], format: "2026-05-09 08:15:13"
#>   .. ..@ w                      : num [1:100] 0.001 0.00119 0.00142 0.0017 0.00203 ...
#>   .. ..@ dw                     : num [1:100] 0.000193 0.000231 0.000275 0.000329 0.000392 ...
#>   .. ..@ w_full                 : num [1:218] 8.73e-13 1.04e-12 1.24e-12 1.48e-12 1.77e-12 ...
#>   .. ..@ dw_full                : num [1:218] 1.69e-13 2.01e-13 2.40e-13 2.87e-13 3.42e-13 ...
#>   .. ..@ w_min_idx              : Named num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. .. ..- attr(*, "names")= chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. ..@ maturity               : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ psi                    : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ initial_n              : num [1:12, 1:100] 1.67e+13 5.82e+12 1.19e+14 1.36e+13 1.17e+11 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ intake_max             : num [1:12, 1:100] 0.145 0.256 0.312 0.284 0.349 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ search_vol             : num [1:12, 1:100] 4.39e-13 2.94e-13 7.57e-13 1.95e-13 5.89e-13 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ metab                  : num [1:12, 1:100] 0.0127 0.0233 0.0268 0.0232 0.03 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ pred_kernel            : logi [1(1d)] NA
#>   .. ..@ ft_pred_kernel_e       : cplx [1:12, 1:218] 11.3+0i 26.9+0i 20.8+0i ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ k : chr [1:218] "1" "2" "3" "4" ...
#>   .. ..@ ft_pred_kernel_p       : cplx [1:12, 1:218] 11.3+0i 26.9+0i 20.8+0i ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ k : chr [1:218] "1" "2" "3" "4" ...
#>   .. ..@ mu_b                   : num [1:12, 1:100] 0.1871 0.1817 0.1293 0.0865 0.0874 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ ext_encounter          : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ ext_diffusion          : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ rr_pp                  : Named num [1:218] 104642 98654 93009 87686 82669 ...
#>   .. .. ..- attr(*, "names")= chr [1:218] "8.73e-13" "1.04e-12" "1.24e-12" "1.48e-12" ...
#>   .. ..@ cc_pp                  : Named num [1:218] 4.88e+35 3.40e+35 2.36e+35 1.64e+35 1.14e+35 ...
#>   .. .. ..- attr(*, "names")= chr [1:218] "8.73e-13" "1.04e-12" "1.24e-12" "1.48e-12" ...
#>   .. ..@ resource_dynamics      : chr "resource_semichemostat"
#>   .. ..@ resource_params        :List of 5
#>   .. .. ..$ kappa      : num 9.27e+10
#>   .. .. ..$ lambda     : num 2.05
#>   .. .. ..$ r_pp       : num 10
#>   .. .. ..$ n          : num 0.667
#>   .. .. ..$ w_pp_cutoff: num 10
#>   .. ..@ other_dynamics         : list()
#>   .. ..@ other_params           : list()
#>   .. ..@ other_encounter        : list()
#>   .. ..@ other_mort             : list()
#>   .. ..@ rates_funcs            :List of 14
#>   .. .. ..$ Rates          : chr "mizerRates"
#>   .. .. ..$ Encounter      : chr "mizerEncounter"
#>   .. .. ..$ FeedingLevel   : chr "mizerFeedingLevel"
#>   .. .. ..$ EReproAndGrowth: chr "mizerEReproAndGrowth"
#>   .. .. ..$ PredRate       : chr "mizerPredRate"
#>   .. .. ..$ PredMort       : chr "mizerPredMort"
#>   .. .. ..$ FMort          : chr "mizerFMort"
#>   .. .. ..$ Mort           : chr "mizerMort"
#>   .. .. ..$ ERepro         : chr "mizerERepro"
#>   .. .. ..$ EGrowth        : chr "mizerEGrowth"
#>   .. .. ..$ ResourceMort   : chr "mizerResourceMort"
#>   .. .. ..$ RDI            : chr "mizerRDI"
#>   .. .. ..$ RDD            : chr "BevertonHoltRDD"
#>   .. .. ..$ Diffusion      : chr "mizerDiffusion"
#>   .. ..@ sc                     : num [1:100] 0.001 0.00119 0.00142 0.0017 0.00203 ...
#>   .. ..@ initial_n_pp           : Named num [1:218] 4.88e+35 3.40e+35 2.36e+35 1.64e+35 1.14e+35 ...
#>   .. .. ..- attr(*, "names")= chr [1:218] "8.73e-13" "1.04e-12" "1.24e-12" "1.48e-12" ...
#>   .. ..@ initial_n_other        : list()
#>   .. ..@ species_params         :'data.frame':	12 obs. of  30 variables:
#>   .. .. ..$ species             : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. ..$ w_max               : num [1:12] 33 36 100 334 324 ...
#>   .. .. ..$ w_mat               : int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#>   .. .. ..$ beta                : int [1:12] 51076 398849 22 280540 191 22 381 283 113 558 ...
#>   .. .. ..$ sigma               : num [1:12] 0.8 1.9 1.5 3.2 1.9 1.5 1.9 1.8 1.6 2.1 ...
#>   .. .. ..$ k_vb                : num [1:12] 0.681 1 0.849 0.606 0.536 0.323 0.284 0.266 0.122 0.271 ...
#>   .. .. ..$ R_max               : num [1:12] 7.38e+11 4.10e+11 1.05e+13 1.11e+12 1.12e+10 ...
#>   .. .. ..$ a                   : num [1:12] 0.007 0.001 0.009 0.002 0.01 0.006 0.008 0.004 0.007 0.005 ...
#>   .. .. ..$ b                   : num [1:12] 3.01 3.32 2.94 3.43 2.99 ...
#>   .. .. ..$ w_min               : num [1:12] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 ...
#>   .. .. ..$ alpha               : num [1:12] 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ...
#>   .. .. ..$ interaction_resource: num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. .. ..$ n                   : num [1:12] 0.667 0.667 0.667 0.667 0.667 ...
#>   .. .. ..$ p                   : num [1:12] 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 ...
#>   .. .. ..$ q                   : num [1:12] 0.717 0.717 0.717 0.717 0.717 ...
#>   .. .. ..$ pred_kernel_type    : chr [1:12] "lognormal" "lognormal" "lognormal" "lognormal" ...
#>   .. .. ..$ h                   : num [1:12] 14.5 25.6 31.2 28.4 34.9 ...
#>   .. .. ..$ k                   : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..$ ks                  : num [1:12] 1.59 2.94 3.37 2.92 3.78 ...
#>   .. .. ..$ z0                  : num [1:12] 0.1871 0.1817 0.1293 0.0865 0.0874 ...
#>   .. .. ..$ gamma               : num [1:12] 6.20e-11 4.16e-11 1.07e-10 2.76e-11 8.31e-11 ...
#>   .. .. ..$ w_mat25             : num [1:12] 11.65 3.58 20.61 88.7 18.82 ...
#>   .. .. ..$ m                   : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. .. ..$ erepro              : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. .. ..$ w_repro_max         : num [1:12] 33 36 100 334 324 ...
#>   .. .. ..$ is_background       : logi [1:12] FALSE FALSE FALSE FALSE FALSE FALSE ...
#>   .. .. ..$ z_ext               : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..$ d                   : num [1:12] -0.333 -0.333 -0.333 -0.333 -0.333 ...
#>   .. .. ..$ E_ext               : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..$ D_ext               : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. ..@ given_species_params   :'data.frame':	12 obs. of  24 variables:
#>   .. .. ..$ species             : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. ..$ w_max               : num [1:12] 33 36 100 334 324 ...
#>   .. .. ..$ w_mat               : int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#>   .. .. ..$ beta                : int [1:12] 51076 398849 22 280540 191 22 381 283 113 558 ...
#>   .. .. ..$ sigma               : num [1:12] 0.8 1.9 1.5 3.2 1.9 1.5 1.9 1.8 1.6 2.1 ...
#>   .. .. ..$ k_vb                : num [1:12] 0.681 1 0.849 0.606 0.536 0.323 0.284 0.266 0.122 0.271 ...
#>   .. .. ..$ R_max               : num [1:12] 7.38e+11 4.10e+11 1.05e+13 1.11e+12 1.12e+10 ...
#>   .. .. ..$ a                   : num [1:12] 0.007 0.001 0.009 0.002 0.01 0.006 0.008 0.004 0.007 0.005 ...
#>   .. .. ..$ b                   : num [1:12] 3.01 3.32 2.94 3.43 2.99 ...
#>   .. .. ..$ w_min               : num [1:12] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 ...
#>   .. .. ..$ alpha               : num [1:12] 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ...
#>   .. .. ..$ interaction_resource: num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. .. ..$ n                   : num [1:12] 0.667 0.667 0.667 0.667 0.667 ...
#>   .. .. ..$ p                   : num [1:12] 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 ...
#>   .. .. ..$ q                   : num [1:12] 0.717 0.717 0.717 0.717 0.717 ...
#>   .. .. ..$ pred_kernel_type    : chr [1:12] "lognormal" "lognormal" "lognormal" "lognormal" ...
#>   .. .. ..$ h                   : num [1:12] 14.5 25.6 31.2 28.4 34.9 ...
#>   .. .. ..$ k                   : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..$ ks                  : num [1:12] 1.59 2.94 3.37 2.92 3.78 ...
#>   .. .. ..$ z0                  : num [1:12] 0.1871 0.1817 0.1293 0.0865 0.0874 ...
#>   .. .. ..$ gamma               : num [1:12] 6.20e-11 4.16e-11 1.07e-10 2.76e-11 8.31e-11 ...
#>   .. .. ..$ w_mat25             : num [1:12] 11.65 3.58 20.61 88.7 18.82 ...
#>   .. .. ..$ m                   : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. .. ..$ erepro              : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. ..@ interaction            : num [1:12, 1:12] 0.7291 0.0341 0.0635 0.2742 0.3624 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ predator: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ prey    : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. ..@ gear_params            :'data.frame':	12 obs. of  6 variables:
#>   .. .. ..$ species     : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. ..$ gear        : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. ..$ sel_func    : chr [1:12] "sigmoid_length" "sigmoid_length" "sigmoid_length" "sigmoid_length" ...
#>   .. .. ..$ l25         : num [1:12] 7.6 9.8 8.7 10.1 11.5 19.8 16.4 19.8 11.5 19.1 ...
#>   .. .. ..$ l50         : num [1:12] 8.1 11.8 12.2 20.8 17 29 25.8 29 17 24.3 ...
#>   .. .. ..$ catchability: num [1:12] 1.24 0.886 1.24 0.573 0.124 ...
#>   .. ..@ selectivity            : num [1:12, 1:12, 1:100] 5.9e-08 0.0 0.0 0.0 0.0 ...
#>   .. .. ..- attr(*, "dimnames")=List of 3
#>   .. .. .. ..$ gear: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ sp  : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ w   : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#>   .. ..@ catchability           : num [1:12, 1:12] 1.24 0 0 0 0 ...
#>   .. .. ..- attr(*, "dimnames")=List of 2
#>   .. .. .. ..$ gear: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. .. .. ..$ sp  : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. ..@ initial_effort         : Named num [1:12] 0 0 0 1.808 0.758 ...
#>   .. .. ..- attr(*, "names")= chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. ..@ A                      : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#>   .. ..@ linecolour             : Named chr [1:17] "#815f00" "#6237e2" "#8da600" "#de53ff" ...
#>   .. .. ..- attr(*, "names")= chr [1:17] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. ..@ linetype               : Named chr [1:17] "solid" "solid" "solid" "solid" ...
#>   .. .. ..- attr(*, "names")= chr [1:17] "Sprat" "Sandeel" "N.pout" "Herring" ...
#>   .. ..@ ft_mask                : logi [1:12, 1:218] TRUE TRUE TRUE TRUE TRUE TRUE ...
#>   .. ..@ use_predation_diffusion: logi FALSE

# This could also be obtained using `N()` and `idxFinalT()`
identical(N(NS_sim)[idxFinalT(NS_sim), , ], finalN(NS_sim))
#> [1] FALSE
str(finalNResource(NS_sim))
#>  Named num [1:218] 4.88e+35 3.40e+35 2.36e+35 1.64e+35 1.14e+35 ...
#>  - attr(*, "names")= chr [1:218] "8.73e-13" "1.04e-12" "1.24e-12" "1.48e-12" ...
idx <- idxFinalT(NS_sim)
idx
#> [1] 44
# This coincides with
length(getTimes(NS_sim))
#> [1] 44
# and corresponds to the final time
getTimes(NS_sim)[idx]
#> [1] 2010
# We can use this index to extract the result at the final time
identical(N(NS_sim)[idx, , ], finalN(NS_sim))
#> [1] FALSE
identical(NResource(NS_sim)[idx, ], finalNResource(NS_sim))
#> [1] TRUE