From 6090a88d2b66d942b0b09f3900e714b21bca91de Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 26 Feb 2026 11:16:49 +0000 Subject: [PATCH 1/8] feat: Introduce `MizerRate` S3 class to enhance rate function outputs with improved printing, summary, and plotting capabilities. --- DESCRIPTION | 1 + R/MizerRate-class.R | 295 +++++++++++++++++++++++ R/rate_functions.R | 38 ++- tests/testthat/_snaps/project_methods.md | 104 +++++++- tests/testthat/test-MizerRate.R | 146 +++++++++++ tests/testthat/test-extension.R | 14 +- tests/testthat/test-project_methods.R | 21 +- 7 files changed, 588 insertions(+), 31 deletions(-) create mode 100644 R/MizerRate-class.R create mode 100644 tests/testthat/test-MizerRate.R diff --git a/DESCRIPTION b/DESCRIPTION index dc0bf75a8..0c744ea1b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -55,6 +55,7 @@ Collate: 'helpers.R' 'MizerParams-class.R' 'MizerSim-class.R' + 'MizerRate-class.R' 'reproduction.R' 'saveParams.R' 'species_params.R' diff --git a/R/MizerRate-class.R b/R/MizerRate-class.R new file mode 100644 index 000000000..11e676450 --- /dev/null +++ b/R/MizerRate-class.R @@ -0,0 +1,295 @@ +# MizerRate S3 class for species x size arrays +# +# Copyright 2026 Gustav Delius. +# Distributed under the GPL 3 or later. + +#' S3 class for species x size rate arrays +#' +#' Many rate functions in mizer return two-dimensional arrays (species x size) +#' holding rates like encounter rate, feeding level, growth rate, mortality etc. +#' The `MizerRate` class wraps these arrays to provide convenient `print()`, +#' `summary()`, `plot()`, and `as.data.frame()` methods. +#' +#' A `MizerRate` object behaves just like a regular matrix for arithmetic +#' operations and subsetting. It carries two lightweight attributes: +#' \itemize{ +#' \item `rate_name` – a human-readable name for the rate (e.g. "Encounter rate"). +#' \item `units` – the units of the rate (e.g. "g/year"). +#' } +#' +#' @param x A matrix (species x size). +#' @param rate_name A string giving the human-readable name for the rate. +#' @param units A string giving the units (e.g. "g/year", "1/year"). +#' @param params A `MizerParams` object. Currently unused but reserved for +#' future extensions. +#' +#' @return A `MizerRate` object (inherits from `matrix` and `array`). +#' @export +#' @examples +#' \donttest{ +#' enc <- getEncounter(NS_params) +#' is.MizerRate(enc) +#' summary(enc) +#' } +MizerRate <- function(x, rate_name = NULL, units = NULL, params = NULL) { + if (!is.matrix(x)) { + stop("`x` must be a matrix.") + } + structure(x, + class = c("MizerRate", "matrix", "array"), + rate_name = rate_name, + units = units + ) +} + +#' Test if an object is a MizerRate +#' +#' @param x An object to test. +#' @return `TRUE` if `x` is a `MizerRate` object, `FALSE` otherwise. +#' @export +#' @examples +#' is.MizerRate(getEncounter(NS_params)) +#' is.MizerRate(matrix(1:4, nrow = 2)) +is.MizerRate <- function(x) { + inherits(x, "MizerRate") +} + +#' @export +print.MizerRate <- function(x, ...) { + rate_name <- attr(x, "rate_name") %||% "MizerRate" + units_str <- attr(x, "units") + dims <- dim(x) + header <- paste0(rate_name, " (", dims[1], " species x ", dims[2], " sizes)") + if (!is.null(units_str)) { + header <- paste0(header, " [", units_str, "]") + } + cat(header, "\n") + # Print a compact summary per species + sp_names <- rownames(x) + if (!is.null(sp_names)) { + vals <- apply(unclass(x), 1, function(row) { + row <- row[is.finite(row)] + if (length(row) == 0) return("all NA/Inf") + paste0("min=", signif(min(row), 3), + " mean=", signif(mean(row), 3), + " max=", signif(max(row), 3)) + }) + for (i in seq_along(sp_names)) { + cat(" ", sp_names[i], ": ", vals[i], "\n", sep = "") + } + } + invisible(x) +} + +#' @export +summary.MizerRate <- function(object, ...) { + rate_name <- attr(object, "rate_name") %||% "MizerRate" + units_str <- attr(object, "units") + sp_names <- rownames(object) + mat <- unclass(object) + + df <- data.frame( + Species = sp_names, + Min = apply(mat, 1, min, na.rm = TRUE), + Mean = apply(mat, 1, mean, na.rm = TRUE), + Max = apply(mat, 1, max, na.rm = TRUE), + row.names = NULL, + stringsAsFactors = FALSE + ) + + result <- list( + rate_name = rate_name, + units = units_str, + dims = dim(object), + per_species = df + ) + class(result) <- "summary.MizerRate" + result +} + +#' @export +print.summary.MizerRate <- function(x, ...) { + header <- x$rate_name + if (!is.null(x$units)) { + header <- paste0(header, " [", x$units, "]") + } + cat(header, "\n") + cat(x$dims[1], "species x", x$dims[2], "sizes\n\n") + print(x$per_species, row.names = FALSE) + invisible(x) +} + +#' Plot a MizerRate object +#' +#' Plots the rate against size for each species, using species colours and +#' linetypes from the MizerParams object. +#' +#' @param x A `MizerRate` object. +#' @param params A `MizerParams` object. Used for species colours, linetypes, +#' and size ranges. If `NULL`, a basic plot is produced. +#' @param species Character vector of species to include. `NULL` (default) means +#' all species. +#' @param all.sizes If `FALSE` (default), values outside a species' size range +#' (`w_min` to `w_max`) are removed. Only effective when `params` is provided. +#' @param highlight Name or vector of names of the species to be highlighted. +#' @param return_data If `TRUE`, return the data frame instead of the plot. +#' @param log_x If `TRUE` (default), use a log10 x-axis. +#' @param ... Further arguments (currently unused). +#' +#' @return A ggplot2 object, unless `return_data = TRUE`, in which case a data +#' frame with the variables 'w', 'value', 'Species' is returned. +#' @export +#' @examples +#' \donttest{ +#' plot(getEncounter(NS_params), NS_params) +#' plot(getFeedingLevel(NS_params), NS_params, +#' species = c("Cod", "Herring")) +#' } +plot.MizerRate <- function(x, params = NULL, species = NULL, + all.sizes = FALSE, highlight = NULL, + return_data = FALSE, log_x = TRUE, ...) { + rate_name <- attr(x, "rate_name") %||% "Rate" + units_str <- attr(x, "units") + + # Get w grid from params or from dimnames + if (!is.null(params)) { + w <- params@w + linecolour <- params@linecolour + linetype <- params@linetype + species_params <- params@species_params + } else { + w <- as.numeric(colnames(x)) + if (any(is.na(w))) w <- seq_len(ncol(x)) + linecolour <- NULL + linetype <- NULL + species_params <- NULL + } + + all_species <- rownames(x) + if (is.null(species)) { + species <- all_species + } else { + species <- intersect(species, all_species) + if (length(species) == 0) { + stop("None of the selected species are in the rate array.") + } + } + + sel <- all_species %in% species + mat <- unclass(x)[sel, , drop = FALSE] + + plot_dat <- data.frame( + w = rep(w, each = sum(sel)), + value = c(mat), + Species = rownames(mat) + ) + + if (!all.sizes && !is.null(species_params)) { + for (sp in species) { + if (sp %in% species_params$species) { + sp_row <- species_params[species_params$species == sp, ] + w_min_sp <- sp_row$w_min[1] + w_max_sp <- sp_row$w_max[1] + plot_dat$value[plot_dat$Species == sp & + (plot_dat$w < w_min_sp | + plot_dat$w > w_max_sp)] <- NA + } + } + plot_dat <- plot_dat[complete.cases(plot_dat), ] + } + + if (return_data) return(plot_dat) + + y_label <- rate_name + if (!is.null(units_str)) { + y_label <- paste0(rate_name, " [", units_str, "]") + } + + # Set up species as ordered factor for legend + if (!is.null(linecolour)) { + legend_levels <- intersect(names(linecolour), plot_dat$Species) + } else { + legend_levels <- unique(plot_dat$Species) + } + plot_dat$Species <- factor(plot_dat$Species, levels = legend_levels) + + linesize <- rep(0.8, length(legend_levels)) + names(linesize) <- legend_levels + if (!is.null(highlight)) { + linesize[highlight] <- 1.6 + } + + p <- ggplot2::ggplot(plot_dat, ggplot2::aes(group = .data[["Species"]])) + + ggplot2::geom_line(ggplot2::aes( + x = .data[["w"]], + y = .data[["value"]], + colour = .data[["Species"]], + linetype = .data[["Species"]], + linewidth = .data[["Species"]] + )) + + ggplot2::scale_y_continuous(name = y_label) + + if (log_x) { + p <- p + ggplot2::scale_x_continuous(name = "Size [g]", + trans = "log10") + } else { + p <- p + ggplot2::scale_x_continuous(name = "Size [g]") + } + + if (!is.null(linecolour)) { + p <- p + ggplot2::scale_colour_manual(values = linecolour[legend_levels]) + } + if (!is.null(linetype)) { + p <- p + ggplot2::scale_linetype_manual(values = linetype[legend_levels]) + } + p <- p + ggplot2::scale_discrete_manual("linewidth", values = linesize) + + p +} + +#' @export +as.data.frame.MizerRate <- function(x, row.names = NULL, + optional = FALSE, ...) { + w <- as.numeric(colnames(x)) + if (any(is.na(w))) { + w <- seq_len(ncol(x)) + } + sp_names <- rownames(x) + mat <- unclass(x) + data.frame( + w = rep(w, each = nrow(mat)), + value = c(mat), + Species = sp_names, + stringsAsFactors = FALSE + ) +} + +#' @export +`[.MizerRate` <- function(x, i, j, ..., drop = TRUE) { + result <- NextMethod() + # Preserve class only if result is still a 2D matrix + if (is.matrix(result) && length(dim(result)) == 2) { + attr(result, "rate_name") <- attr(x, "rate_name") + attr(result, "units") <- attr(x, "units") + class(result) <- c("MizerRate", "matrix", "array") + } + result +} + +#' @export +Ops.MizerRate <- function(e1, e2) { + # Strip MizerRate class so that arithmetic returns a plain matrix. + # We unclass both operands and call the generic directly. + if (is.MizerRate(e1)) e1 <- unclass_rate(e1) + if (!missing(e2) && is.MizerRate(e2)) e2 <- unclass_rate(e2) + op <- match.fun(.Generic) + if (missing(e2)) op(e1) else op(e1, e2) +} + +# Helper to strip all MizerRate attributes +unclass_rate <- function(x) { + x <- unclass(x) + attr(x, "rate_name") <- NULL + attr(x, "units") <- NULL + x +} diff --git a/R/rate_functions.R b/R/rate_functions.R index b786fe3e6..1924d230a 100644 --- a/R/rate_functions.R +++ b/R/rate_functions.R @@ -87,7 +87,8 @@ getEncounter.MizerParams <- function(params, n = initialN(params), f <- get(params@rates_funcs$Encounter) encounter <- f(params, n = n, n_pp = n_pp, n_other = n_other, t = t) dimnames(encounter) <- dimnames(params@metab) - encounter + MizerRate(encounter, rate_name = "Encounter rate", + units = "g/year", params = params) } @@ -149,7 +150,8 @@ getFeedingLevel.MizerParams <- function(object, n, n_pp, n_other, t = t), t = t) dimnames(feeding_level) <- dimnames(params@metab) - return(feeding_level) + return(MizerRate(feeding_level, rate_name = "Feeding level", + params = params)) } #' @export @@ -200,7 +202,9 @@ getCriticalFeedingLevel <- function(params) { #' @export getCriticalFeedingLevel.MizerParams <- function(params) { params <- validParams(params) - params@metab / params@intake_max / params@species_params$alpha + result <- params@metab / params@intake_max / params@species_params$alpha + MizerRate(result, rate_name = "Critical feeding level", + params = params) } @@ -249,7 +253,8 @@ getEReproAndGrowth.MizerParams <- function(params, n = initialN(params), feeding_level = getFeedingLevel(params, n, n_pp, n_other, time_range = t)) dimnames(e) <- dimnames(params@metab) - e + MizerRate(e, rate_name = "Energy for growth and reproduction", + units = "g/year", params = params) } #' Get predation rate @@ -360,9 +365,9 @@ getPredMort.MizerParams <- function(object, n, n_pp, n_other, pred_mort <- f(params, n = n, n_pp = n_pp, n_other = n_other, t = t, pred_rate = getPredRate(params, n = n, n_pp = n_pp, n_other = n_other, t = t)) - dimnames(pred_mort) <- list(prey = dimnames(params@initial_n)$sp, - w_prey = dimnames(params@initial_n)$w) - pred_mort + dimnames(pred_mort) <- dimnames(params@metab) + MizerRate(pred_mort, rate_name = "Predation mortality", + units = "1/year", params = params) } #' @export @@ -673,6 +678,8 @@ getFMort.MizerParams <- function(object, effort, time_range, drop = TRUE) { n_other = n_other, time_range = t)) dimnames(fmort) <- dimnames(params@metab) + fmort <- MizerRate(fmort, rate_name = "Fishing mortality", + units = "1/year", params = params) return(fmort) } else if (length(effort) == no_gears) { fmort <- f(params, n = n, n_pp = n_pp, n_other = n_other, @@ -683,6 +690,8 @@ getFMort.MizerParams <- function(object, effort, time_range, drop = TRUE) { n_other = n_other, time_range = t)) dimnames(fmort) <- dimnames(params@metab) + fmort <- MizerRate(fmort, rate_name = "Fishing mortality", + units = "1/year", params = params) return(fmort) } else { stop("Invalid effort argument") @@ -773,9 +782,9 @@ getMort.MizerParams <- function(params, f_mort = getFMort(params, effort), pred_mort = getPredMort(params, n = n, n_pp = n_pp, n_other = n_other, time_range = t)) - dimnames(z) <- list(prey = dimnames(params@initial_n)$sp, - w_prey = dimnames(params@initial_n)$w) - return(z) + dimnames(z) <- dimnames(params@metab) + return(MizerRate(z, rate_name = "Total mortality", + units = "1/year", params = params)) } #' Alias for `getMort()` @@ -833,7 +842,8 @@ getERepro.MizerParams <- function(params, n = initialN(params), e = getEReproAndGrowth(params, n = n, n_pp = n_pp, n_other = n_other, t = t)) dimnames(erepro) <- dimnames(params@metab) - erepro + MizerRate(erepro, rate_name = "Energy for reproduction", + units = "g/year", params = params) } #' Alias for `getERepro()` @@ -889,7 +899,8 @@ getEGrowth.MizerParams <- function(params, n = initialN(params), e = getEReproAndGrowth(params, n = n, n_pp = n_pp, n_other = n_other, t = t)) dimnames(g) <- dimnames(params@metab) - g + MizerRate(g, rate_name = "Growth rate", + units = "g/year", params = params) } @@ -1071,7 +1082,8 @@ getFlux.MizerParams <- function(params, n = initialN(params), } dimnames(flux) <- dimnames(params@metab) - flux + MizerRate(flux, rate_name = "Flux", + units = "1/year", params = params) } diff --git a/tests/testthat/_snaps/project_methods.md b/tests/testthat/_snaps/project_methods.md index be0e39451..8131d7a38 100644 --- a/tests/testthat/_snaps/project_methods.md +++ b/tests/testthat/_snaps/project_methods.md @@ -29,6 +29,16 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Feeding level"] } }, "value": [1.92871184e-10, 0.97438045, 7.22506867e-10, 0.99990999, 1.54002382e-09, 5.78108077e-10, 1.74929109e-08, 2.25116798e-10, 4.10575065e-10, 0.0000201, 4.56828378e-10, 8.17326512e-10, 2.48029872e-10, 0.96283832, 7.16638785e-10, 0.99989762, 9.73806129e-10, 7.64283642e-10, 8.43125789e-09, 1.07598729e-10, 4.24914139e-10, 0.00001133, 6.55261573e-10, 8.62001292e-10, 1.62884937e-10, 0.94594577, 8.02982352e-10, 0.9998832, 7.7781496e-10, 6.38130453e-10, 4.24452041e-09, 2.30975628e-10, 5.33178023e-10, 6.33741675e-06, 3.46805994e-10, 7.23387373e-10, 2.48510734e-10, 0.92137766, 8.88187072e-10, 0.99986635, 5.710564e-10, 8.48159635e-10, 2.03992318e-09, 1.18408622e-10, 4.69227019e-10, 3.52088075e-06, 5.98430368e-10, 7.03269081e-10, 1.02735525e-10, 0.88611478, 1.58791409e-09, 0.9998466, 7.35035651e-10, 1.54690189e-09, 1.15562978e-09, 3.00141339e-10, 6.56883501e-10, 1.94246689e-06, 5.4772905e-10, 7.41814988e-10, 2.42800773e-10, 0.83665114, 1.98131753e-09, 0.99982341, 7.817042e-10, 2.28006738e-09, 6.57073531e-10, 3.31213532e-10, 5.34734213e-10, 1.06421652e-06, 6.84708575e-10, 6.9996001e-10, 9.91099389e-11, 0.76973282, 3.02563826e-09, 0.99979609, 1.03476399e-09, 3.25322184e-09, 6.57363354e-10, 5.47358951e-10, 7.77606399e-10, 5.79127117e-07, 7.66196423e-10, 5.45189823e-10, 2.30192161e-10, 0.68384652, 4.50182536e-09, 0.99976383, 1.17634537e-09, 5.18457195e-09, 5.80647546e-10, 5.40124268e-10, 7.1142056e-10, 3.13121009e-07, 9.5884953e-10, 8.78158058e-10, 1.01315623e-10, 0.58118136, 6.92128246e-09, 0.99972565, 1.42541507e-09, 7.66331361e-09, 6.19897641e-10, 7.10557012e-10, 8.14539179e-10, 1.68364311e-07, 1.16306562e-09, 8.9512853e-10, 1.64451706e-10, 0.46883016, 9.74274965e-09, 0.99968034, 1.76685303e-09, 1.1195025e-08, 6.68583389e-10, 7.50622645e-10, 1.0911514e-09, 9.0061136e-08, 1.4504338e-09, 1.3700715e-09, 4.88781807e-11, 0.35757744, 1.47326733e-08, 0.99962641, 2.57619952e-09, 1.67806021e-08, 8.98831324e-10, 1.10094349e-09, 1.79450755e-09, 4.815541e-08, 2.35225983e-09, 1.90197166e-09, 2.18009689e-10, 0.25816342, 2.13066366e-08, 0.99956207, 3.63721289e-09, 2.54776402e-08, 1.25956482e-09, 1.39200225e-09, 2.56639385e-09, 2.6112679e-08, 3.54183626e-09, 2.85003179e-09, 5.06752643e-12, 0.177443, 3.36467843e-08, 0.9994851, 5.57139333e-09, 4.01755982e-08, 1.72860822e-09, 2.07133156e-09, 4.20668788e-09, 1.48327722e-08, 5.41330852e-09, 4.20282349e-09, 1.01987886e-10, 0.11705774, 5.15420619e-08, 0.99939278, 7.59505933e-09, 6.08319546e-08, 2.46365498e-09, 2.9741811e-09, 6.21693459e-09, 9.5006228e-09, 7.95757851e-09, 6.15769682e-09, 6.4548097e-11, 0.07474341, 7.35020907e-08, 0.99928175, 1.12369951e-08, 8.84995679e-08, 3.73662366e-09, 4.52783418e-09, 9.69232779e-09, 7.49260578e-09, 1.20845322e-08, 9.15961453e-09, 1.71615809e-10, 0.04652947, 1.10761381e-07, 0.99914787, 1.61083606e-08, 1.28436424e-07, 5.29853829e-09, 6.46130138e-09, 1.45137612e-08, 7.71075812e-09, 1.80775743e-08, 1.39317179e-08, 8.26944414e-11, 0.02839789, 1.5852445e-07, 0.998986, 2.24205109e-08, 1.7885145e-07, 7.29393315e-09, 9.4252711e-09, 2.10734634e-08, 9.37603705e-09, 2.62343023e-08, 2.00878862e-08, 1.76028856e-10, 0.01705955, 2.34842243e-07, 0.99878976, 3.37529056e-08, 2.65940093e-07, 1.07425209e-08, 1.36145764e-08, 3.19148861e-08, 1.32097337e-08, 3.94704799e-08, 2.99230576e-08, 4.13266059e-10, 0.01011425, 3.49048978e-07, 0.99855124, 5.07819875e-08, 3.96891111e-07, 1.62089583e-08, 2.06603552e-08, 4.8773496e-08, 1.90622435e-08, 5.92313559e-08, 4.51187163e-08, 4.89741787e-10, 0.00592842, 5.23690075e-07, 0.99826054, 7.6658465e-08, 5.94915011e-07, 2.39966259e-08, 3.02529212e-08, 7.37921303e-08, 2.84405344e-08, 8.83228263e-08, 6.68805789e-08, 7.8263033e-10, 0.00343924, 7.36768659e-07, 0.99790532, 1.08852922e-07, 8.4669668e-07, 3.3958033e-08, 4.3139627e-08, 1.06893249e-07, 4.00466003e-08, 1.28983785e-07, 9.64246357e-08, 7.19668806e-10, 0.00197606, 1.08904963e-06, 0.99747011, 1.67373995e-07, 1.27225661e-06, 5.10289227e-08, 6.41448048e-08, 1.60197971e-07, 5.8676551e-08, 1.92030106e-07, 1.40662759e-07, 7.17185129e-10, 0.00112496, 1.52082091e-06, 0.99693554, 2.28256653e-07, 1.73667203e-06, 7.06215699e-08, 8.9692369e-08, 2.22884275e-07, 8.26151889e-08, 2.75333433e-07, 2.03903278e-07, 5.88997761e-10, 0.00063471, 2.28800255e-06, 0.99627722, 3.31218948e-07, 2.53517324e-06, 9.96308392e-08, 1.33484157e-07, 3.2063777e-07, 1.23467358e-07, 4.01777282e-07, 2.95674095e-07, 5.21588327e-10, 0.00035497, 3.29516471e-06, 0.99546448, 4.6999311e-07, 3.66530332e-06, 1.40081823e-07, 1.9275058e-07, 4.55620038e-07, 1.82114859e-07, 5.81381155e-07, 4.28781974e-07, 3.57481548e-10, 0.00019679, 4.79550436e-06, 0.99445863, 7.01920384e-07, 5.36788548e-06, 2.05733283e-07, 2.82036534e-07, 6.72222841e-07, 2.64703498e-07, 8.46063509e-07, 6.21957141e-07, 6.19344039e-10, 0.00010816, 6.99852876e-06, 0.99321085, 1.00215496e-06, 7.8814148e-06, 2.93709046e-07, 4.07627043e-07, 9.63218863e-07, 3.87206141e-07, 1.23476292e-06, 9.03113348e-07, 4.12599591e-10, 0.00005893, 0.00001016, 0.99165945, 1.45010365e-06, 0.00001164, 4.25517922e-07, 6.07111783e-07, 1.39534471e-06, 5.65171713e-07, 1.80145191e-06, 1.31074487e-06, 4.63742072e-10, 0.00003183, 0.00001481, 0.98972646, 2.1648259e-06, 0.00001698, 6.38879619e-07, 8.92949923e-07, 2.06168633e-06, 8.17623401e-07, 2.63161851e-06, 1.90650428e-06, 2.64108762e-10, 0.00001705, 0.00001981, 0.98731332, 2.88638612e-06, 0.00002272, 8.52664577e-07, 1.21903964e-06, 2.79724462e-06, 1.1299075e-06, 3.68976103e-06, 2.69330317e-06, 6.0765781e-10, 9.05259688e-06, 0.00002768, 0.98429559, 3.98318135e-06, 0.00003214, 1.17282966e-06, 1.7296226e-06, 3.88383521e-06, 1.60730763e-06, 5.24013149e-06, 3.86028895e-06, 3.35961205e-10, 4.76552316e-06, 0.0000425, 0.9805164, 5.93178823e-06, 0.00005016, 1.72058857e-06, 2.65185189e-06, 5.72362107e-06, 2.45234616e-06, 7.73583408e-06, 5.59322601e-06, 0, 2.48710196e-06, 0.00006237, 0.9757786, 8.65346146e-06, 0.00007323, 2.49267807e-06, 3.85711559e-06, 8.25417807e-06, 3.58324091e-06, 0.00001122, 8.08235506e-06, 2.6087228e-11, 1.28687561e-06, 0.00009728, 0.96983559, 0.00001319, 0.00011261, 4.00660773e-06, 5.78975151e-06, 0.0000125, 5.4776373e-06, 0.00001667, 0.00001202, 0, 6.60416357e-07, 0.00014123, 0.96238093, 0.0000193, 0.00016648, 5.82124334e-06, 8.40035414e-06, 0.00001845, 8.07640106e-06, 0.00002433, 0.00001761, 1.09385687e-09, 3.35662254e-07, 0.00019815, 0.95303752, 0.00002766, 0.00023763, 8.22693266e-06, 0.00001198, 0.0000266, 0.00001146, 0.00003499, 0.00002548, 0, 1.69564207e-07, 0.00027125, 0.9413475, 0.00003951, 0.00033165, 0.00001174, 0.00001747, 0.00003844, 0.00001601, 0.00005025, 0.00003657, 4.58662318e-10, 8.49450867e-08, 0.00042198, 0.92676517, 0.00006674, 0.00053542, 0.0000197, 0.00002657, 0.00006326, 0.0000248, 0.0000768, 0.00005418, 2.34800681e-10, 4.22409757e-08, 0.0006754, 0.90865701, 0.00010064, 0.00083133, 0.00002931, 0.00004023, 0.00009503, 0.00003869, 0.00011559, 0.00008105, 4.808013e-10, 2.07622393e-08, 0.00095934, 0.88631421, 0.00015111, 0.00123397, 0.00004443, 0.00005932, 0.00014219, 0.00005549, 0.00017175, 0.00011838, 1.96907342e-09, 1.05903375e-08, 0.00134763, 0.85898555, 0.00020995, 0.00170263, 0.00006243, 0.00008463, 0.0002018, 0.00007876, 0.00024853, 0.00017201, 0, 5.02859868e-09, 0.00188808, 0.8259391, 0.00030988, 0.00244691, 0.00009033, 0.00012465, 0.00029836, 0.00011124, 0.00036471, 0.00024925, 0, 2.49381931e-09, 0.00290693, 0.78655965, 0.00045557, 0.00363245, 0.00013538, 0.00018587, 0.00044122, 0.00016717, 0.00054159, 0.00037733, 0, 1.23546611e-09, 0.00401195, 0.74048208, 0.00065298, 0.00510187, 0.00019258, 0.00026549, 0.0006352, 0.00023575, 0.0007852, 0.00054381, 0, 8.85452283e-10, 0.00589575, 0.68774744, 0.00091622, 0.00718961, 0.00026852, 0.00037866, 0.00089737, 0.00034592, 0.00113074, 0.0008004, 1.10767753e-09, 6.90720167e-10, 0.0085661, 0.62894938, 0.00136282, 0.01049148, 0.00039632, 0.00054015, 0.00134312, 0.00049603, 0.001648, 0.00117159, 5.67047757e-10, 6.62994154e-10, 0.01327457, 0.56532081, 0.00203529, 0.01551636, 0.00059138, 0.00080278, 0.00198951, 0.0007421, 0.00243182, 0.00174158, 0, 9.50329084e-10, 0.01844692, 0.49870706, 0.00284606, 0.02147791, 0.00082761, 0.00114112, 0.00281343, 0.0010501, 0.00349324, 0.00254186, 8.91627527e-10, 1.29732577e-09, 0.02604811, 0.43139632, 0.00399477, 0.02950678, 0.0011607, 0.00161536, 0.00397655, 0.00147562, 0.00498343, 0.0037081, 0, 1.94496215e-09, 0.03602808, 0.36582613, 0.00557183, 0.04087394, 0.00162999, 0.00227427, 0.00559514, 0.00209389, 0.00710133, 0.00530205, 1.09044265e-09, 2.57418321e-09, 0.05521769, 0.30424058, 0.00836212, 0.06184028, 0.0024238, 0.00347022, 0.00833039, 0.00317945, 0.01047344, 0.00776507, 7.97463989e-10, 3.72959035e-09, 0.08109166, 0.24839365, 0.01274489, 0.09161095, 0.00365131, 0.00516759, 0.01253135, 0.00484469, 0.01552508, 0.011387, 1.55131849e-09, 5.32049997e-09, 0.10703382, 0.1993775, 0.0180254, 0.12577336, 0.00528917, 0.00724894, 0.01782527, 0.00667572, 0.02209274, 0.01615897, 1.42112596e-09, 7.76709664e-09, 0.15200314, 0.157618, 0.02673472, 0.17531279, 0.00799731, 0.01068041, 0.0261942, 0.00981348, 0.03219927, 0.02337335, 2.78165522e-09, 1.15815973e-08, 0.20504956, 0.1229589, 0.03908722, 0.23581092, 0.01178652, 0.01553066, 0.03794063, 0.0141064, 0.04629856, 0.03344105, 4.46916511e-09, 1.69670607e-08, 0.28637154, 0.09484861, 0.05658349, 0.31391435, 0.01700308, 0.02267998, 0.05433295, 0.02106862, 0.06643271, 0.04857312, 6.72905026e-09, 2.46169344e-08, 0.3701889, 0.07249745, 0.0810128, 0.40217211, 0.02501554, 0.03260265, 0.07744906, 0.03091057, 0.09413629, 0.06967678, 1.04720967e-08, 3.58012005e-08, 0.47004393, 0.05505394, 0.1169581, 0.50370538, 0.03666924, 0.048641, 0.11167012, 0.04608351, 0.13392703, 0.09927136, 1.63531801e-08, 5.19695362e-08, 0.55025672, 0.04162143, 0.1547053, 0.58360123, 0.04987518, 0.06683289, 0.149524, 0.06295546, 0.18137195, 0.13589978, 2.49643421e-08, 7.54563552e-08, 0.63987621, 0.03152254, 0.21119664, 0.67151718, 0.07140715, 0.09527003, 0.2056304, 0.08958549, 0.24372154, 0.18571998, 3.7976053e-08, 1.0947863e-07, 0.72464615, 0.02409963, 0.28106836, 0.75465474, 0.10092251, 0.1354907, 0.27482402, 0.12679202, 0.31956273, 0.25261785, 5.7120819e-08, 1.58889438e-07, 0.78882168, 0.01879532, 0.35584817, 0.81341064, 0.13775332, 0.18303533, 0.35141988, 0.17423386, 0.40359569, 0.32726123, 8.59160897e-08, 2.30315458e-07, 0.84175201, 0.01524968, 0.43467361, 0.86000561, 0.18032933, 0.24038597, 0.43145674, 0.23364244, 0.49165237, 0.40996836, 1.27321671e-07, 3.34094936e-07, 0.88828043, 0.01335993, 0.52633508, 0.90083635, 0.24229711, 0.32081613, 0.52231116, 0.30951552, 0.58361195, 0.50382484, 1.88070515e-07, 4.84891512e-07, 0.91935102, 0.01284764, 0.61408446, 0.92919254, 0.31977243, 0.4067563, 0.61163115, 0.39581671, 0.66947244, 0.59598241, 2.7641497e-07, 7.03686624e-07, 0.94199596, 0.01422609, 0.70148816, 0.9499414, 0.40430081, 0.49654733, 0.69800708, 0.48542594, 0.74700264, 0.68270922, 4.05558585e-07, 1.02245273e-06, 0.96257868, 0.01794755, 0.78326008, 0.96678313, 0.505384, 0.59920295, 0.77877963, 0.59162694, 0.81456378, 0.76202682, 5.92591533e-07, 1.48582659e-06, 0.9739224, 0.02365285, 0.84389339, 0.97747397, 0.60580777, 0.68775638, 0.83998642, 0.68129064, 0.86628663, 0.82422081, 8.62429913e-07, 2.1618385e-06, 0.98227007, 0.03307264, 0.89157504, 0.98479493, 0.70222605, 0.76426141, 0.8880247, 0.76008102, 0.90580978, 0.87402486, 1.25154054e-06, 3.14758785e-06, 0.98786021, 0.04750416, 0.92549055, 0.98978582, 0.77837, 0.8275032, 0.92208116, 0.82462783, 0.9346165, 0.91085487, 1.80946523e-06, 4.58588524e-06, 0.99160132, 0.06531062, 0.94597525, 0.99290561, 0.83245353, 0.87437267, 0.94430906, 0.87238078, 0.95409795, 0.93771068, 2.60806597e-06, 6.68979079e-06, 0.99471173, 0.09897421, 0.96508913, 0.99557884, 0.88574543, 0.91570854, 0.96332798, 0.91389502, 0.96937479, 0.95783877, 3.74737287e-06, 9.76674765e-06, 0.99637103, 0.13971332, 0.97636789, 0.99702129, 0.92168561, 0.94236581, 0.97503782, 0.93951905, 0.97940406, 0.97108252, 5.37133181e-06, 0.00001427, 0.99758149, 0.19271911, 0.98375011, 0.99796556, 0.94631969, 0.96124587, 0.9828604, 0.95852479, 0.9860699, 0.98022953, 7.68857208e-06, 0.00002086, 0.9982443, 0.24234658, 0.98785551, 0.99845559, 0.95980982, 0.97158382, 0.9874512, 0.96934329, 0.99015737, 0.98629984, 0.000011, 0.00003052, 0.99876011, 0.31391566, 0.99141654, 0.99891908, 0.97175509, 0.98033443, 0.99119325, 0.97821017, 0.99317623, 0.99056872, 0.00001576, 0.00004468, 0.99914725, 0.39874626, 0.99415953, 0.99925697, 0.98043167, 0.98663334, 0.99395703, 0.98525909, 0.99531235, 0.99354035, 0.00002264, 0.00006544, 0.99940564, 0.49125118, 0.99602915, 0.99948881, 0.98642367, 0.99064341, 0.99587602, 0.98979236, 0.99679442, 0.99559065, 0.00003261, 0.00009589, 0.99959294, 0.58413916, 0.99722987, 0.99965297, 0.99040933, 0.99364815, 0.9971155, 0.99296025, 0.99778367, 0.99693854, 0.00004718, 0.0001406, 0.99972745, 0.67396785, 0.99808341, 0.99976283, 0.99345342, 0.99565699, 0.99802036, 0.99521437, 0.99847123, 0.99792899, 0.00006858, 0.0002062, 0.99981209, 0.75482594, 0.99870633, 0.9998387, 0.99555041, 0.99700081, 0.99864691, 0.99673531, 0.9989665, 0.99858522, 0.00010018, 0.00030246, 0.99986333, 0.81235263, 0.99909208, 0.9998849, 0.9968556, 0.99785326, 0.99906162, 0.9976802, 0.99927783, 0.99901218, 0.0001471, 0.00044376, 0.99990842, 0.86519023, 0.99939113, 0.99992149, 0.99788521, 0.99852855, 0.99936921, 0.99841924, 0.99950552, 0.99932118, 0.00021705, 0.000651, 0.9999366, 0.90166763, 0.9995658, 0.99994656, 0.99850492, 0.99897147, 0.99955466, 0.99889624, 0.99965584, 0.99952754, 0.00032162, 0.00095468, 0.99995405, 0.92816191, 0.99969209, 0.99996242, 0.99893373, 0.99928219, 0.99968777, 0.9992061, 0.99975871, 0.99966603, 0.00047811, 0.0014005, 0.99996851, 0.95096402, 0.9998024, 0.99997478, 0.99931302, 0.99950729, 0.99979526, 0.99945707, 0.99983514, 0.99976845, 0.00071196, 0.00205419, 0.99998024, 0.9674806, 0.99986677, 0.99998358, 0.99954215, 0.99967371, 0.99986172, 0.99964817, 0.99988813, 0.99984261, 0.00106017, 0.00301064, 0.99998598, 0.97815621, 0.9999119, 0.9999889, 0.99970105, 0.99977335, 0.99990819, 0.9997524, 0.99992376, 0.99989098, 0.0015758, 0.00441055, 0.99999077, 0.98539611, 0.99994061, 0.99999262, 0.99979595, 0.99984705, 0.99993814, 0.99983797, 0.99994825, 0.99992544, 0.00233401, 0.00645665, 0.99999356, 0.98986043, 0.99995981, 0.99999488, 0.99986329, 0.9998937, 0.99995846, 0.99988707, 0.99996458, 0.99994847, 0.00344021, 0.00944627, 0.99999551, 0.99294827, 0.99997199, 0.99999644, 0.99990739, 0.99992645, 0.99997127, 0.99992159, 0.99997555, 0.99996461, 0.00504153, 0.01380178, 0.99999691, 0.99509214, 0.99998051, 0.99999752, 0.99993691, 0.9999491, 0.99998018, 0.99994558, 0.99998312, 0.99997592, 0.00734323, 0.02011906, 0.99999795, 0.99668362, 0.99998667, 0.99999832, 0.99995651, 0.99996513, 0.99998645, 0.99996352, 0.99998846, 0.99998335, 0.01063289, 0.02924843, 0.99999858, 0.99766245, 0.99999073, 0.99999882, 0.99996983, 0.99997576, 0.99999067, 0.99997477, 0.99999203, 0.9999886, 0.01531608, 0.04234351, 0.99999902, 0.99839239, 0.99999363, 0.9999992, 0.99997911, 0.99998351, 0.99999357, 0.99998269, 0.99999454, 0.99999221, 0.02196796, 0.06092364, 0.99999932, 0.9988692, 0.99999556, 0.99999944, 0.99998532, 0.99998882, 0.99999551, 0.99998799, 0.99999627, 0.99999458, 0.03140348, 0.08693451, 0.99999954, 0.99922026, 0.99999682, 0.9999996, 0.99998946, 0.99999218, 0.9999968, 0.99999172, 0.99999743, 0.99999628, 0.04476371, 0.12262893, 0.9999997, 0.99946133, 0.99999776, 0.99999972, 0.99999263, 0.99999461, 0.99999776, 0.9999944, 0.99999822, 0.99999751, 0.06360092, 0.17024298, 0.99999979, 0.99963201, 0.99999845, 0.99999981, 0.99999485, 0.99999624, 0.99999845, 0.99999616, 0.99999877, 0.99999829, 0.08991735, 0.23148509, 0.99999985, 0.99974797, 0.99999894, 0.99999987, 0.99999639, 0.99999742, 0.99999893, 0.99999735, 0.99999915, 0.99999882] @@ -86,7 +96,7 @@ "names": { "type": "character", "attributes": {}, - "value": ["prey", "w_prey"] + "value": ["sp", "w"] } }, "value": [ @@ -101,6 +111,21 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Predation mortality"] + }, + "units": { + "type": "character", + "attributes": {}, + "value": ["1/year"] } }, "value": [8636.11518838, 155936.75819189, 12011.83670094, 15295.06220908, 23102.61431469, 18229.22017149, 14352.79860425, 14479.58806049, 18646.88573464, 22454.35426719, 23887.82966476, 4028.06135169, 10184.09506557, 185528.93813555, 14172.34706228, 17936.05255692, 27381.29364541, 21544.87798605, 17004.76741575, 17121.24936671, 22084.37699671, 26577.73402706, 28267.44710679, 4741.56219829, 11951.98900357, 219252.93256094, 16629.97965972, 20937.20592541, 32256.59848161, 25319.99543439, 20027.04281107, 20128.97132173, 26001.32593173, 31271.6634151, 33255.40799449, 5552.63833363, 13955.41858123, 257341.02657929, 19401.60960057, 24319.74989473, 37763.62018199, 29581.47007256, 23441.73820823, 23524.03284074, 30426.28104053, 36568.44988268, 38887.29863896, 6466.80322114, 16207.91043468, 299960.28757659, 22499.53155521, 28099.71940856, 43928.70728588, 34349.43523927, 27265.68003268, 27322.25783849, 35380.91448654, 42491.53505931, 45189.72605754, 7488.05817635, 18720.76896193, 347194.48174424, 25930.22788876, 32286.68749229, 50767.26415513, 39635.5477444, 31509.12540401, 31532.60982364, 40878.34411838, 49053.08401833, 52178.03580184, 8618.48307036, 21503.63869638, 399026.13349214, 29693.20427677, 36882.76271709, 58281.90545392, 45441.53658516, 36174.7691269, 36155.96049199, 46921.81593256, 56251.66600396, 59854.36265071, 9857.84538995, 24566.0531589, 455319.68592383, 33779.98249576, 41882.02895588, 66461.22571308, 51758.2077549, 41257.22555481, 41184.17547333, 53503.98216392, 64070.18497507, 68206.26778765, 11203.25575218, 27920.15070449, 515806.8269462, 38173.33751002, 47270.56682987, 75279.39865379, 58565.06822037, 46743.13098529, 46599.64096435, 60606.96105671, 72474.22018663, 77206.17600345, 12648.89780998, 31584.51564557, 580075.09453889, 42846.85062412, 53027.11670361, 84696.71750488, 65830.65677043, 52611.92547309, 52375.30611304, 68203.2566928, 81410.92011265, 86811.7308785, 14185.85669939, 35588.83551381, 647560.85499934, 47764.82668404, 59124.34204672, 94661.05377395, 73513.5714895, 58837.2631768, 58475.25123383, 76257.48066343, 90808.56222924, 96967.06120067, 15802.0638549, 39978.87587017, 717547.65458621, 52882.60108969, 65530.57501944, 105110.10776274, 81564.10689295, 65388.91718311, 64855.73999179, 84728.71351308, 100576.85883466, 107604.85376041, 17482.3697536, 44821.32566357, 789170.77963308, 58147.25554056, 72211.93417402, 115974.32991063, 89926.41705515, 72235.05441483, 71466.71332106, 93573.35512992, 110608.07259403, 118649.13090482, 19208.75356796, 50208.52291877, 861428.63091343, 63498.78431449, 79134.85895083, 127180.58944154, 98541.26413021, 79344.92583026, 78253.77350647, 102748.52308929, 120779.02323359, 130018.81188204, 20960.68360992, 56264.05710744, 933201.23813931, 68871.81681937, 86269.45453372, 138657.11859436, 107349.74050761, 86692.39808733, 85160.91904472, 112216.53038084, 130954.13364781, 141632.55365916, 22715.6578677, 63151.80008965, 1003275.92681249, 74198.11163108, 93594.5993811, 150340.9881902, 116298.88312908, 94261.36220863, 92134.63518994, 121951.73022747, 140989.78602178, 153416.03956254, 24449.98112782, 71092.90484527, 1070379.81790154, 79410.1817008, 101106.48625458, 162190.30785568, 125350.78230938, 102054.83799249, 99130.39017132, 131951.98806942, 150740.42397478, 165313.75193983, 26139.87144425, 80397.2308094, 1133218.49566419, 84446.54835727, 108832.95993514, 174204.2469173, 134497.44566739, 110110.34774832, 106123.01513203, 142257.97781222, 160066.99326742, 177308.10030326, 27763.02321849, 91516.38672169, 1190519.80001579, 89259.15756219, 116856.26209607, 186454.28698909, 143783.9059869, 118524.40397946, 113122.59024999, 152983.83471897, 168848.34046993, 189449.064506, 29300.76172558, 105123.2530759, 1241081.2330189, 93823.26474456, 125345.89386563, 199128.91738358, 153341.18158149, 127487.97960632, 120196.87282577, 164361.48149668, 176995.8816746, 201896.39023347, 30740.86217322, 122215.18574474, 1283818.84006237, 98149.40855872, 134600.40771315, 212590.14474293, 163427.88583006, 137331.68044583, 127499.44224089, 176797.0256481, 184470.96261666, 214972.79398305, 32080.92361213, 144223.61391848, 1317814.59241359, 102295.82059083, 145091.48166081, 227432.9682406, 174473.99712135, 148573.40835912, 135299.24424529, 190930.24684298, 191302.69414315, 229219.90737266, 33331.85035763, 173092.59466843, 1342358.33327497, 106377.86027697, 157496.05008648, 244528.95298624, 187112.96743401, 161953.06738235, 144002.37454395, 207677.94717456, 197601.79551725, 245439.35813991, 34520.52833877, 211268.66481528, 1356979.52548866, 110569.3101234, 172694.66977202, 265024.99742189, 202181.00224417, 178430.60992832, 154152.09310471, 228231.66814832, 203563.73778066, 264692.03763587, 35690.32013253, 261534.24516017, 1361463.83115766, 115089.50488272, 191710.52516951, 290263.40852329, 220658.6994934, 199119.61662004, 166390.65772402, 253975.17461904, 209453.38880115, 288223.9673274, 36897.77558636, 326629.02723499, 1355850.51508533, 120171.35611368, 215568.08158786, 321595.49672925, 243534.70083316, 225133.60532122, 181369.52004652, 286293.33026067, 215564.77220615, 317292.86202141, 38204.24438308, 408646.61466703, 1340409.16337799, 126009.10055841, 245066.53819225, 360082.25598173, 271586.64030511, 257339.80593679, 199604.75673094, 326265.81261691, 222154.39836821, 352889.38396024, 39662.07567832, 508265.26829751, 1315598.12149585, 132690.87707327, 280490.18563026, 406111.33881595, 305100.76746534, 296044.42576241, 221291.84609492, 374275.55319861, 229354.68706492, 395380.29096133, 41296.75291663, 623955.60480044, 1282011.57954596, 140128.5982732, 321309.39996019, 459001.35987027, 343582.23706919, 340667.79732625, 246114.12532455, 429604.54396493, 237083.45356259, 444139.6469557, 43088.26229521, 751375.78121914, 1240325.97942115, 148003.52059224, 365951.49417693, 516698.27196556, 385532.73418915, 389495.49858552, 273095.56666274, 490124.1106684, 244973.05879819, 497265.67129221, 44956.56687093, 883183.85406187, 1191257.84035454, 155747.62244677, 411727.88782815, 575678.14299864, 428379.12149197, 439599.39933498, 300553.15318949, 552196.538889, 252345.03218636, 551489.73765292, 46756.51236074, 1009445.22823926, 1135543.11120462, 162576.41704025, 454984.61655762, 631144.97896683, 468618.00014695, 487001.46015325, 326191.73044571, 610878.65771049, 258250.25614222, 602360.11631758, 48286.30681718, 1118689.78538515, 1073942.70035621, 167578.09964692, 491496.85113222, 677550.97565525, 502196.23815115, 527102.73468214, 347354.60775008, 660455.31975142, 261581.08213741, 644725.99329228, 49310.88054922, 1199504.4083909, 1007271.10389008, 169849.22344697, 517064.60691146, 709382.66231928, 525086.09903397, 555331.0281171, 361402.62838087, 695244.88291121, 261242.92800397, 673469.13445145, 49597.54348419, 1242379.52859418, 936437.25497179, 168652.53748879, 528203.9963815, 722073.35028121, 533952.81841152, 567892.38507433, 366154.29003773, 710533.85887999, 256354.26526854, 684353.20425138, 48957.50612348, 1241417.44071106, 862481.40121093, 163562.9488846, 522786.67397025, 712847.1687814, 526772.12276639, 562466.25948494, 360292.84982457, 703441.51325093, 246431.51567859, 674809.39497074, 47284.27202181, 1195498.57776167, 786591.01476069, 154566.5439491, 500475.75993953, 681294.19725716, 503250.95787554, 538679.48036614, 343643.55227814, 673509.30593394, 231514.05104862, 644471.64090222, 44579.63732075, 1108605.1060742, 710083.19832305, 142086.57678761, 462845.30247593, 629527.4420875, 464942.19890304, 498236.26238563, 317248.87831818, 622862.4758963, 212195.95922216, 595322.41651934, 40960.40643991, 989198.08398592, 634349.81714061, 126927.45829835, 413144.33636837, 561870.2113473, 415015.69329628, 444661.93409308, 283216.9725915, 555891.11974598, 189553.14380825, 531401.21387237, 36643.46085477, 848780.74945706, 560772.16388229, 110148.32921692, 355755.42403558, 484139.85264254, 357733.91712053, 382714.59885176, 244375.13722205, 478518.21012362, 164980.62293492, 458137.14785153, 31912.24938285, 699984.43025527, 490621.02806295, 92895.57174451, 295474.22192554, 402695.12265588, 297754.67559049, 317602.24210044, 203809.24146686, 397225.62399381, 139977.60263943, 381461.50264291, 27072.47017987, 554620.4572446, 424962.60410925, 76232.86437708, 236776.77342648, 323467.54376147, 239422.13343982, 254186.45460948, 164395.53638628, 318063.55621384, 115929.74993123, 306905.46378544, 22407.15102102, 422118.5086326, 364589.22368091, 61005.38082121, 183232.5680431, 251185.63232504, 186199.04935126, 196344.52710504, 128425.81446604, 245856.97910548, 93935.4852374, 238877.59802324, 18140.80457147, 308631.95596426, 309987.06952004, 47762.49468978, 137168.79518351, 188931.34847929, 140342.1935888, 146604.50752591, 97393.23428609, 183751.69634075, 74707.45399011, 180250.8529489, 14419.08583418, 216887.46758499, 261343.32798273, 36745.68219709, 99614.77920995, 138067.02918736, 102848.97004181, 106084.7104838, 71957.29676562, 133139.16084527, 58557.67336813, 132294.71833964, 11305.71656887, 146660.92345013, 218586.00382083, 27931.20794584, 70482.14098842, 98474.03180853, 73632.1967699, 74689.39871155, 52059.52371219, 93899.9876003, 45452.98687705, 94897.76209722, 8793.89761577, 95634.76400667, 181443.67479576, 21106.19252306, 48888.5138398, 68981.20211422, 51833.80680268, 51460.46908652, 37130.90907714, 64841.54342957, 35113.34162748, 66967.00088491, 6826.5378056, 60360.06595485, 149511.04788784, 15953.77759109, 33520.68466868, 47845.51082021, 36176.7543291, 34972.00486168, 26324.58175834, 44188.86549669, 27121.82305183, 46875.84275008, 5318.86371875, 37098.19073119, 122308.72350146, 12127.94010089, 22952.47617382, 33172.812675, 25273.09913029, 23675.59642654, 18719.56262491, 30014.34246306, 21021.31386653, 32856.28515705, 4178.28108011, 22414.43636882, 99330.28631362, 9306.37185643, 15869.22132575, 23215.18450714, 17841.70103895, 16144.24560312, 13464.77796612, 20541.20913108, 16383.17925858, 23276.06382328, 3318.38187155, 13496.73351456, 80074.80281119, 7219.61359103, 11188.85418731, 16531.43245011, 12825.86498491, 11203.79560283, 9857.02467244, 14307.14355877, 12845.26871325, 16788.42202773, 2666.69971885, 8244.74309964, 64066.29746039, 5659.51426583, 8096.28881428, 12033.12593598, 9426.9263254, 7970.36632451, 7363.35766454, 10210.87539189, 10123.6175394, 12375.04881186, 2166.93438897, 5208.48876948, 50863.7279613, 4474.9586104, 6021.37054509, 8955.69386028, 7083.47543025, 5826.17965388, 5607.50379743, 7482.20197433, 8007.51198563, 9319.38741314, 1777.83174397, 3454.42244961, 40064.869781, 3560.83504555, 4589.02915871, 6792.9064547, 5423.06879798, 4365.4512389, 4338.25953359, 5614.69063911, 6345.71622375, 7145.68177816, 1470.31781081, 2418.19654392, 31307.05344108, 2845.30355926, 3564.39624718, 5224.66616624, 4209.56280789, 3334.79390126, 3394.67246337, 4291.57074925, 5030.86749267, 5551.6889729, 1224.07657744, 1777.25738138, 24266.493239, 2280.10461964, 2805.59601493, 4054.36267979, 3297.55035375, 2581.48450309, 2676.19256982, 3321.47859835, 3986.65660599, 4350.70166819, 1025.16681066, 1355.64288346, 18656.86705704, 1831.07620877, 2227.69716441, 3161.81195949, 2597.59938153, 2014.80673667, 2119.5462093, 2590.26131503, 3156.69635125, 3427.3373688, 863.3748644, 1060.38309612, 14227.67024349, 1473.54286155, 1779.06501905, 2471.76427857, 2053.14104269, 1580.07248939, 1683.75509117, 2028.74093455, 2498.06072258, 2708.48763003, 731.13710162, 843.04349254, 10762.32039833, 1189.24759299, 1427.18201753, 1934.97059584, 1627.20680116, 1242.98668507, 1341.17909535, 1593.28490369, 1977.33673058, 2145.77206286, 622.74541524, 673.75206471, 8075.53191652, 962.96169614, 1148.12578439, 1514.7366615, 1291.53164241, 978.81975699, 1070.47064475, 1252.226061, 1566.59486177, 1702.59324593, 533.3578408, 250.88277763, 77.71207898, 357.84489037, 416.91542209, 342.4333396, 376.5996489, 250.70665498, 337.01472644, 309.86647864, 426.58744621, 491.86930307, 319.50880385, 229.29781601, 71.21447702, 328.18632766, 379.1447512, 314.00257441, 344.61770519, 230.03291594, 308.29469744, 284.23519458, 390.77381737, 450.27695925, 295.1936476, 209.21994499, 65.14835467, 300.40423785, 344.19388832, 287.42364551, 314.82202223, 210.57578199, 281.47165028, 260.2354516, 357.28777039, 411.56434216, 271.94154064, 190.55383047, 59.48144673, 274.56471988, 311.92552849, 262.56424612, 287.15276933, 192.20792397, 256.53356786, 237.72574669, 326.0079814, 375.63021785, 249.84808837, 173.31457626, 54.23791829, 250.76855378, 282.3730865, 239.39018843, 261.76558309, 175.0845178, 233.58418013, 216.74890079, 297.205373, 342.53968584, 229.18720836, 157.29224057, 49.32662922, 228.19428718, 255.00139226, 217.73039967, 238.00565909, 159.03742939, 212.08398539, 197.1019138, 270.10381343, 311.7703699, 209.8641484, 141.38110738, 43.9405666, 194.01273856, 224.87080743, 196.07043006, 210.89192993, 143.72126099, 187.05164064, 177.501125, 235.78463811, 277.91127606, 187.15442352, 127.81580272, 39.80215487, 175.96610258, 202.36051801, 177.56135099, 191.09288963, 129.79382668, 169.25221871, 160.68453949, 213.53201785, 252.31636702, 171.3170819, 115.29262947, 35.96974114, 159.40994075, 181.7775623, 160.36550115, 172.78765275, 116.92154808, 152.82026135, 145.09082329, 193.04675541, 228.74696014, 156.91305078, 103.84967053, 32.46009682, 144.2389799, 163.06011477, 144.70408242, 155.92925563, 105.11897505, 137.72874746, 130.80534685, 174.24710019, 207.19654065, 143.73194423, 93.0929874, 29.17370523, 130.33532919, 145.82983008, 129.85536119, 140.22202157, 94.0002075, 123.73400641, 117.32768494, 156.9929468, 187.05608981, 131.75605372, 83.20283569, 26.15054288, 117.62685823, 130.16340176, 116.22566476, 125.91822079, 83.69252113, 110.91013697, 104.93626685, 141.22796948, 168.4545692, 120.74746463, 52.64945108, 18.24536031, 90.249466, 79.03878284, 70.1385217, 87.55271683, 55.58045823, 81.16164622, 66.70888044, 107.69161575, 122.61352326, 104.02681856, 47.20593304, 16.36658457, 81.69906803, 71.19150828, 62.86114556, 78.93891423, 49.44616653, 72.91368646, 59.70662294, 97.07545908, 110.68707234, 95.2780778, 41.9331076, 14.55994548, 73.45054787, 63.59953245, 55.82935832, 70.52136348, 43.57546772, 64.93092549, 52.96547495, 86.89208261, 99.12086489, 86.77584469, 36.95224168, 12.82328237, 65.37488765, 56.29405787, 49.17846942, 62.47588163, 38.13320248, 57.30660791, 46.60368616, 76.91545092, 87.94738313, 78.38239169, 30.49828223, 10.61131887, 54.73567011, 46.68421094, 40.71461174, 51.19253131, 32.03266467, 41.40752456, 38.98566165, 64.13828785, 73.79854684, 68.95329164, 26.45659448, 9.22817774, 48.14821042, 40.77258716, 35.32334184, 44.72208008, 27.61580429, 36.22316328, 33.79223547, 56.19593738, 64.50751056, 61.3000728, 19.14725005, 7.22670157, 41.72012939, 32.87033762, 25.77481038, 36.47481896, 14.93829001, 30.12241538, 24.2957102, 48.36687985, 52.70236512, 53.62722476, 16.29701813, 6.15733302, 35.81585382, 28.10988272, 21.94677736, 31.30338474, 12.70721867, 25.7910257, 20.69182435, 41.42845101, 44.95873992, 46.3326035, 11.83783375, 4.65723399, 28.25061309, 21.10904588, 16.10501466, 21.46767567, 9.3225206, 19.1883336, 15.31009316, 32.28881876, 34.85074282, 38.78786148, 9.77180302, 3.86271576, 23.59785147, 17.54084447, 13.30605744, 17.82235045, 7.69076347, 15.95862306, 12.651877, 26.94412072, 28.92813822, 32.54316083, 8.00006518, 3.17981111, 19.48465222, 14.43756332, 10.90650773, 14.66878161, 6.29344009, 13.14536874, 10.37847112, 22.27922869, 23.75507568, 26.84457466, 6.44234966, 2.58136353, 15.8642302, 11.71140701, 8.79407177, 11.90247475, 5.06131273, 10.67629389, 8.370606, 18.18753769, 19.21063221, 21.78499561, 5.0982459, 2.05612964, 12.65339019, 9.31795234, 6.96868474, 9.47388712, 4.00275441, 8.50160244, 6.63898136, 14.54527137, 15.23858668, 17.31119287, 3.2157361, 1.45355321, 9.76258752, 6.72785089, 4.28428123, 6.82057954, 2.31796329, 6.32475215, 3.71746318, 11.21721347, 11.17446436, 13.43050468, 2.46824683, 1.13189028, 7.56900462, 5.2112513, 3.29473824, 5.29556043, 1.77211352, 4.90746605, 2.85803606, 8.76678588, 8.60234981, 10.25617668, 1.60869317, 0.57406935, 4.05771494, 2.88320247, 2.08041262, 2.82259738, 1.22393033, 2.63045214, 1.80940455, 4.06336997, 5.27591307, 6.8757346, 1.1749578, 0.41866757, 2.94812093, 2.09991807, 1.51889883, 2.05708757, 0.89395746, 1.91531693, 1.32068893, 2.95430644, 3.84395157, 4.98544682, 0.85146249, 0.30248027, 2.11345939, 1.51302109, 1.0998314, 1.484101, 0.64786235, 1.3792493, 0.95579352, 2.12097693, 2.77162829, 3.55899348, 0.60296271, 0.21320646, 1.47174389, 1.06197356, 0.77789478, 1.04379, 0.45881999, 0.96724752, 0.67546066, 1.48035767, 1.94756396, 2.4619381, 0.42329347, 0.14887672, 1.01319615, 0.73792169, 0.54533647, 0.72700077, 0.32213142, 0.67142538, 0.47307699, 1.02188602, 1.35505452, 1.68145894, 0.28274259, 0.09911011, 0.66842763, 0.4897269, 0.36394381, 0.48320175, 0.21518278, 0.44531157, 0.31553208, 0.67533483, 0.90003865, 1.10358555, 0.18183303, 0.06350518, 0.42403692, 0.31272734, 0.23383135, 0.30906874, 0.13839358, 0.28416466, 0.20259596, 0.42924955, 0.57526768, 0.69605259, 0.09087201, 0.03306913, 0.24525907, 0.1689701, 0.11813089, 0.16406697, 0.0691139, 0.1546899, 0.10310168, 0.24345827, 0.30779748, 0.42600539, 0.04058406, 0.0154408, 0.12635345, 0.08186055, 0.05339988, 0.07811986, 0.03084201, 0.07547996, 0.04698072, 0.12332687, 0.1477061, 0.22967589, 0.02314418, 0.00828018, 0.05890562, 0.04168112, 0.02995092, 0.04076055, 0.01760785, 0.03804472, 0.02606113, 0.05891728, 0.07622548, 0.1001571, 0.0071337, 0.00267924, 0.02133669, 0.01405698, 0.00935309, 0.01347998, 0.00542257, 0.01293558, 0.00820954, 0.02092007, 0.02543146, 0.03832497, 0.00315186, 0.00106739, 0.00651412, 0.00510275, 0.00402129, 0.00511643, 0.00240012, 0.0046078, 0.0034653, 0.00671494, 0.00946249, 0.01010576, 4.77012702e-15, 1.40504697e-15, 4.59268998e-15, 5.71968255e-15, 5.88498967e-15, 6.22596662e-15, 3.64015775e-15, 4.97152903e-15, 4.95180143e-15, 5.59242596e-15, 1.11142033e-14, 2.95247031e-15] @@ -195,6 +220,21 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Fishing mortality"] + }, + "units": { + "type": "character", + "attributes": {}, + "value": ["1/year"] } }, "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5] @@ -216,7 +256,7 @@ "names": { "type": "character", "attributes": {}, - "value": ["prey", "w_prey"] + "value": ["sp", "w"] } }, "value": [ @@ -231,6 +271,21 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Total mortality"] + }, + "units": { + "type": "character", + "attributes": {}, + "value": ["1/year"] } }, "value": [8636.30224795, 155936.93990395, 12011.96596703, 15295.14868644, 23102.70167274, 18229.27675968, 14352.86155177, 14479.65669762, 18646.92744785, 22454.39111746, 23887.84723066, 4028.078946, 10184.28212514, 185529.11984761, 14172.47632836, 17936.13903429, 27381.38100346, 21544.93457425, 17004.83036327, 17121.31800383, 22084.41870992, 26577.77087733, 28267.46467269, 4741.5797926, 11952.17606314, 219253.114273, 16630.1089258, 20937.29240277, 32256.68583966, 25320.05202259, 20027.10575859, 20129.03995886, 26001.36764494, 31271.70026537, 33255.42556039, 5552.65592794, 13955.6056408, 257341.20829135, 19401.73886665, 24319.8363721, 37763.70754004, 29581.52666076, 23441.80115575, 23524.10147787, 30426.32275374, 36568.48673295, 38887.31620486, 6466.82081545, 16208.09749425, 299960.46928865, 22499.66082129, 28099.80588592, 43928.79464392, 34349.49182746, 27265.7429802, 27322.32647562, 35380.95619975, 42491.57190958, 45189.74362344, 7488.07577066, 18720.95602151, 347194.6634563, 25930.35715484, 32286.77396965, 50767.35151318, 39635.6043326, 31509.18835152, 31532.67846077, 40878.38583159, 49053.1208686, 52178.05336774, 8618.50066467, 21503.82575595, 399026.3152042, 29693.33354285, 36882.84919445, 58281.99281196, 45441.59317335, 36174.83207442, 36156.02912912, 46921.85764577, 56251.70285423, 59854.38021661, 9857.86298425, 24566.24021847, 455319.86763589, 33780.11176185, 41882.11543324, 66461.31307113, 51758.26434309, 41257.28850233, 41184.24411046, 53504.02387713, 64070.22182534, 68206.28535355, 11203.27334648, 27920.33776406, 515807.00865826, 38173.4667761, 47270.65330723, 75279.48601183, 58565.12480856, 46743.19393281, 46599.70960148, 60607.00276992, 72474.2570369, 77206.19356935, 12648.91540429, 31584.70270515, 580075.27625095, 42846.9798902, 53027.20318097, 84696.80486293, 65830.71335863, 52611.98842061, 52375.37475016, 68203.29840601, 81410.95696292, 86811.7484444, 14185.87429369, 35589.02257338, 647561.0367114, 47764.95595012, 59124.42852408, 94661.141132, 73513.62807769, 58837.32612432, 58475.31987095, 76257.52237664, 90808.59907951, 96967.07876657, 15802.0814492, 39979.06292974, 717547.83629827, 52882.73035577, 65530.6614968, 105110.19512078, 81564.16348115, 65388.98013063, 64855.80862891, 84728.75522629, 100576.89568493, 107604.87132631, 17482.38734791, 44821.51272314, 789170.96134514, 58147.38480664, 72212.02065138, 115974.41726868, 89926.47364334, 72235.11736235, 71466.78195819, 93573.39684313, 110608.1094443, 118649.14847072, 19208.77116226, 50208.70997835, 861428.81262549, 63498.91358057, 79134.94542819, 127180.67679959, 98541.3207184, 79344.98877778, 78253.8421436, 102748.5648025, 120779.06008386, 130018.82944794, 20960.70120422, 56264.24416701, 933201.41985137, 68871.94608546, 86269.54101108, 138657.20595241, 107349.7970958, 86692.46103485, 85160.98768185, 112216.57209405, 130954.17049808, 141632.57122506, 22715.67546201, 63151.98714922, 1003276.10852455, 74198.24089716, 93594.68585846, 150341.07554825, 116298.93971727, 94261.42515615, 92134.70382706, 121951.77194068, 140989.82287205, 153416.05712844, 24449.99872213, 71093.09190484, 1070379.9996136, 79410.31096688, 101106.57273194, 162190.39521372, 125350.83889758, 102054.90094001, 99130.45880845, 131952.02978263, 150740.46082505, 165313.76950573, 26139.88903855, 80397.41786897, 1133218.67737625, 84446.67762335, 108833.04641251, 174204.33427535, 134497.50225559, 110110.41069584, 106123.08376915, 142258.01952543, 160067.03011769, 177308.11786916, 27763.0408128, 91516.57378127, 1190519.98172785, 89259.28682828, 116856.34857343, 186454.37434714, 143783.96257509, 118524.46692698, 113122.65888712, 152983.87643218, 168848.3773202, 189449.0820719, 29300.77931988, 105123.44013548, 1241081.41473096, 93823.39401065, 125345.98034299, 199129.00474162, 153341.23816969, 127488.04255384, 120196.9414629, 164361.52320989, 176995.91852487, 201896.40779937, 30740.87976752, 122215.37280431, 1283819.02177443, 98149.5378248, 134600.49419051, 212590.23210098, 163427.94241825, 137331.74339335, 127499.51087802, 176797.06736131, 184470.99946693, 214972.81154895, 32080.94120644, 144223.80097805, 1317814.77412565, 102295.94985692, 145091.56813817, 227433.05559864, 174474.05370955, 148573.47130664, 135299.31288242, 190930.28855619, 191302.73099342, 229219.92493856, 33331.86795193, 173092.781728, 1342358.51498703, 106377.98954306, 157496.13656384, 244529.04034428, 187113.0240222, 161953.13032987, 144002.44318108, 207677.98888777, 197601.83236752, 245439.37570581, 34520.54593308, 211268.85187485, 1356979.70720072, 110569.43938948, 172694.75624938, 265025.08477993, 202181.05883236, 178430.67287584, 154152.16174183, 228231.70986153, 203563.77463093, 264692.05520177, 35690.33772684, 261534.43221974, 1361464.01286972, 115089.6341488, 191710.61164687, 290263.49588134, 220658.7560816, 199119.67956756, 166390.72636115, 253975.21633225, 209453.42565142, 288223.9848933, 36897.79318066, 326629.21429456, 1355850.69679739, 120171.48537976, 215568.16806522, 321595.5840873, 243534.75742135, 225133.66826874, 181369.58868365, 286293.37197388, 215564.80905642, 317292.87958731, 38204.26197738, 408646.8017266, 1340409.34509005, 126009.22982449, 245066.62466961, 360082.34333978, 271586.6968933, 257339.86888431, 199604.82536807, 326265.85433012, 222154.43521848, 352889.40152614, 39662.09327263, 508265.45535708, 1315598.30320791, 132691.00633935, 280490.27210762, 406111.426174, 305100.82405353, 296044.48870993, 221291.91473204, 374275.59491181, 229354.72391519, 395380.30852723, 41296.77051093, 623955.79186001, 1282011.76125802, 140128.72753928, 321309.48643755, 459001.44722831, 343582.29365739, 340667.86027377, 246114.19396168, 429604.58567814, 237083.49041286, 444139.6645216, 43088.27988952, 751375.96827872, 1240326.16113321, 148003.64985833, 365951.58065429, 516698.35932361, 385532.79077734, 389495.56153304, 273095.63529987, 490124.15238161, 244973.09564846, 497265.68885811, 44956.58446524, 883184.04112145, 1191258.0220666, 155747.75171285, 411727.97430551, 575678.23035669, 428379.17808017, 439599.4622825, 300553.22182661, 552196.58060221, 252345.06903662, 551489.75521882, 46756.52995504, 1009445.41529883, 1135543.29291668, 162576.54630634, 454984.70303498, 631145.06632487, 468618.05673515, 487001.52310077, 326191.79908284, 610878.6994237, 258250.29299249, 602360.13388348, 48286.32441148, 1118689.97244472, 1073942.88206827, 167578.228913, 491496.93760958, 677551.0630133, 502196.29473934, 527102.79762966, 347354.67638721, 660455.36146463, 261581.11898768, 644726.01085818, 49310.89814352, 1199504.59545047, 1007271.28560214, 169849.35271305, 517064.69338882, 709382.74967733, 525086.15562216, 555331.09106462, 361402.69701799, 695244.92462442, 261242.96485424, 673469.15201735, 49597.56107849, 1242379.71565375, 936437.43668385, 168652.66675487, 528204.08285886, 722073.43763926, 533952.87499972, 567892.44802185, 366154.35867485, 710533.9005932, 256354.30211881, 684353.22181728, 48957.52371778, 1241417.62777063, 862481.58292299, 163563.07815068, 522786.76044761, 712847.25613944, 526772.17935458, 562466.32243246, 360292.91846169, 703441.55496414, 246431.55252886, 674809.41253664, 47284.28961611, 1195498.76482124, 786591.19647275, 154566.67321518, 500475.84641689, 681294.2846152, 503251.01446373, 538679.54331366, 343643.62091527, 673509.34764715, 231514.08789889, 644471.65846812, 44579.65491506, 1108605.29313377, 710083.38003511, 142086.70605369, 462845.38895329, 629527.52944554, 464942.25549123, 498236.32533315, 317248.9469553, 622862.51760951, 212195.99607243, 595322.43408524, 40960.42403422, 989198.27104549, 634349.99885267, 126927.58756444, 413144.42284573, 561870.29870534, 415015.74988447, 444661.9970406, 283217.04122862, 555891.16145919, 189553.18065852, 531401.23143827, 36643.47844908, 848780.93651663, 560772.34559435, 110148.458483, 355755.51051294, 484139.94000059, 357733.97370872, 382714.66179928, 244375.20585918, 478518.25183683, 164980.65978518, 458137.16541743, 31912.26697715, 699984.61731484, 490621.20977501, 92895.70101059, 295474.3084029, 402695.21001393, 297754.73217868, 317602.30504795, 203809.31010399, 397225.66570702, 139977.6394897, 381461.52020881, 27072.48777417, 554620.64430418, 424962.7858213, 76232.99364316, 236776.85990384, 323467.63111952, 239422.19002801, 254186.517557, 164395.60502341, 318063.59792705, 115929.7867815, 306905.48135134, 22407.16861532, 422118.69569217, 364589.40539297, 61005.51008729, 183232.65452046, 251185.71968309, 186199.10593945, 196344.59005256, 128425.88310316, 245857.02081869, 93935.52208767, 238877.61558914, 18140.82216578, 308632.14302383, 309987.2512321, 47762.62395586, 137168.88166087, 188931.43583733, 140342.25017699, 146604.57047343, 97393.30292322, 183751.73805396, 74707.49084038, 180250.8705148, 14419.10342849, 216887.65464456, 261343.50969479, 36745.81146317, 99614.86568731, 138067.1165454, 102849.02663, 106084.77343132, 71957.36540275, 133139.20255848, 58557.7102184, 132294.73590554, 11305.73416317, 146661.1105097, 218586.18553289, 27931.33721192, 70482.22746578, 98474.11916657, 73632.2533581, 74689.46165907, 52059.59234932, 93900.02931351, 45453.02372732, 94897.77966312, 8793.91521008, 95634.95106624, 181443.85650782, 21106.32178914, 48888.60031716, 68981.28947226, 51833.86339088, 51460.53203404, 37130.97771427, 64841.58514278, 35113.37847775, 66967.01845081, 6826.55539991, 60360.25301443, 149511.7295999, 15953.90685717, 33520.77114604, 47845.59817826, 36176.81091729, 34972.0678092, 26324.65039547, 44188.9072099, 27121.8599021, 46875.86031598, 5318.88131306, 37098.37779076, 122309.40521352, 12128.06936697, 22952.56265119, 33172.90003304, 25273.15571849, 23675.65937406, 18719.63126204, 30014.38417626, 21021.3507168, 32856.30272295, 4178.29867442, 22414.6234284, 99330.96802568, 9306.50112251, 15869.30780311, 23215.27186518, 17841.75762714, 16144.30855064, 13464.84660324, 20541.25084429, 16383.21610885, 23276.08138918, 3318.39946586, 13496.92057413, 80075.48452325, 7219.74285711, 11188.94066467, 16531.51980815, 12825.9215731, 11203.85855035, 9857.09330956, 14307.18527198, 12845.30556352, 16788.43959363, 2666.71731316, 8244.93015921, 64066.97917245, 5659.64353191, 8096.37529164, 12033.21329402, 9426.98291359, 7970.42927203, 7363.42630167, 10210.9171051, 10123.65438967, 12375.06637776, 2166.95198328, 5208.67582905, 50864.40967336, 4475.08787648, 6021.45702245, 8955.78121833, 7083.53201844, 5826.2426014, 5607.57243456, 7482.24368754, 8007.5488359, 9319.40497904, 1777.84933827, 3454.60950919, 40065.55149306, 3560.96431163, 4589.11563607, 6792.99381274, 5423.12538617, 4365.51418642, 4338.32817072, 5614.73235232, 6345.75307402, 7145.69934406, 1470.33540511, 2418.8836035, 31307.73515314, 2845.43282534, 3564.48272455, 5224.75352429, 4209.61939609, 3334.85684878, 3394.7411005, 4291.61246246, 5030.90434294, 5551.7065388, 1224.09417174, 1777.94444095, 24267.17495106, 2280.23388572, 2805.68249229, 4054.45003783, 3297.60694195, 2581.54745061, 2676.26120695, 3321.52031156, 3986.69345626, 4350.71923409, 1025.18440497, 1356.32994303, 18657.5487691, 1831.20547485, 2227.78364177, 3161.89931753, 2597.65596972, 2014.86968419, 2119.61484643, 2590.30302824, 3156.73320152, 3427.3549347, 863.39245871, 1061.07015569, 14228.35195555, 1474.17212763, 1779.15149641, 2472.35163662, 2053.19763088, 1580.13543691, 1683.8237283, 2028.78264776, 2498.09757285, 2708.50519593, 731.15469593, 843.73055212, 10763.00211039, 1189.87685907, 1427.26849489, 1935.55795388, 1627.26338936, 1243.04963259, 1341.24773248, 1593.3266169, 1977.37358084, 2145.78962876, 622.76300954, 674.43912428, 8076.21362858, 963.59096222, 1148.21226176, 1515.32401955, 1291.5882306, 978.88270451, 1070.53928188, 1252.26777421, 1566.63171203, 1702.61081183, 533.37543511, 251.5698372, 78.39379104, 358.47415645, 417.00189945, 343.02069764, 376.65623709, 250.7696025, 337.58336357, 309.90819185, 426.62429647, 491.88686897, 319.52639815, 229.98487559, 71.89618908, 328.81559374, 379.23122856, 314.58993245, 344.67429338, 230.09586346, 308.86333457, 284.27690779, 390.81066764, 450.29452515, 295.2112419, 209.90700457, 65.83006673, 301.03350393, 344.28036568, 288.01100355, 314.87861043, 210.63872951, 282.04028741, 260.27716481, 357.32462066, 411.58190806, 271.95913494, 191.24089004, 60.16315879, 275.19398596, 312.01200585, 263.15160416, 287.20935752, 192.27087149, 257.10220499, 237.7674599, 326.04483167, 375.64778375, 249.86568268, 174.00163583, 54.91963035, 251.39781986, 282.45956386, 239.97754648, 262.32217129, 175.64746532, 234.15281726, 216.790614, 297.24222327, 342.55725174, 229.20480266, 157.97930014, 50.00834128, 228.82355326, 255.08786962, 218.31775771, 238.56224728, 159.60037691, 212.65262252, 197.143627, 270.1406637, 311.7879358, 209.88174271, 142.06816695, 44.62227866, 194.64200464, 225.45728479, 196.6577881, 211.44851813, 144.28420851, 187.62027776, 178.04283821, 235.82148838, 277.92884196, 187.17201783, 128.50286229, 40.48386692, 176.59536866, 202.94699537, 178.14870904, 191.64947782, 130.3567742, 169.82085583, 161.2262527, 213.56886812, 252.33393292, 171.33467621, 115.97968904, 36.6514532, 160.03920683, 182.36403966, 160.9528592, 173.34424095, 117.4844956, 153.38889848, 145.6325365, 193.58360568, 228.76452604, 156.93064508, 104.5367301, 33.14180888, 144.86824598, 163.64659213, 145.29144047, 156.48584382, 105.68192257, 138.29738459, 131.34706006, 174.78395046, 207.21410655, 143.74953854, 93.78004697, 29.85541729, 130.96459527, 146.41630744, 130.44271923, 140.77860976, 94.56315502, 124.30264354, 117.86939815, 157.52979707, 187.07365571, 131.77364802, 83.88989526, 26.83225494, 118.25612431, 130.74987912, 116.81302281, 126.47480898, 84.25546865, 111.47877409, 105.47798006, 141.76481975, 168.4721351, 120.76505894, 53.33651065, 18.92707237, 90.87873209, 79.6252602, 70.72587975, 88.10930502, 56.14340574, 81.73028335, 67.25059365, 108.22846602, 122.63108916, 104.04441286, 47.89299261, 17.04829663, 82.32833411, 71.77798564, 63.44850361, 79.49550243, 50.00911405, 73.48232359, 60.24833615, 97.61230935, 110.70463824, 95.29567211, 42.62016718, 15.24165754, 74.07981395, 64.18600981, 56.41671636, 71.07795167, 44.13841524, 65.49956262, 53.50718816, 87.42893288, 99.13843079, 86.79343899, 37.63930125, 13.50499443, 66.00415373, 56.88053523, 49.76582747, 63.03246982, 38.69615, 57.87524503, 47.14539937, 77.45230119, 87.96494903, 78.399986, 31.1853418, 11.29303093, 55.36493619, 47.2706883, 41.30196979, 51.74911951, 32.59561219, 41.97616169, 39.52737486, 64.67513812, 73.81611274, 68.97088594, 27.14365405, 9.9098898, 48.7774765, 41.35906452, 35.91069989, 45.27866827, 28.1787518, 36.79180041, 34.33394868, 56.73278765, 64.52507646, 61.3176671, 19.83430962, 7.90841363, 42.34939547, 33.45681498, 26.36216842, 37.03140716, 15.50123753, 30.69105251, 24.83742341, 48.90373012, 52.71993102, 53.64481906, 16.9840777, 6.83904508, 36.4451199, 28.69636008, 22.53413541, 31.85997294, 13.27016619, 26.35966282, 21.23353756, 41.96530128, 44.97630582, 46.85019781, 12.52489332, 5.33894605, 28.87987917, 21.69552324, 16.69237271, 22.02426386, 9.88546812, 19.75697073, 15.85180637, 32.82566903, 34.86830872, 39.30545578, 10.45886259, 4.54442782, 24.22711755, 18.12732183, 13.89341549, 18.37893864, 8.25371099, 16.52726019, 13.19359021, 27.48097099, 29.44570412, 33.06075514, 8.68712475, 3.86152316, 20.1139183, 15.02404068, 11.49386578, 15.2253698, 6.85638761, 13.71400586, 10.92018433, 22.81607896, 24.27264158, 27.36216897, 7.12940923, 3.26307559, 16.49349628, 12.29788437, 9.38142982, 12.45906294, 5.62426025, 11.24493102, 8.91231921, 18.72438796, 19.72819811, 22.30258991, 5.78530548, 2.7378417, 13.28265627, 9.9044297, 7.55604279, 10.03047531, 4.56570193, 9.07023957, 7.18069457, 15.08212164, 15.75615258, 17.82878717, 3.90279567, 2.13526527, 10.3918536, 7.31432825, 4.87163927, 7.37716773, 2.88091081, 6.89338928, 4.25917639, 11.75406374, 11.69203026, 13.94809898, 3.1553064, 1.81360234, 8.1982707, 5.79772866, 3.88209629, 5.85214863, 2.33506104, 5.47610318, 3.39974927, 9.30363615, 9.11991572, 10.77377098, 2.29575275, 1.25578141, 4.68698103, 3.46967983, 2.66777067, 3.37918557, 1.78687785, 3.19908926, 2.35111776, 4.60022024, 5.79347897, 7.39332891, 1.86201737, 1.10037963, 3.57738702, 2.68639543, 2.10625688, 2.61367576, 1.45690498, 2.48395406, 1.86240214, 3.49115671, 4.36151747, 5.50304112, 1.53852206, 0.98419233, 2.74272547, 2.09949845, 1.68718945, 2.04068919, 1.21080987, 1.94788643, 1.49750673, 2.6578272, 3.28919419, 4.07658778, 1.29002229, 0.89491852, 2.10100997, 1.64845093, 1.36525283, 1.6003782, 1.02176751, 1.53588465, 1.21717387, 2.01720794, 2.46512986, 2.9795324, 1.11035304, 0.83058878, 1.64246223, 1.32439905, 1.13269452, 1.28358897, 0.88507894, 1.2400625, 1.0147902, 1.55873629, 1.87262042, 2.19905324, 0.96980216, 0.78082217, 1.29769371, 1.07620426, 0.95130186, 1.03978994, 0.7781303, 1.0139487, 0.85724529, 1.2121851, 1.41760455, 1.62117986, 0.8688926, 0.74521724, 1.05330301, 0.8992047, 0.8211894, 0.86565694, 0.7013411, 0.85280179, 0.74430917, 0.96609982, 1.09283358, 1.2136469, 0.77793159, 0.71478119, 0.87452515, 0.75544747, 0.70548894, 0.72065516, 0.63206142, 0.72332703, 0.64481489, 0.78030854, 0.82536338, 0.9435997, 0.72764363, 0.69715286, 0.75561953, 0.66833791, 0.64075793, 0.63470806, 0.59378953, 0.64411709, 0.58869393, 0.66017714, 0.665272, 0.7472702, 0.71020376, 0.68999224, 0.6881717, 0.62815848, 0.61730896, 0.59734875, 0.58055536, 0.60668185, 0.56777434, 0.59576755, 0.59379139, 0.61775141, 0.69419327, 0.6843913, 0.65060278, 0.60053434, 0.59671114, 0.57006817, 0.56837008, 0.58157271, 0.54992275, 0.55777034, 0.54299736, 0.55591928, 0.69021144, 0.68277945, 0.6357802, 0.59158012, 0.59137934, 0.56170463, 0.56534764, 0.57324493, 0.54517851, 0.54356521, 0.52702839, 0.52770007, 0.68705957, 0.68171206, 0.62926608, 0.58647736, 0.58735805, 0.55658819, 0.56294752, 0.56863713, 0.54171321, 0.53685027, 0.5175659, 0.51759431] @@ -267,6 +322,21 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Energy for growth and reproduction"] + }, + "units": { + "type": "character", + "attributes": {}, + "value": ["g/year"] } }, "value": [0, 0.14003569, 0, 0.16166917, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.15516856, 0, 0.18171766, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.17074229, 0, 0.20425055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.18592246, 0, 0.22957537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.19931068, 0, 0.25803764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20878045, 0, 0.29002552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.21147359, 0, 0.32597508, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20420514, 0, 0.36637613, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.18447594, 0, 0.4117788, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.15185233, 0, 0.46280092, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.10878655, 0, 0.52013618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05993608, 0, 0.58456336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0102479, 0, 0.65695649, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.73829629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.82968277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.93234916, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.04767728, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.17721437, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.32269134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.48604242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6694259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.87524576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.10617333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.36516804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.65549556, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.9807409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.34481256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.75193245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.2066034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.71354288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.27756672, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.9034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6.5953844, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.35704041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.19043179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9.09526805, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10.06767486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11.09856898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12.171609, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13.26077642, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14.32779915, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15.31987889, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.16851041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.7904892, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17.09228898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.97855166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.36423489, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15.18817278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13.42424084, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11.08601057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.22269342, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.90710338, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.21936681, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.89157854, 0, 0, 5.33227104, 0, 0, 0, 0, 0, 0, 0, 0, 10.64607442, 0, 0, 15.88911261, 0, 0, 0, 0, 0, 0, 0, 0, 23.16351162, 0, 0, 30.46999669, 0, 0, 0, 0, 0, 0, 0, 0, 41.08667202, 0, 0, 50.60735737, 0, 0, 0, 0, 0, 0, 0, 0, 59.76469708, 0, 0, 71.34568062, 0, 0, 0, 0, 2.72897895, 0, 0, 0, 84.28402189, 0, 1.73953588, 98.1293925, 0, 0, 1.45013581, 0, 31.81585224, 2.92502179, 0, 0, 112.9487484, 0, 18.78095022, 129.38881615, 0, 0, 10.14853139, 0, 75.24893094, 32.17985068, 0, 0, 142.43918408, 0, 41.40894665, 160.57855829, 0, 0, 22.04144061, 0, 133.90652196, 72.527281, 0, 0, 174.45105631, 0, 70.65590108, 193.97961867, 0, 7.52959139, 37.29462136, 16.09860612, 208.74236874, 126.93900325, 0, 0, 210.26315192, 0, 111.04713613, 231.32066013, 10.8116472, 26.23863481, 57.94531953, 51.49606665, 303.1305361, 200.78963382, 0, 0, 246.93128067, 0, 158.89843483, 270.33693602, 33.67404992, 50.89827669, 82.86930774, 100.73401017, 412.70482579, 289.92944402, 0, 0, 286.1861729, 0, 216.8266646, 312.31587875, 64.32124384, 82.40707287, 112.45582179, 163.34991559, 537.02072415, 393.92626312, 0, 0, 330.48757785, 0, 283.95797189, 358.72848067, 108.01319779, 125.10750686, 146.72304227, 250.60423449, 675.30724861, 512.80373286, 0, 0, 376.81882728, 0, 352.66928647, 408.61157368, 161.36088507, 172.13096674, 182.21381725, 345.28842649, 820.71610967, 638.1068284, 0, 0, 427.89778101, 0, 425.97617302, 463.35350823, 224.55125776, 224.08699529, 220.0543426, 450.97599813, 975.40727828, 772.76990541, 0, 0, 484.12753242, 0, 502.35755052, 523.83370516, 290.71736118, 280.31182168, 259.45377328, 564.78897662, 1139.62035544, 914.68758077, 0, 0, 546.42103787, 0, 580.48363958, 590.78104501, 357.30464215, 338.71481931, 300.45332001, 682.89222562, 1313.65843626, 1065.7874405, 0, 0, 616.21772789, 0, 669.05965294, 665.89636417, 435.48694021, 404.15246149, 346.17859943, 814.54103024, 1505.28397117, 1229.57382453, 0, 0, 693.62492165, 0, 762.8089542, 749.3805164, 515.07365487, 471.14896665, 394.87574029, 947.9277658, 1712.89543074, 1405.22273795, 0, 0, 780.29753854, 0, 865.11674356, 842.78940728, 598.54433713, 542.90973693, 448.08349178, 1092.32129674, 1940.66702465, 1597.24370446, 0, 0, 877.17346316, 36.19313244, 976.89414551, 947.28489764, 684.62184657, 618.24187536, 506.31333724, 1244.62301033, 2191.5209098, 1808.27233008, 0, 0, 985.87964101, 131.5057724, 1102.30672345, 1064.68951473, 781.26829957, 702.45416498, 571.47212027, 1414.33581268, 2471.44445098, 2042.45580606, 0, 0, 1107.86145291, 269.34561657, 1242.4756503, 1196.44079673, 887.58184903, 795.50850049, 644.19682744, 1603.25858958, 2784.0154993, 2303.1615114, 0, 0, 1244.71462622, 452.13742121, 1398.86298314, 1344.298982, 1004.75563401, 898.17021871, 725.38290044, 1811.44702749, 3133.52929074, 2594.11166139, 0, 0, 1398.32777231, 677.13155035, 1573.55055133, 1510.28179567, 1134.39941634, 1012.73740821, 816.08285576, 2043.04089731, 3524.72330422, 2919.21690481, 0, 0, 1570.77179603, 944.99128743, 1769.2363023, 1696.62085958, 1279.18804836, 1140.42964953, 917.72186802, 2301.51830614, 3963.22709718, 3283.56524759, 0, 0, 1764.34524695, 1248.36968319, 1988.63948351, 1905.84448476, 1440.6755152, 1283.10246786, 1031.64158121, 2590.24003929, 4455.17350563, 3691.80716137, 0, 0, 1981.66180949, 1551.74813793, 2234.53535688, 2140.76115079, 1620.87668453, 1442.69049267, 1159.3754769, 2913.00671953, 5006.9847039, 4149.57199959, 0, 0, 2225.69806678, 1897.65234821, 2510.52209931, 2404.57412253, 1822.95142781, 1621.73753009, 1302.73135102, 3275.09793172, 5626.49724008, 4663.35999521, 0, 0, 2499.69798267, 2251.56392951, 2820.1024097, 2700.82325558, 2049.1135158, 1822.43512666, 1463.56644888, 3680.9242559, 6321.98361031, 5240.0331974, 0, 0, 2807.3515777, 2627.06772053, 3167.61605127, 3033.49596466, 2302.74084575, 2047.59379224, 1644.1277031, 4136.10595823, 7102.94019086, 5887.45200897, 0, 0, 3152.81406524, 3045.75958887, 3557.83051986, 3407.08575784, 2587.56512373, 2300.28552457, 1846.88116918, 4647.17071412, 7980.01705069, 6614.48781257, 0, 0, 3540.7257535, 3498.38726782, 3995.81964936, 3826.61704476, 2907.01922359, 2583.93103437, 2074.50227096, 5220.92032141, 8965.0329159, 7430.95638696, 0, 0, 3976.27728615, 3985.53528188, 4487.55146119, 4297.7307427, 3265.57426822, 2902.26124713, 2330.08671538, 5864.7793038, 10071.30134984, 8347.83987605, 0, 0, 4465.33746517, 4519.24268522, 5039.61605805, 4826.77086344, 3668.001855, 3259.6538616, 2617.06978242, 6587.80004836, 11313.79395771, 9377.58157612, 0, 0, 5014.46369256, 5105.39911385, 5659.44394042, 5420.85067548, 4119.81999661, 3660.87672094, 2939.32333478, 7399.51367231, 12709.29529344, 10534.07023182, 0, 0, 5631.03051187, 5757.01516838, 6355.35333491, 6087.96110559, 4627.09017369, 4111.35261253, 3301.18127524, 8310.97800787, 14276.66211727, 11832.9392501, 0, 0, 6323.31119468, 6483.66570829, 7136.69488875, 6837.06985089, 5196.65039833, 4617.13331447, 3707.51834889, 9334.46561357, 16037.06643568, 13291.72023901, 0, 0, 7100.59197006, 7296.66158165, 8013.95160166, 7678.2445856, 5836.16290806, 5185.01573576, 4163.79950851, 10483.7730389, 18014.27497987, 14930.08724571, 0, 0, 7973.29441111, 8204.91404334, 8998.88169344, 8622.78547218, 6554.22987315, 5822.61856296, 4676.15770191, 11774.32841359, 20234.96574481, 16770.1516867, 0, 0, 8953.11869064, 9223.10395164, 10104.69199576, 9683.37989111, 7360.50280984, 6538.50655607, 5251.47947814, 13223.51452947, 22729.10415152, 18836.72336974, 0, 0, 10053.19587965, 10364.07564918, 11346.19836256, 10874.26822339, 8265.80843991, 7342.2797065, 5897.49430768, 14850.81189635, 25530.33019577, 21157.66002316, 0, 0, 11288.26459343, 11644.12162411, 12740.03202202, 12211.4369947, 9282.30280673, 8244.71505658, 6622.87930465, 16678.1001209, 28676.41664164, 23764.24805033, 0, 0, 12674.86633239, 13080.19650301, 14304.86164409, 13712.83079386, 10423.63592967, 9257.91630265, 7437.37557617, 18729.9351693, 32209.77749776, 26691.60797778, 0, 0, 14231.56643934, 14691.81859381, 16061.63569265, 15398.59222995, 11705.11773876, 10395.46058897, 8351.91632534, 21033.87550703, 36178.0356839, 29979.16855373, 0, 0, 15979.20166302, 16500.58524014, 18033.86437564, 17291.33096024, 13143.93727431, 11672.59009804, 9378.77382239, 23620.86431671, 40634.66113185, 33671.20582331] @@ -303,6 +373,21 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Energy for reproduction"] + }, + "units": { + "type": "character", + "attributes": {}, + "value": ["g/year"] } }, "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.00317746, 0, 0, 6.16214383e-08, 0, 0, 0, 0, 0, 0, 0, 0, 0.22812575, 0, 0, 1.14085731e-06, 0, 0, 0, 0, 0, 0, 0, 0, 2.59358088, 0, 0, 0.00001359, 0, 0, 0, 0, 0, 0, 0, 0, 14.79963351, 0, 0, 0.00014027, 0, 0, 0, 0, 0, 0, 0, 0, 34.97127222, 0, 0, 0.0012286, 0, 0, 0, 0, 0, 0, 0, 0, 57.53279637, 0, 0.81242789, 0.01049609, 0, 0, 3.95413382e-06, 0, 0, 0, 0, 0, 83.19654721, 0, 9.36885328, 0.08584167, 0, 0, 0.00017192, 0, 0, 0, 0, 0, 111.61717898, 0, 21.93676614, 0.65538652, 0, 0, 0.00231917, 0, 0, 0, 0, 0, 145.07279343, 0, 39.71057838, 4.65040927, 0, 3.25827219, 0.02433177, 0.00010129, 0, 0, 0, 0, 185.48288419, 0, 66.20198093, 26.10560692, 1.01295778, 12.24746874, 0.23214512, 0.00201291, 0, 0, 0, 0, 231.05422322, 0, 100.47928605, 78.34308053, 9.51821551, 25.2730246, 1.93075791, 0.02444614, 0, 0, 0, 0, 284.03918643, 0, 145.43226464, 126.74874397, 28.14613574, 43.42347027, 11.84078418, 0.24521677, 0, 0, 0, 0, 330.48757785, 0, 202.01933358, 163.35242439, 54.40177208, 69.93118235, 36.96050806, 2.27866493, 0, 0, 0, 0, 376.81882728, 0, 266.1320847, 199.32908467, 87.47482711, 102.05716461, 61.96957369, 17.0041888, 0, 0, 0, 0, 427.89778101, 0, 340.96171904, 240.16139183, 129.44515481, 140.92658575, 83.25903854, 78.78231773, 0, 0, 0, 0, 484.12753242, 0, 426.50484052, 288.07220033, 177.83578762, 186.98578378, 104.99997425, 174.4860772, 0, 7.06173317e-06, 0, 0, 546.42103787, 0, 522.74721756, 344.62499402, 231.85129745, 239.65810452, 129.15787356, 252.54734007, 0, 0.00005112, 0, 0, 616.21772789, 0, 639.08305447, 412.0228144, 299.7382584, 303.31498796, 157.88520011, 326.68731063, 8.162946e-06, 0.00036645, 0, 0, 693.62492165, 0, 762.8089542, 491.82246585, 376.03479107, 375.05728207, 191.03395935, 404.81091821, 0.00005771, 0.00260205, 0, 0, 780.29753854, 0, 865.11674356, 586.69968745, 463.49589469, 458.41382362, 229.93383927, 495.11183668, 0.00040626, 0.01837534, 0, 0, 877.17346316, 36.19313244, 976.89414551, 699.46845896, 562.32975167, 553.70597255, 275.58435606, 598.45315402, 0.00285042, 0.1292195, 0, 0, 985.87964101, 131.5057724, 1102.30672345, 833.87550728, 680.66157009, 667.31286497, 329.92942246, 721.34645941, 0.01997164, 0.90546762, 0, 0, 1107.86145291, 269.34561657, 1242.4756503, 993.94000343, 820.21962626, 795.50850049, 394.48937586, 867.33540872, 0.13975794, 6.28829733, 0, 0, 1244.71462622, 452.13742121, 1398.86298314, 1184.55585064, 984.85639719, 898.17021871, 471.16688752, 1039.4416087, 0.97642817, 41.8565406, 0, 0, 1398.32777231, 677.13155035, 1573.55055133, 1411.58935766, 1134.39941634, 1012.73740821, 562.25382449, 1243.48994079, 6.78651891, 227.55380328, 0, 0, 1570.77179603, 944.99128743, 1769.2363023, 1681.99966725, 1279.18804836, 1140.42964953, 670.65622479, 1485.83427427, 45.93078467, 690.52807742, 0, 0, 1764.34524695, 1248.36968319, 1988.63948351, 1905.84448476, 1440.6755152, 1283.10246786, 799.66563576, 1773.72655299, 271.18858337, 1118.12829841, 0, 0, 1981.66180949, 1551.74813793, 2234.53535688, 2140.76115079, 1620.87668453, 1442.69049267, 953.22279717, 2115.82067867, 993.59062008, 1419.76670337, 0, 0, 2225.69806678, 1897.65234821, 2510.52209931, 2404.57412253, 1822.95142781, 1621.73753009, 1136.09824954, 2523.20407376, 1833.22850187, 1711.40699821, 0, 0, 2499.69798267, 2251.56392951, 2820.1024097, 2700.82325558, 2049.1135158, 1822.43512666, 1353.83016473, 3007.98511437, 2410.32774362, 2043.67827722, 0, 0, 2807.3515777, 2627.06772053, 3167.61605127, 3033.49596466, 2302.74084575, 2047.59379224, 1613.16207733, 3585.09916806, 2923.95780485, 2436.34633236, 0, 0, 3152.81406524, 3045.75958887, 3557.83051986, 3407.08575784, 2587.56512373, 2300.28552457, 1846.88116918, 4272.56677966, 3495.09636046, 2903.50716302, 0, 0, 3540.7257535, 3498.38726782, 3995.81964936, 3826.61704476, 2907.01922359, 2583.93103437, 2074.50227096, 5091.40932431, 4167.02098607, 3459.92162607, 0, 0, 3976.27728615, 3985.53528188, 4487.55146119, 4297.7307427, 3265.57426822, 2902.26124713, 2330.08671538, 5864.7793038, 4965.79741882, 4122.75078727, 0, 0, 4465.33746517, 4519.24268522, 5039.61605805, 4826.77086344, 3668.001855, 3259.6538616, 2617.06978242, 6587.80004836, 5917.10162444, 4912.41060775, 0, 0, 5014.46369256, 5105.39911385, 5659.44394042, 5420.85067548, 4119.81999661, 3660.87672094, 2939.32333478, 7399.51367231, 7050.40528063, 5853.16484312, 0, 0, 5631.03051187, 5757.01516838, 6355.35333491, 6087.96110559, 4627.09017369, 4111.35261253, 3301.18127524, 8310.97800787, 8400.59799353, 6973.93507133, 0, 0, 6323.31119468, 6483.66570829, 7136.69488875, 6837.06985089, 5196.65039833, 4617.13331447, 3707.51834889, 9334.46561357, 10009.196095, 8309.16097397, 0, 0, 7100.59197006, 7296.66158165, 8013.95160166, 7678.2445856, 5836.16290806, 5185.01573576, 4163.79950851, 10483.7730389, 11925.64228512, 9899.85974989, 0, 0, 7973.29441111, 8204.91404334, 8998.88169344, 8622.78547218, 6554.22987315, 5822.61856296, 4676.15770191, 11774.32841359, 14208.82549535, 11794.90379123, 0, 0, 8953.11869064, 9223.10395164, 10104.69199576, 9683.37989111, 7360.50280984, 6538.50655607, 5251.47947814, 13223.51452947, 16928.90006847, 14052.4965494, 0, 0, 10053.19587965, 10364.07564918, 11346.19836256, 10874.26822339, 8265.80843991, 7342.2797065, 5897.49430768, 14850.81189635, 20169.42744295, 16741.9668307, 0, 0, 11288.26459343, 11644.12162411, 12740.03202202, 12211.4369947, 9282.30280673, 8244.71505658, 6622.87930465, 16678.1001209, 24029.94270212, 19945.89990235, 0, 0, 12674.86633239, 13080.19650301, 14304.86164409, 13712.83079386, 10423.63592967, 9257.91630265, 7437.37557617, 18729.9351693, 28629.0075997, 23762.65766976, 0, 0, 14231.56643934, 14691.81859381, 16061.63569265, 15398.59222995, 11705.11773876, 10395.46058897, 8351.91632534, 21033.87550703, 34107.84394916, 28309.39402316, 0, 0, 15979.20166302, 16500.58524014, 18033.86437564, 17291.33096024, 13143.93727431, 11672.59009804, 9378.77382239, 23620.86431671, 40634.66113185, 33671.20582331] @@ -367,6 +452,21 @@ "value": ["0.001", "0.00119", "0.00142", "0.0017", "0.00203", "0.00242", "0.00289", "0.00345", "0.00411", "0.00491", "0.00586", "0.00699", "0.00834", "0.00995", "0.0119", "0.0142", "0.0169", "0.0202", "0.0241", "0.0288", "0.0343", "0.0409", "0.0489", "0.0583", "0.0696", "0.083", "0.0991", "0.118", "0.141", "0.168", "0.201", "0.24", "0.286", "0.342", "0.408", "0.486", "0.58", "0.693", "0.827", "0.987", "1.18", "1.4", "1.68", "2", "2.39", "2.85", "3.4", "4.06", "4.84", "5.78", "6.9", "8.23", "9.82", "11.7", "14", "16.7", "19.9", "23.8", "28.4", "33.8", "40.4", "48.2", "57.5", "68.7", "81.9", "97.8", "117", "139", "166", "198", "237", "282", "337", "402", "480", "573", "683", "816", "973", "1160", "1390", "1650", "1970", "2360", "2810", "3350", "4000", "4780", "5700", "6800", "8120", "9690", "11600", "13800", "16500", "19600", "23400", "28000", "33400", "39900"] } ] + }, + "class": { + "type": "character", + "attributes": {}, + "value": ["MizerRate", "matrix", "array"] + }, + "rate_name": { + "type": "character", + "attributes": {}, + "value": ["Growth rate"] + }, + "units": { + "type": "character", + "attributes": {}, + "value": ["g/year"] } }, "value": [0, 0.14003569, 0, 0.16166917, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.15516856, 0, 0.18171766, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.17074229, 0, 0.20425055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.18592246, 0, 0.22957537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.19931068, 0, 0.25803764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20878045, 0, 0.29002552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.21147359, 0, 0.32597508, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20420514, 0, 0.36637613, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.18447594, 0, 0.4117788, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.15185233, 0, 0.46280092, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.10878655, 0, 0.52013618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05993608, 0, 0.58456336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0102479, 0, 0.65695649, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.73829629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.82968277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.93234916, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.04767728, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.17721437, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.32269134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.48604242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6694259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.87524576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.10617333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.36516804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.65549556, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.9807409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.34481256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.75193245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.2066034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.71354288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.27756672, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.9034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6.5953844, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.35704041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.19043179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9.09526805, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10.06767486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11.09856898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12.171609, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13.26077642, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14.32779915, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15.31987889, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.16851041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.7904892, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17.09228898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.97855166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16.36423489, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15.18817278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13.42424084, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11.08601057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.22269342, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.90710338, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.21936681, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.88840108, 0, 0, 5.33227098, 0, 0, 0, 0, 0, 0, 0, 0, 10.41794867, 0, 0, 15.88911147, 0, 0, 0, 0, 0, 0, 0, 0, 20.56993074, 0, 0, 30.46998309, 0, 0, 0, 0, 0, 0, 0, 0, 26.28703851, 0, 0, 50.6072171, 0, 0, 0, 0, 0, 0, 0, 0, 24.79342486, 0, 0, 71.34445202, 0, 0, 0, 0, 2.72897895, 0, 0, 0, 26.75122552, 0, 0.92710799, 98.11889641, 0, 0, 1.45013185, 0, 31.81585224, 2.92502179, 0, 0, 29.75220119, 0, 9.41209694, 129.30297448, 0, 0, 10.14835947, 0, 75.24893094, 32.17985068, 0, 0, 30.8220051, 0, 19.47218051, 159.92317178, 0, 0, 22.03912144, 0, 133.90652196, 72.527281, 0, 0, 29.37826288, 0, 30.9453227, 189.3292094, 0, 4.27131921, 37.27028959, 16.09850483, 208.74236874, 126.93900325, 0, 0, 24.78026773, 0, 44.8451552, 205.21505321, 9.79868942, 13.99116607, 57.71317442, 51.49405374, 303.1305361, 200.78963382, 0, 0, 15.87705746, 0, 58.41914878, 191.99385549, 24.15583441, 25.62525209, 80.93854984, 100.70956403, 412.70482579, 289.92944402, 0, 0, 2.14698647, 0, 71.39439996, 185.56713478, 36.1751081, 38.98360259, 100.61503761, 163.10469882, 537.02072415, 393.92626312, 0, 0, 0, 0, 81.93863831, 195.37605628, 53.6114257, 55.1763245, 109.76253421, 248.32556956, 675.30724861, 512.80373286, 0, 0, 0, 0, 86.53720178, 209.28248901, 73.88605796, 70.07380214, 120.24424356, 328.28423769, 820.71610967, 638.1068284, 0, 0, 0, 0, 85.01445398, 223.1921164, 95.10610295, 83.16040954, 136.79530406, 372.19368039, 975.40727828, 772.76990541, 0, 0, 0, 0, 75.85271, 235.76150483, 112.88157355, 93.3260379, 154.45379903, 390.30289943, 1139.62035544, 914.68757371, 0, 0, 0, 0, 57.73642202, 246.15605099, 125.4533447, 99.05671479, 171.29544645, 430.34488554, 1313.65843626, 1065.78738938, 0, 0, 0, 0, 29.97659847, 253.87354977, 135.74868181, 100.83747354, 188.29339933, 487.85371961, 1505.28396301, 1229.57345808, 0, 0, 0, 0, 0, 257.55805055, 139.0388638, 96.09168458, 203.84178094, 543.11684759, 1712.89537302, 1405.2201359, 0, 0, 0, 0, 0, 256.08971982, 135.04844245, 84.49591331, 218.1496525, 597.20946007, 1940.66661839, 1597.22532912, 0, 0, 0, 0, 0, 247.81643868, 122.2920949, 64.53590282, 230.72898118, 646.1698563, 2191.51805938, 1808.14311058, 0, 0, 0, 0, 0, 230.81400745, 100.60672949, 35.14130001, 241.54269781, 692.98935327, 2471.42447934, 2041.55033844, 0, 0, 0, 0, 0, 202.50079329, 67.36222277, 0, 249.70745159, 735.92318086, 2783.87574136, 2296.87321407, 0, 0, 0, 0, 0, 159.74313136, 19.89923682, 0, 254.21601293, 772.00541879, 3132.55286257, 2552.25512079, 0, 0, 0, 0, 0, 98.69243802, 0, 0, 253.82903127, 799.55095652, 3517.93678532, 2691.66310154, 0, 0, 0, 0, 0, 14.62119233, 0, 0, 247.06564323, 815.68403187, 3917.29631252, 2593.03717017, 0, 0, 0, 0, 0, 0, 0, 0, 231.97594545, 816.51348629, 4183.98492225, 2573.67886296, 0, 0, 0, 0, 0, 0, 0, 0, 206.15267973, 797.18604087, 4013.39408382, 2729.80529622, 0, 0, 0, 0, 0, 0, 0, 0, 166.63310148, 751.89385796, 3793.26873821, 2951.952997, 0, 0, 0, 0, 0, 0, 0, 0, 109.73628415, 672.93914153, 3911.65586668, 3196.35492018, 0, 0, 0, 0, 0, 0, 0, 0, 30.96562576, 551.00679017, 4178.98238601, 3451.10567661, 0, 0, 0, 0, 0, 0, 0, 0, 0, 374.60393446, 4484.92069023, 3710.98064955, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129.5109971, 4798.01192983, 3971.03476089, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5105.50393101, 4225.08908879, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5396.69233327, 4465.17096837, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5658.89001281, 4680.9053887, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5876.06412374, 4859.00417877, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6027.87034069, 4982.55926504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6088.63269474, 5030.22749581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6026.14024946, 4975.24789547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5800.20408305, 4784.22682034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5360.90275283, 4415.69319245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4646.47393952, 3818.34814797, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3580.76989806, 2928.95030802, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2070.19173473, 1669.77453057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.02041075e-10, 0] diff --git a/tests/testthat/test-MizerRate.R b/tests/testthat/test-MizerRate.R new file mode 100644 index 000000000..74f4f7106 --- /dev/null +++ b/tests/testthat/test-MizerRate.R @@ -0,0 +1,146 @@ +test_that("MizerRate constructor works", { + mat <- matrix(1:120, nrow = 12, ncol = 10) + rownames(mat) <- NS_params@species_params$species + colnames(mat) <- signif(NS_params@w[1:10], 3) + + rate <- MizerRate(mat, rate_name = "Test rate", units = "g/year") + + expect_s3_class(rate, "MizerRate") + expect_true(is.MizerRate(rate)) + expect_false(is.MizerRate(mat)) + expect_true(is.matrix(rate)) + expect_identical(dim(rate), dim(mat)) + expect_identical(attr(rate, "rate_name"), "Test rate") + expect_identical(attr(rate, "units"), "g/year") +}) + +test_that("MizerRate constructor validates input", { + expect_error(MizerRate(1:10), "`x` must be a matrix.") +}) + +test_that("Rate functions return MizerRate", { + params <- NS_params + + expect_true(is.MizerRate(getEncounter(params))) + expect_true(is.MizerRate(getFeedingLevel(params))) + expect_true(is.MizerRate(getCriticalFeedingLevel(params))) + expect_true(is.MizerRate(getEReproAndGrowth(params))) + expect_true(is.MizerRate(getERepro(params))) + expect_true(is.MizerRate(getEGrowth(params))) + expect_true(is.MizerRate(getFMort(params))) + expect_true(is.MizerRate(getPredMort(params))) + expect_true(is.MizerRate(getMort(params))) + expect_true(is.MizerRate(getFlux(params))) +}) + +test_that("All rate functions have consistent dimnames", { + params <- NS_params + expected_dimnames <- dimnames(params@metab) + + expect_identical(dimnames(getEncounter(params)), expected_dimnames) + expect_identical(dimnames(getFeedingLevel(params)), expected_dimnames) + expect_identical(dimnames(getCriticalFeedingLevel(params)), expected_dimnames) + expect_identical(dimnames(getEReproAndGrowth(params)), expected_dimnames) + expect_identical(dimnames(getERepro(params)), expected_dimnames) + expect_identical(dimnames(getEGrowth(params)), expected_dimnames) + expect_identical(dimnames(getFMort(params)), expected_dimnames) + expect_identical(dimnames(getPredMort(params)), expected_dimnames) + expect_identical(dimnames(getMort(params)), expected_dimnames) + expect_identical(dimnames(getFlux(params)), expected_dimnames) +}) + +test_that("print.MizerRate works", { + enc <- getEncounter(NS_params) + expect_output(print(enc), "Encounter rate") + expect_output(print(enc), "species x") + expect_output(print(enc), "g/year") +}) + +test_that("summary.MizerRate works", { + enc <- getEncounter(NS_params) + s <- summary(enc) + expect_s3_class(s, "summary.MizerRate") + expect_identical(s$rate_name, "Encounter rate") + expect_identical(nrow(s$per_species), nrow(NS_params@species_params)) + expect_output(print(s), "Encounter rate") +}) + +test_that("plot.MizerRate returns ggplot", { + enc <- getEncounter(NS_params) + + # With params for styling + p <- plot(enc, NS_params) + expect_s3_class(p, "ggplot") + + # Without params (basic plot) + p2 <- plot(enc) + expect_s3_class(p2, "ggplot") + + # With species selection + p3 <- plot(enc, NS_params, species = c("Cod", "Herring")) + expect_s3_class(p3, "ggplot") + + # return_data works + df <- plot(enc, NS_params, return_data = TRUE) + expect_true(is.data.frame(df)) + expect_true(all(c("w", "value", "Species") %in% names(df))) +}) + +test_that("as.data.frame.MizerRate works", { + enc <- getEncounter(NS_params) + df <- as.data.frame(enc) + expect_true(is.data.frame(df)) + expect_true(all(c("w", "value", "Species") %in% names(df))) + expect_equal(nrow(df), prod(dim(enc))) +}) + +test_that("MizerRate subsetting preserves class for 2D", { + enc <- getEncounter(NS_params) + + # Subsetting rows keeps class + sub <- enc[1:3, ] + expect_true(is.MizerRate(sub)) + expect_identical(nrow(sub), 3L) + + # Subsetting to a single row with drop = TRUE returns vector + sub1 <- enc[1, ] + expect_false(is.MizerRate(sub1)) + expect_true(is.numeric(sub1)) + + # Subsetting to a single row with drop = FALSE keeps matrix + sub1_nodrop <- enc[1, , drop = FALSE] + expect_true(is.MizerRate(sub1_nodrop)) +}) + +test_that("MizerRate arithmetic strips class", { + enc <- getEncounter(NS_params) + + # Arithmetic should strip MizerRate and return a plain matrix + double_enc <- enc * 2 + expect_false(is.MizerRate(double_enc)) + expect_true(is.matrix(double_enc)) + expect_equal(double_enc, unclass(enc) * 2, ignore_attr = TRUE) + + # Addition with a matrix should work + mat <- matrix(1, nrow = nrow(enc), ncol = ncol(enc)) + result <- enc + mat + expect_false(is.MizerRate(result)) + expect_true(is.matrix(result)) + + # Comparison operators should work + expect_true(is.logical(enc > 0)) +}) + +test_that("MizerRate rate_name attribute", { + enc <- getEncounter(NS_params) + expect_identical(attr(enc, "rate_name"), "Encounter rate") + + fl <- getFeedingLevel(NS_params) + expect_identical(attr(fl, "rate_name"), "Feeding level") + + g <- getEGrowth(NS_params) + expect_identical(attr(g, "rate_name"), "Growth rate") + + mort <- getMort(NS_params) + expect_identical(attr(mort, "rate_name"), "Total mortality") +}) diff --git a/tests/testthat/test-extension.R b/tests/testthat/test-extension.R index 0b6d4acc8..288ffd0c2 100644 --- a/tests/testthat/test-extension.R +++ b/tests/testthat/test-extension.R @@ -38,17 +38,19 @@ test_that("setRateFunction works", { test_that("Time is passed correctly to rate functions", { params@rates_funcs$Encounter <- "nt" - expect_identical(getEncounter(params, t = 2), nt(params, 2)) + expect_equal(getEncounter(params, t = 2), nt(params, 2), + ignore_attr = TRUE) params@rates_funcs$FeedingLevel <- "nt" - expect_identical(getFeedingLevel(params, time_range = 2), nt(params, 2)) + expect_equal(getFeedingLevel(params, time_range = 2), nt(params, 2), + ignore_attr = TRUE) gears <- unique(gear_params(params)$gear) effort <- array(0, dim = c(3, 4), dimnames = list(time = 2020:2022, gear = gears)) sim <- project(params, effort = effort, dt = 1) - expect_identical(getFeedingLevel(sim, time_range = 2021:2022)[1, , ], - nt(params, 2021)) + expect_equal(getFeedingLevel(sim, time_range = 2021:2022)[1, , ], + nt(params, 2021), ignore_attr = TRUE) #TODO: extend this }) @@ -149,11 +151,11 @@ test_that("encounter and mortality functions are called", { dynamics_fun = "test_dyn", encounter_fun = "test_dyn", mort_fun = "test_dyn") - expect_identical(getEncounter(p), e + 111) + expect_equal(getEncounter(p), e + 111, ignore_attr = TRUE) p <- setComponent(params, "test", 1, dynamics_fun = "test_dyn", mort_fun = "test_dyn") - expect_identical(getMort(p), m + 111) + expect_equal(getMort(p), m + 111, ignore_attr = TRUE) }) test_that("We can access simulation results", { diff --git a/tests/testthat/test-project_methods.R b/tests/testthat/test-project_methods.R index 104bbc9b0..681fc6a1b 100644 --- a/tests/testthat/test-project_methods.R +++ b/tests/testthat/test-project_methods.R @@ -74,7 +74,7 @@ test_that("External encounter is included", { # add something of the right dimension extra_enc <- params@mu_b ext_encounter(params) <- ext_encounter(params) + extra_enc - expect_identical(getEncounter(params), enc + extra_enc) + expect_equal(getEncounter(params), enc + extra_enc, ignore_attr = TRUE) }) # getFeedingLevel ----------------------------------------- @@ -87,7 +87,7 @@ test_that("getFeedingLevel for MizerParams", { # A crap test - just returns what's already in the function encounter <- getEncounter(params, n = n, n_pp = n_full) f <- encounter / (encounter + params@intake_max) - expect_identical(fl, f) + expect_equal(fl, f, ignore_attr = TRUE) # test value # expect_known_value(fl, "values/getFeedingLevel") # expect_snapshot(round(fl, 5)) # round to take into account different rounding errors depending on OS @@ -104,10 +104,11 @@ test_that("getFeedingLevel for MizerSim", { expect_identical(dimnames(fl)$w, dimnames(params@initial_n)$w) time_range <- 20 expect_length(dim(getFeedingLevel(sim, time_range = time_range)), 3) - expect_identical( + expect_equal( getFeedingLevel(sim, time_range = time_range)[1, , ], getFeedingLevel(sim@params, sim@n[as.character(time_range), , ], - sim@n_pp[as.character(time_range), ]) + sim@n_pp[as.character(time_range), ]), + ignore_attr = TRUE ) }) @@ -340,8 +341,8 @@ test_that("getFMort", { fmg22 <- fmg22 + fmg2[i, , ] fmg33 <- fmg33 + fmg3[, i, , ] } - expect_equal(f1, fmg11) - expect_equal(f2, fmg22) + expect_equal(f1, fmg11, ignore_attr = TRUE) + expect_equal(f2, fmg22, ignore_attr = TRUE) expect_equal(f3, fmg33) # expect_known_value(f1, "values/getFMort") # expect_snapshot(f1) @@ -406,8 +407,8 @@ test_that("getMort", { z <- getMort(params, n, n_full, effort = effort2) # test dim expect_identical(dim(z), c(no_sp, no_w)) - expect_identical(dimnames(z)$prey, dimnames(params@initial_n)$sp) - expect_identical(dimnames(z)$w_prey, dimnames(params@initial_n)$w) + expect_identical(dimnames(z)$sp, dimnames(params@initial_n)$sp) + expect_identical(dimnames(z)$w, dimnames(params@initial_n)$w) # Look at numbers in species 1 f <- getFMort(params, effort2) m2 <- getPredMort(params, n, n_full) @@ -465,11 +466,11 @@ test_that("getERepro", { e <- getEReproAndGrowth(params, n = n, n_pp = n_full) e_repro <- params@psi * e e_repro[e_repro <= 0] <- 0 - expect_identical(es, e_repro) + expect_equal(es, e_repro, ignore_attr = TRUE) e_growth <- getEGrowth(params, n, n_full) e_growth_man <- e - es e_growth_man[e_growth_man <= 0] <- 0 - expect_identical(e_growth, e_growth_man) + expect_equal(e_growth, e_growth_man, ignore_attr = TRUE) # expect_known_value(es, "values/getERepro") # expect_snapshot(es) expect_snapshot_value(es, style = 'json2', tolerance = 1e-5) # round to take into account different rounding errors depending on OS From 6b56ba261f9a807597f22d38b6eb5454357f08f1 Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 26 Feb 2026 11:39:01 +0000 Subject: [PATCH 2/8] refactor: centralize dimnames assignment for MizerRate objects within the constructor. --- R/MizerRate-class.R | 3 +++ R/rate_functions.R | 10 ---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/R/MizerRate-class.R b/R/MizerRate-class.R index 11e676450..55568fbed 100644 --- a/R/MizerRate-class.R +++ b/R/MizerRate-class.R @@ -35,6 +35,9 @@ MizerRate <- function(x, rate_name = NULL, units = NULL, params = NULL) { if (!is.matrix(x)) { stop("`x` must be a matrix.") } + if (!is.null(params)) { + dimnames(x) <- dimnames(params@metab) + } structure(x, class = c("MizerRate", "matrix", "array"), rate_name = rate_name, diff --git a/R/rate_functions.R b/R/rate_functions.R index 1924d230a..da8c9423b 100644 --- a/R/rate_functions.R +++ b/R/rate_functions.R @@ -86,7 +86,6 @@ getEncounter.MizerParams <- function(params, n = initialN(params), ) f <- get(params@rates_funcs$Encounter) encounter <- f(params, n = n, n_pp = n_pp, n_other = n_other, t = t) - dimnames(encounter) <- dimnames(params@metab) MizerRate(encounter, rate_name = "Encounter rate", units = "g/year", params = params) } @@ -149,7 +148,6 @@ getFeedingLevel.MizerParams <- function(object, n, n_pp, n_other, encounter = getEncounter(params, n, n_pp, n_other, t = t), t = t) - dimnames(feeding_level) <- dimnames(params@metab) return(MizerRate(feeding_level, rate_name = "Feeding level", params = params)) } @@ -252,7 +250,6 @@ getEReproAndGrowth.MizerParams <- function(params, n = initialN(params), encounter = getEncounter(params, n, n_pp, n_other, t = t), feeding_level = getFeedingLevel(params, n, n_pp, n_other, time_range = t)) - dimnames(e) <- dimnames(params@metab) MizerRate(e, rate_name = "Energy for growth and reproduction", units = "g/year", params = params) } @@ -365,7 +362,6 @@ getPredMort.MizerParams <- function(object, n, n_pp, n_other, pred_mort <- f(params, n = n, n_pp = n_pp, n_other = n_other, t = t, pred_rate = getPredRate(params, n = n, n_pp = n_pp, n_other = n_other, t = t)) - dimnames(pred_mort) <- dimnames(params@metab) MizerRate(pred_mort, rate_name = "Predation mortality", units = "1/year", params = params) } @@ -677,7 +673,6 @@ getFMort.MizerParams <- function(object, effort, time_range, drop = TRUE) { pred_mort = getPredMort(params, n = n, n_pp = n_pp, n_other = n_other, time_range = t)) - dimnames(fmort) <- dimnames(params@metab) fmort <- MizerRate(fmort, rate_name = "Fishing mortality", units = "1/year", params = params) return(fmort) @@ -689,7 +684,6 @@ getFMort.MizerParams <- function(object, effort, time_range, drop = TRUE) { pred_mort = getPredMort(params, n = n, n_pp = n_pp, n_other = n_other, time_range = t)) - dimnames(fmort) <- dimnames(params@metab) fmort <- MizerRate(fmort, rate_name = "Fishing mortality", units = "1/year", params = params) return(fmort) @@ -782,7 +776,6 @@ getMort.MizerParams <- function(params, f_mort = getFMort(params, effort), pred_mort = getPredMort(params, n = n, n_pp = n_pp, n_other = n_other, time_range = t)) - dimnames(z) <- dimnames(params@metab) return(MizerRate(z, rate_name = "Total mortality", units = "1/year", params = params)) } @@ -841,7 +834,6 @@ getERepro.MizerParams <- function(params, n = initialN(params), erepro <- f(params, n = n, n_pp = n_pp, n_other = n_other, t = t, e = getEReproAndGrowth(params, n = n, n_pp = n_pp, n_other = n_other, t = t)) - dimnames(erepro) <- dimnames(params@metab) MizerRate(erepro, rate_name = "Energy for reproduction", units = "g/year", params = params) } @@ -898,7 +890,6 @@ getEGrowth.MizerParams <- function(params, n = initialN(params), n_other = n_other, t = t), e = getEReproAndGrowth(params, n = n, n_pp = n_pp, n_other = n_other, t = t)) - dimnames(g) <- dimnames(params@metab) MizerRate(g, rate_name = "Growth rate", units = "g/year", params = params) } @@ -1081,7 +1072,6 @@ getFlux.MizerParams <- function(params, n = initialN(params), flux[mask_below] <- 0 } - dimnames(flux) <- dimnames(params@metab) MizerRate(flux, rate_name = "Flux", units = "1/year", params = params) } From 5ea6fd0796d590333353db18516ea7718d02e1d8 Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 9 Apr 2026 11:59:30 +0100 Subject: [PATCH 3/8] Fix tests to ignore attributes where necessary --- tests/testthat/test-project_methods.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-project_methods.R b/tests/testthat/test-project_methods.R index 8696c1c57..e8539133e 100644 --- a/tests/testthat/test-project_methods.R +++ b/tests/testthat/test-project_methods.R @@ -64,7 +64,7 @@ test_that("getEncounter returns with correct dimnames", { expect_identical(dimnames(enc), dimnames(params@initial_n)) }) -test_that("mizerEncounter is independent of volume", { +test_that("getEncounter is independent of volume", { enc <- getEncounter(params) enc_r <- getEncounter(params_r) expect_equal(enc, enc_r) @@ -139,7 +139,8 @@ test_that("getFeedingLevel is independent of volume", { test_that("getCriticalFeedingLevel matches metab over intake_max times alpha", { expected <- params@metab / params@intake_max / params@species_params$alpha - expect_equal(getCriticalFeedingLevel(params), expected) + expect_equal(getCriticalFeedingLevel(params), expected, + ignore_attr = c("rate_name", "units", "class")) }) # getPredRate ------------------------------------------------------------- @@ -495,7 +496,7 @@ test_that("mizerEReproAndGrowth, mizerERepro and mizerEGrowth follow formulas", expected_e <- sweep((1 - feeding_level) * encounter, 1, params@species_params$alpha, "*", check.margin = FALSE) - params@metab - expect_equal(e, expected_e) + expect_equal(e, expected_e, ignore_attr = c("rate_name", "units", "class")) e_test <- e e_test[1, 1] <- -1 From 881ec192e5ea7528ed857c4b8cc180d658492d4f Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 9 Apr 2026 11:59:54 +0100 Subject: [PATCH 4/8] Update NEWS.md --- NEWS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS.md b/NEWS.md index 72174b621..518aab836 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,12 @@ # Development version 2.5.4.9101 +- New `MizerRate` S3 class for the species x size arrays returned by rate + functions such as `getEncounter()`, `getFeedingLevel()`, `getEReproAndGrowth()`, + etc. A `MizerRate` object behaves like a regular matrix for arithmetic and + subsetting, but carries a human-readable `rate_name` and `units` attribute and + provides enhanced `print()`, `summary()`, `plot()`, and `as.data.frame()` + methods. + - New `expandSizeGrid()` function expands the size grid of a `MizerParams` object to a new minimum and/or maximum size while preserving all existing species data. From acbda7e48ff913a6950494a0ad637aa7ead75f6a Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 9 Apr 2026 12:12:26 +0100 Subject: [PATCH 5/8] Update documentation --- NAMESPACE | 9 ++++++ R/rate_functions.R | 58 +++++++++++++++++++--------------- man/MizerRate.Rd | 42 ++++++++++++++++++++++++ man/getCriticalFeedingLevel.Rd | 2 +- man/getEGrowth.Rd | 3 +- man/getERepro.Rd | 2 +- man/getEReproAndGrowth.Rd | 23 ++------------ man/getESpawning.Rd | 2 +- man/getEncounter.Rd | 4 +-- man/getFMort.Rd | 9 +++--- man/getFeedingLevel.Rd | 13 ++++---- man/getFlux.Rd | 3 +- man/getM2.Rd | 12 +++---- man/getMort.Rd | 2 +- man/getPredMort.Rd | 12 +++---- man/getZ.Rd | 2 +- man/is.MizerRate.Rd | 21 ++++++++++++ man/plot.MizerRate.Rd | 52 ++++++++++++++++++++++++++++++ pkgdown/_pkgdown.yml | 2 ++ 19 files changed, 194 insertions(+), 79 deletions(-) create mode 100644 man/MizerRate.Rd create mode 100644 man/is.MizerRate.Rd create mode 100644 man/plot.MizerRate.Rd diff --git a/NAMESPACE b/NAMESPACE index 4ba32f6ca..3e5fd12ab 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method("[",MizerRate) S3method("catchability<-",MizerParams) S3method("diffusion<-",MizerParams) S3method("ext_encounter<-",MizerParams) @@ -23,12 +24,14 @@ S3method("resource_rate<-",MizerParams) S3method("search_vol<-",MizerParams) S3method("selectivity<-",MizerParams) S3method("species_params<-",MizerParams) +S3method(Ops,MizerRate) S3method(addSpecies,MizerParams) S3method(age_mat,MizerParams) S3method(age_mat_vB,MizerParams) S3method(age_mat_vB,data.frame) S3method(age_mat_vB,default) S3method(animateSpectra,MizerSim) +S3method(as.data.frame,MizerRate) S3method(calculated_species_params,MizerParams) S3method(calibrateBiomass,MizerParams) S3method(calibrateNumber,MizerParams) @@ -131,6 +134,8 @@ S3method(plotYieldGear,MizerSim) S3method(plotYieldObservedVsModel,MizerParams) S3method(plotYieldObservedVsModel,MizerSim) S3method(pred_kernel,MizerParams) +S3method(print,MizerRate) +S3method(print,summary.MizerRate) S3method(project,MizerParams) S3method(project,MizerSim) S3method(projectToSteady,MizerParams) @@ -197,6 +202,7 @@ export("selectivity<-") export("species_params<-") export(BevertonHoltRDD) export(MizerParams) +export(MizerRate) export(MizerSim) export(N) export(NOther) @@ -312,6 +318,7 @@ export(initialNResource) export(initial_effort) export(intake_max) export(interaction_matrix) +export(is.MizerRate) export(knife_edge) export(l2w) export(log_breaks) @@ -342,6 +349,7 @@ export(newSingleSpeciesParams) export(newTraitParams) export(noRDD) export(other_params) +export(plot.MizerRate) export(plotBiomass) export(plotBiomassObservedVsModel) export(plotDataFrame) @@ -418,6 +426,7 @@ export(sigmoid_weight) export(species_params) export(steady) export(steadySingleSpecies) +export(summary.MizerRate) export(truncated_lognormal_pred_kernel) export(validEffortVector) export(validGearParams) diff --git a/R/rate_functions.R b/R/rate_functions.R index 66ef9346d..3b2bb53aa 100644 --- a/R/rate_functions.R +++ b/R/rate_functions.R @@ -53,12 +53,14 @@ getRates.MizerParams <- function(params, n = initialN(params), } #' Get encounter rate -#' +#' #' Returns the rate at which a predator of species \eqn{i} and #' weight \eqn{w} encounters food (grams/year). -#' +#' #' @inherit mizerEncounter -#' +#' +#' @return A `MizerRate` object (predator species x predator size) with the +#' encounter rates. #' @export #' @family rate functions #' @examples @@ -105,13 +107,12 @@ getEncounter.MizerParams <- function(params, n = initialN(params), #' @param drop If `TRUE` then any dimension of length 1 will be removed #' from the returned array. #' -#' @return If a `MizerParams` object is passed in, the function returns a two -#' dimensional array (predator species x predator size) based on the -#' abundances also passed in. -#' If a `MizerSim` object is passed in, the function returns a three -#' dimensional array (time step x predator species x predator size) with the -#' feeding level calculated at every time step in the simulation. -#' If \code{drop = TRUE} then the dimension of length 1 will be removed from +#' @return If a `MizerParams` object is passed in, returns a `MizerRate` object +#' (predator species x predator size) with the feeding level. +#' If a `MizerSim` object is passed in, returns a three-dimensional array +#' (time step x predator species x predator size) with the feeding level at +#' every time step. +#' If \code{drop = TRUE} then dimensions of length 1 will be removed from #' the returned array. #' #' @export @@ -188,7 +189,7 @@ getFeedingLevel.MizerSim <- function(object, n, n_pp, n_other, #' growth or reproduction. #' #' @param params A MizerParams object -#' @return A matrix (species x size) with the critical feeding level +#' @return A `MizerRate` object (species x size) with the critical feeding level #' @export #' @examples #' \donttest{ @@ -215,7 +216,9 @@ getCriticalFeedingLevel.MizerParams <- function(params) { #' @inheritParams mizerRates #' #' @inherit mizerEReproAndGrowth -#' +#' +#' @return A `MizerRate` object (species x size) with the energy rate +#' \eqn{E_{r.i}(w)} available for growth and reproduction (grams/year). #' @export #' @seealso The part of this energy rate that is invested into growth is #' calculated with [getEGrowth()] and the part that is invested into @@ -319,12 +322,12 @@ getPredRate.MizerParams <- function(params, n = initialN(params), #' @inheritParams getFeedingLevel #' #' @return -#' If a `MizerParams` object is passed in, the function returns a two -#' dimensional array (prey species x prey size) based on the abundances also -#' passed in. If a `MizerSim` object is passed in, the function returns a -#' three dimensional array (time step x prey species x prey size) with the -#' predation mortality calculated at every time step in the simulation. -#' Dimensions may be dropped if they have length 1 unless `drop = FALSE`. +#' If a `MizerParams` object is passed in, returns a `MizerRate` object +#' (prey species x prey size) with the predation mortality rates. +#' If a `MizerSim` object is passed in, returns a three-dimensional array +#' (time step x prey species x prey size) with the predation mortality at +#' every time step. Dimensions may be dropped if they have length 1 unless +#' `drop = FALSE`. #' @family rate functions #' @export #' @examples @@ -585,10 +588,11 @@ getFMortGear.MizerSim <- function(object, effort, time_range) { #' dimensions of length 1 be dropped, e.g. if your community only has one #' species it might make presentation of results easier. Default is TRUE. #' -#' @return An array. If the effort argument has a time dimension, or object is -#' of class `MizerSim`, the output array has three dimensions (time x -#' species x size). If the effort argument does not have a time dimension, the -#' output array has two dimensions (species x size). +#' @return If a `MizerParams` object is passed in without a time-dimensioned +#' effort, returns a `MizerRate` object (species x size) with the fishing +#' mortality rates. If the effort argument has a time dimension, or a +#' `MizerSim` object is passed in, returns a three-dimensional array +#' (time x species x size). #' #' The `effort` argument is only used if a `MizerParams` object is #' passed in. The `effort` argument can be a two dimensional array (time x @@ -737,7 +741,7 @@ getFMort.MizerSim <- function(object, effort, time_range, drop = TRUE) { #' @param effort A numeric vector of the effort by gear or a single numeric #' effort value which is used for all gears. #' -#' @return A two dimensional array (prey species x prey size). +#' @return A `MizerRate` object (species x size) with the total mortality rates. #' #' @export #' @seealso [getPredMort()], [getFMort()] @@ -798,7 +802,7 @@ getZ <- getMort #' @inherit mizerERepro #' @inheritParams mizerRates #' -#' @return A two dimensional array (prey species x prey size) holding +#' @return A `MizerRate` object (species x size) holding #' \deqn{\psi_i(w)\max(0, E_{r.i}(w))} #' where \eqn{E_{r.i}(w)} is the rate at which energy becomes available for #' growth and reproduction, calculated with [getEReproAndGrowth()], @@ -858,7 +862,8 @@ getESpawning <- getERepro #' @inherit mizerEGrowth #' @inheritParams mizerRates #' -#' @return A two dimensional array (prey species x prey size) +#' @return A `MizerRate` object (species x size) with the somatic growth rates +#' (grams/year). #' @export #' @seealso [getERepro()], [getEReproAndGrowth()] #' @family rate functions @@ -1010,7 +1015,8 @@ getRDD.MizerParams <- function(params, n = initialN(params), #' #' @inheritParams mizerRates #' -#' @return A two dimensional array (prey species x prey size) +#' @return A `MizerRate` object (species x size) with the flux of individuals +#' entering each size class (numbers/year). #' @export #' @seealso [getEGrowth()], [getRDD()] #' @family rate functions diff --git a/man/MizerRate.Rd b/man/MizerRate.Rd new file mode 100644 index 000000000..50d489442 --- /dev/null +++ b/man/MizerRate.Rd @@ -0,0 +1,42 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/MizerRate-class.R +\name{MizerRate} +\alias{MizerRate} +\title{S3 class for species x size rate arrays} +\usage{ +MizerRate(x, rate_name = NULL, units = NULL, params = NULL) +} +\arguments{ +\item{x}{A matrix (species x size).} + +\item{rate_name}{A string giving the human-readable name for the rate.} + +\item{units}{A string giving the units (e.g. "g/year", "1/year").} + +\item{params}{A \code{MizerParams} object. Currently unused but reserved for +future extensions.} +} +\value{ +A \code{MizerRate} object (inherits from \code{matrix} and \code{array}). +} +\description{ +Many rate functions in mizer return two-dimensional arrays (species x size) +holding rates like encounter rate, feeding level, growth rate, mortality etc. +The \code{MizerRate} class wraps these arrays to provide convenient \code{print()}, +\code{summary()}, \code{plot()}, and \code{as.data.frame()} methods. +} +\details{ +A \code{MizerRate} object behaves just like a regular matrix for arithmetic +operations and subsetting. It carries two lightweight attributes: +\itemize{ +\item \code{rate_name} – a human-readable name for the rate (e.g. "Encounter rate"). +\item \code{units} – the units of the rate (e.g. "g/year"). +} +} +\examples{ +\donttest{ +enc <- getEncounter(NS_params) +is.MizerRate(enc) +summary(enc) +} +} diff --git a/man/getCriticalFeedingLevel.Rd b/man/getCriticalFeedingLevel.Rd index 47559ef45..73b769c9d 100644 --- a/man/getCriticalFeedingLevel.Rd +++ b/man/getCriticalFeedingLevel.Rd @@ -10,7 +10,7 @@ getCriticalFeedingLevel(params) \item{params}{A MizerParams object} } \value{ -A matrix (species x size) with the critical feeding level +A \code{MizerRate} object (species x size) with the critical feeding level } \description{ The critical feeding level is the feeding level at which the food intake is diff --git a/man/getEGrowth.Rd b/man/getEGrowth.Rd index cb67a7716..7bc2ac8da 100644 --- a/man/getEGrowth.Rd +++ b/man/getEGrowth.Rd @@ -30,7 +30,8 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (prey species x prey size) +A \code{MizerRate} object (species x size) with the somatic growth rates +(grams/year). } \description{ Calculates the energy rate \eqn{g_i(w)} (grams/year) available by species and diff --git a/man/getERepro.Rd b/man/getERepro.Rd index 30a857c4b..126c1147c 100644 --- a/man/getERepro.Rd +++ b/man/getERepro.Rd @@ -30,7 +30,7 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (prey species x prey size) holding +A \code{MizerRate} object (species x size) holding \deqn{\psi_i(w)\max(0, E_{r.i}(w))} where \eqn{E_{r.i}(w)} is the rate at which energy becomes available for growth and reproduction, calculated with \code{\link[=getEReproAndGrowth]{getEReproAndGrowth()}}, diff --git a/man/getEReproAndGrowth.Rd b/man/getEReproAndGrowth.Rd index c9eb52498..670e5ffe1 100644 --- a/man/getEReproAndGrowth.Rd +++ b/man/getEReproAndGrowth.Rd @@ -30,27 +30,8 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (species x size) holding -\deqn{E_{r.i}(w) = \alpha_i\, (1 - {\tt feeding\_level}_i(w))\, - {\tt encounter}_i(w) - {\tt metab}_i(w).}{ - E_{r.i}(w) = alpha_i * (1 - feeding_level_i(w)) * - encounter_i(w) - metab_i(w).} -Due to the form of the feeding level, calculated by -\code{\link[=getFeedingLevel]{getFeedingLevel()}}, if the feeding level is nonzero this can also be expressed as -\deqn{E_{r.i}(w) = \alpha_i\, {\tt feeding\_level}_i(w)\, - h_i(w) - {\tt metab}_i(w)}{ - E_{r.i}(w) = alpha_i * feeding_level_i(w) * - h_i(w) - metab_i(w))} -where \eqn{h_i} is the maximum intake rate, set with -\code{\link[=setMaxIntakeRate]{setMaxIntakeRate()}}. However this function is using the first equation -above so that it works also when the maximum intake rate is infinite, i.e., -there is no satiation. -The assimilation rate \eqn{\alpha_i} is taken from the species parameter -data frame in \code{params}. The metabolic rate \code{metab} is taken from -\code{params} and set with \code{\link[=setMetabolicRate]{setMetabolicRate()}}. - -The return value can be negative, which means that the energy intake does not -cover the cost of metabolism and movement. +A \code{MizerRate} object (species x size) with the energy rate +\eqn{E_{r.i}(w)} available for growth and reproduction (grams/year). } \description{ Calculates the energy rate \eqn{E_{r.i}(w)} (grams/year) available for diff --git a/man/getESpawning.Rd b/man/getESpawning.Rd index af5cbf1e1..42d47771c 100644 --- a/man/getESpawning.Rd +++ b/man/getESpawning.Rd @@ -30,7 +30,7 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (prey species x prey size) holding +A \code{MizerRate} object (species x size) holding \deqn{\psi_i(w)\max(0, E_{r.i}(w))} where \eqn{E_{r.i}(w)} is the rate at which energy becomes available for growth and reproduction, calculated with \code{\link[=getEReproAndGrowth]{getEReproAndGrowth()}}, diff --git a/man/getEncounter.Rd b/man/getEncounter.Rd index 42e4481d0..009fe36c0 100644 --- a/man/getEncounter.Rd +++ b/man/getEncounter.Rd @@ -30,8 +30,8 @@ parameters.)} \item{...}{Unused} } \value{ -A named two dimensional array (predator species x predator size) with -the encounter rates. +A \code{MizerRate} object (predator species x predator size) with the +encounter rates. } \description{ Returns the rate at which a predator of species \eqn{i} and diff --git a/man/getFMort.Rd b/man/getFMort.Rd index 2e0184992..a896967a0 100644 --- a/man/getFMort.Rd +++ b/man/getFMort.Rd @@ -23,10 +23,11 @@ dimensions of length 1 be dropped, e.g. if your community only has one species it might make presentation of results easier. Default is TRUE.} } \value{ -An array. If the effort argument has a time dimension, or object is -of class \code{MizerSim}, the output array has three dimensions (time x -species x size). If the effort argument does not have a time dimension, the -output array has two dimensions (species x size). +If a \code{MizerParams} object is passed in without a time-dimensioned +effort, returns a \code{MizerRate} object (species x size) with the fishing +mortality rates. If the effort argument has a time dimension, or a +\code{MizerSim} object is passed in, returns a three-dimensional array +(time x species x size). The \code{effort} argument is only used if a \code{MizerParams} object is passed in. The \code{effort} argument can be a two dimensional array (time x diff --git a/man/getFeedingLevel.Rd b/man/getFeedingLevel.Rd index f74c665e1..72401f9c6 100644 --- a/man/getFeedingLevel.Rd +++ b/man/getFeedingLevel.Rd @@ -26,13 +26,12 @@ from the returned array.} \item{...}{Unused} } \value{ -If a \code{MizerParams} object is passed in, the function returns a two -dimensional array (predator species x predator size) based on the -abundances also passed in. -If a \code{MizerSim} object is passed in, the function returns a three -dimensional array (time step x predator species x predator size) with the -feeding level calculated at every time step in the simulation. -If \code{drop = TRUE} then the dimension of length 1 will be removed from +If a \code{MizerParams} object is passed in, returns a \code{MizerRate} object +(predator species x predator size) with the feeding level. +If a \code{MizerSim} object is passed in, returns a three-dimensional array +(time step x predator species x predator size) with the feeding level at +every time step. +If \code{drop = TRUE} then dimensions of length 1 will be removed from the returned array. } \description{ diff --git a/man/getFlux.Rd b/man/getFlux.Rd index 68b8cc836..73fd3cca9 100644 --- a/man/getFlux.Rd +++ b/man/getFlux.Rd @@ -30,7 +30,8 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (prey species x prey size) +A \code{MizerRate} object (species x size) with the flux of individuals +entering each size class (numbers/year). } \description{ Calculates the flux \eqn{J_i(w)} (numbers/year) entering each size class diff --git a/man/getM2.Rd b/man/getM2.Rd index 965eef83a..71a5a654f 100644 --- a/man/getM2.Rd +++ b/man/getM2.Rd @@ -26,12 +26,12 @@ from the returned array.} \item{...}{Unused} } \value{ -If a \code{MizerParams} object is passed in, the function returns a two -dimensional array (prey species x prey size) based on the abundances also -passed in. If a \code{MizerSim} object is passed in, the function returns a -three dimensional array (time step x prey species x prey size) with the -predation mortality calculated at every time step in the simulation. -Dimensions may be dropped if they have length 1 unless \code{drop = FALSE}. +If a \code{MizerParams} object is passed in, returns a \code{MizerRate} object +(prey species x prey size) with the predation mortality rates. +If a \code{MizerSim} object is passed in, returns a three-dimensional array +(time step x prey species x prey size) with the predation mortality at +every time step. Dimensions may be dropped if they have length 1 unless +\code{drop = FALSE}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/getMort.Rd b/man/getMort.Rd index d99d68afe..dbe7bf403 100644 --- a/man/getMort.Rd +++ b/man/getMort.Rd @@ -34,7 +34,7 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (prey species x prey size). +A \code{MizerRate} object (species x size) with the total mortality rates. } \description{ Calculates the total mortality rate \eqn{\mu_i(w)} (in units 1/year) on each diff --git a/man/getPredMort.Rd b/man/getPredMort.Rd index eea6b7f88..4d99b5280 100644 --- a/man/getPredMort.Rd +++ b/man/getPredMort.Rd @@ -26,12 +26,12 @@ from the returned array.} \item{...}{Unused} } \value{ -If a \code{MizerParams} object is passed in, the function returns a two -dimensional array (prey species x prey size) based on the abundances also -passed in. If a \code{MizerSim} object is passed in, the function returns a -three dimensional array (time step x prey species x prey size) with the -predation mortality calculated at every time step in the simulation. -Dimensions may be dropped if they have length 1 unless \code{drop = FALSE}. +If a \code{MizerParams} object is passed in, returns a \code{MizerRate} object +(prey species x prey size) with the predation mortality rates. +If a \code{MizerSim} object is passed in, returns a three-dimensional array +(time step x prey species x prey size) with the predation mortality at +every time step. Dimensions may be dropped if they have length 1 unless +\code{drop = FALSE}. } \description{ Calculates the total predation mortality rate \eqn{\mu_{p,i}(w_p)} (in units diff --git a/man/getZ.Rd b/man/getZ.Rd index 6e1d83240..6f4e3ea7b 100644 --- a/man/getZ.Rd +++ b/man/getZ.Rd @@ -34,7 +34,7 @@ parameters.)} \item{...}{Unused} } \value{ -A two dimensional array (prey species x prey size). +A \code{MizerRate} object (species x size) with the total mortality rates. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/is.MizerRate.Rd b/man/is.MizerRate.Rd new file mode 100644 index 000000000..79d225a6a --- /dev/null +++ b/man/is.MizerRate.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/MizerRate-class.R +\name{is.MizerRate} +\alias{is.MizerRate} +\title{Test if an object is a MizerRate} +\usage{ +is.MizerRate(x) +} +\arguments{ +\item{x}{An object to test.} +} +\value{ +\code{TRUE} if \code{x} is a \code{MizerRate} object, \code{FALSE} otherwise. +} +\description{ +Test if an object is a MizerRate +} +\examples{ +is.MizerRate(getEncounter(NS_params)) +is.MizerRate(matrix(1:4, nrow = 2)) +} diff --git a/man/plot.MizerRate.Rd b/man/plot.MizerRate.Rd new file mode 100644 index 000000000..c7f1aec91 --- /dev/null +++ b/man/plot.MizerRate.Rd @@ -0,0 +1,52 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/MizerRate-class.R +\name{plot.MizerRate} +\alias{plot.MizerRate} +\title{Plot a MizerRate object} +\usage{ +plot.MizerRate( + x, + params = NULL, + species = NULL, + all.sizes = FALSE, + highlight = NULL, + return_data = FALSE, + log_x = TRUE, + ... +) +} +\arguments{ +\item{x}{A \code{MizerRate} object.} + +\item{params}{A \code{MizerParams} object. Used for species colours, linetypes, +and size ranges. If \code{NULL}, a basic plot is produced.} + +\item{species}{Character vector of species to include. \code{NULL} (default) means +all species.} + +\item{all.sizes}{If \code{FALSE} (default), values outside a species' size range +(\code{w_min} to \code{w_max}) are removed. Only effective when \code{params} is provided.} + +\item{highlight}{Name or vector of names of the species to be highlighted.} + +\item{return_data}{If \code{TRUE}, return the data frame instead of the plot.} + +\item{log_x}{If \code{TRUE} (default), use a log10 x-axis.} + +\item{...}{Further arguments (currently unused).} +} +\value{ +A ggplot2 object, unless \code{return_data = TRUE}, in which case a data +frame with the variables 'w', 'value', 'Species' is returned. +} +\description{ +Plots the rate against size for each species, using species colours and +linetypes from the MizerParams object. +} +\examples{ +\donttest{ +plot(getEncounter(NS_params), NS_params) +plot(getFeedingLevel(NS_params), NS_params, + species = c("Cod", "Herring")) +} +} diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index d3790718c..4d88ba6b5 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -250,6 +250,8 @@ reference: - validSim - MizerSim - getParams + - MizerRate + - is.MizerRate - title: Example parameter sets desc: More example parameter sets are available via From 2a6d718eb790b819ef37c7fc70c9eb2e6e639169 Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 9 Apr 2026 12:14:52 +0100 Subject: [PATCH 6/8] Explain MizerRate class in developer vignette --- vignettes/developer_vignette.Rmd | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/vignettes/developer_vignette.Rmd b/vignettes/developer_vignette.Rmd index abb384eb8..b96bf9fab 100644 --- a/vignettes/developer_vignette.Rmd +++ b/vignettes/developer_vignette.Rmd @@ -309,6 +309,74 @@ already there for other similar slots. --> +## The MizerRate class + +Many rate functions in mizer — `getEncounter()`, `getFeedingLevel()`, +`getPredMort()`, `getMort()`, `getEReproAndGrowth()`, `getERepro()`, +`getEGrowth()`, `getFMort()`, `getFlux()`, and `getCriticalFeedingLevel()` — +return a `MizerRate` object. This is a lightweight S3 class that wraps a +species × size matrix and attaches two extra attributes: + +- `rate_name`: a human-readable label (e.g. `"Encounter rate"`). +- `units`: the physical units of the rate (e.g. `"g/year"` or `"1/year"`). + +### Behaviour + +A `MizerRate` object behaves exactly like a regular matrix for subsetting and +arithmetic. Subsetting with `[` preserves the class as long as the result is +still a 2-D matrix; arithmetic operators (via `Ops.MizerRate`) strip the class +and return a plain matrix. This means you can use `MizerRate` objects +transparently in calculations without worrying about attribute contamination. + +```{r eval=FALSE} +enc <- getEncounter(NS_params) +is.MizerRate(enc) # TRUE +enc["Cod", "100"] # still a MizerRate +enc * 2 # plain matrix — class is stripped by Ops.MizerRate +``` + +### Enhanced output methods + +`MizerRate` provides `print()`, `summary()`, `plot()`, and `as.data.frame()` +methods designed for quick inspection of rate arrays: + +```{r eval=FALSE} +enc <- getEncounter(NS_params) +print(enc) # one-line min/mean/max per species +summary(enc) # tabular summary per species +plot(enc, NS_params) # line plot vs. size, coloured by species +as.data.frame(enc) # long-format data frame with columns w, value, Species +``` + +The `plot()` method accepts a `params` argument so it can use the species +colours and linetypes stored in the `MizerParams` object, and it restricts each +species' curve to its natural size range (`w_min` to `w_max`) unless +`all.sizes = TRUE`. + +### Wrapping your own rate functions + +If you write a custom rate function that replaces one of the built-in `mizer*` +functions (see `?setRateFunction`), you do **not** need to return a `MizerRate`: +the `get*` wrapper that calls your function is responsible for wrapping the +result. Your function should return a plain numeric matrix with the correct +dimensions (species × size) and dimnames. + +If you write a new standalone rate function that is meant to be called directly +by users, you may want to wrap its result yourself: + +```{r eval=FALSE} +myRateFunction <- function(params, ...) { + result <- # ... compute a species x size matrix ... + MizerRate(result, rate_name = "My rate", units = "1/year", params = params) +} +``` + +The `params` argument to `MizerRate()` is used only to copy `dimnames` from +`params@metab` onto the result, so that species names and size labels are +set consistently. + +You can test whether an object is a `MizerRate` with `is.MizerRate()`. + # Condition handling system Mizer should make good use of R's condition handling system, which is well described at https://adv-r.hadley.nz/conditions.html. Currently this is being only in a small number of places in the code. Search the code for `signal()` and `withCallingHandlers()` to find those places. From 4babe795b17c103aedaf425db996fa110d2ad5c5 Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 9 Apr 2026 12:17:28 +0100 Subject: [PATCH 7/8] Adding plotting of rates to plotting vignette --- vignettes/plotting.Rmd | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/vignettes/plotting.Rmd b/vignettes/plotting.Rmd index a0e6b7c40..a41ba25ad 100644 --- a/vignettes/plotting.Rmd +++ b/vignettes/plotting.Rmd @@ -177,6 +177,57 @@ plot_ly(biomass_frame) %>% Again note the American spelling "colors" required by plotly. +## Plotting rate functions + +Functions such as `getEncounter()`, `getFeedingLevel()`, `getMort()`, +`getEGrowth()` and others return a `MizerRate` object — a species × size matrix +that carries a human-readable name and units. These objects have their own +`plot()` method that produces a ggplot directly, so no `melt()` step is needed: + +```{r} +fl <- getFeedingLevel(params) +plot(fl, params) +``` + +The `params` argument is optional but recommended: it supplies the species +colours, linetypes, and size ranges stored in the `MizerParams` object, and it +restricts each species' curve to its natural size range (`w_min` to `w_max`). + +You can select a subset of species with the `species` argument: + +```{r} +plot(fl, params, species = c("Cod", "Herring", "Sprat")) +``` + +Because the result is an ordinary ggplot object you can add layers or themes +in the usual way: + +```{r} +plot(fl, params) + + geom_hline(yintercept = 0.6, linetype = "dashed", colour = "grey50") + + labs(title = "Feeding level at steady state") +``` + +If you need a data frame instead — for example to pass to `plot_ly()` or to +combine with other data — use `as.data.frame()`: + +```{r} +fl_df <- as.data.frame(fl) +str(fl_df) +``` + +This gives a long-format data frame with columns `w`, `value`, and `Species`, +which can be handed directly to `ggplot()` or `plot_ly()`: + +```{r warning=FALSE} +ggplot(fl_df) + + geom_line(aes(x = w, y = value, colour = Species)) + + scale_colour_manual(values = getColours(params)) + + scale_x_log10() + + labs(y = "Feeding level") +``` + + ## Plotting spectra Of course mizer has the `plotSpectra()` function for plotting size spectra. From 437770bd5efed5d570f3496a0c70c38cc51d8e18 Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 9 Apr 2026 12:53:50 +0100 Subject: [PATCH 8/8] Change plot() and summary() from S4 generic to S3 generic --- NAMESPACE | 10 ++- NEWS.md | 5 ++ R/plots.R | 84 +++++++++---------- R/summary_methods.R | 8 +- man/plot.MizerRate.Rd | 2 +- man/plotMizerParams.Rd | 8 +- man/plotMizerSim.Rd | 8 +- ...arams-method.Rd => summary.MizerParams.Rd} | 6 +- ...MizerSim-method.Rd => summary.MizerSim.Rd} | 6 +- vignettes/developer_vignette.Rmd | 20 +++++ 10 files changed, 89 insertions(+), 68 deletions(-) rename man/{summary-MizerParams-method.Rd => summary.MizerParams.Rd} (79%) rename man/{summary-MizerSim-method.Rd => summary.MizerSim.Rd} (80%) diff --git a/NAMESPACE b/NAMESPACE index 3e5fd12ab..5a9f334a6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -114,6 +114,9 @@ S3method(matchNumbers,MizerParams) S3method(matchYields,MizerParams) S3method(maturity,MizerParams) S3method(metab,MizerParams) +S3method(plot,MizerParams) +S3method(plot,MizerRate) +S3method(plot,MizerSim) S3method(plotBiomass,MizerSim) S3method(plotBiomassObservedVsModel,MizerParams) S3method(plotBiomassObservedVsModel,MizerSim) @@ -173,6 +176,9 @@ S3method(setSearchVolume,MizerParams) S3method(species_params,MizerParams) S3method(steady,MizerParams) S3method(steadySingleSpecies,MizerParams) +S3method(summary,MizerParams) +S3method(summary,MizerRate) +S3method(summary,MizerSim) S3method(w,MizerParams) S3method(w_full,MizerParams) export("catchability<-") @@ -349,7 +355,6 @@ export(newSingleSpeciesParams) export(newTraitParams) export(noRDD) export(other_params) -export(plot.MizerRate) export(plotBiomass) export(plotBiomassObservedVsModel) export(plotDataFrame) @@ -426,7 +431,6 @@ export(sigmoid_weight) export(species_params) export(steady) export(steadySingleSpecies) -export(summary.MizerRate) export(truncated_lognormal_pred_kernel) export(validEffortVector) export(validGearParams) @@ -441,8 +445,6 @@ export(w2l) export(w_full) exportClasses(MizerParams) exportClasses(MizerSim) -exportMethods(plot) -exportMethods(summary) import(assertthat) import(dplyr) import(ggplot2) diff --git a/NEWS.md b/NEWS.md index 518aab836..dc5419bfc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # Development version 2.5.4.9101 +- The `plot()` and `summary()` methods for `MizerParams`, `MizerSim`, and + `MizerRate` objects are now registered as S3 methods rather than S4 methods. + This means `plot()` and `summary()` remain plain S3 generics when mizer is + loaded, avoiding interference with S4 method dispatch for other packages. + - New `MizerRate` S3 class for the species x size arrays returned by rate functions such as `getEncounter()`, `getFeedingLevel()`, `getEReproAndGrowth()`, etc. A `MizerRate` object behaves like a regular matrix for arithmetic and diff --git a/R/plots.R b/R/plots.R index 5134666a6..d1aa7f953 100644 --- a/R/plots.R +++ b/R/plots.R @@ -1693,36 +1693,33 @@ plot_diet <- function(params, n, diet, species, return_data) { #' @seealso [plotting_functions] #' @rdname plotMizerSim #' @name plotMizerSim -#' @aliases plot,MizerSim,missing-method #' @examples #' \donttest{ #' params <- NS_params #' sim <- project(params, effort=1, t_max=20, t_save = 2, progress_bar = FALSE) #' plot(sim) #' } -setMethod("plot", signature(x = "MizerSim", y = "missing"), - function(x, ...) { - p1 <- plotFeedingLevel(x, ...) - p2 <- plotSpectra(x, ...) - p3 <- plotBiomass(x, y_ticks = 3, ...) - p4 <- plotPredMort(x, ...) - p5 <- plotFMort(x, ...) - grid::grid.newpage() - glayout <- grid::grid.layout(3, 2) # widths and heights arguments - vp <- grid::viewport(layout = glayout) - grid::pushViewport(vp) - vplayout <- function(x, y) { - grid::viewport(layout.pos.row = x, layout.pos.col = y) - } - print(p1 + theme(legend.position = "none"), vp = vplayout(1, 1)) - print(p3 + theme(legend.position = "none"), vp = vplayout(1, 2)) - print(p4 + theme(legend.position = "none"), vp = vplayout(2, 1)) - print(p5 + theme(legend.position = "none"), vp = vplayout(2, 2)) - print(p2 + theme(legend.position = "right", - legend.key.size = unit(0.1, "cm")), - vp = vplayout(3, 1:2)) - } -) +plot.MizerSim <- function(x, ...) { + p1 <- plotFeedingLevel(x, ...) + p2 <- plotSpectra(x, ...) + p3 <- plotBiomass(x, y_ticks = 3, ...) + p4 <- plotPredMort(x, ...) + p5 <- plotFMort(x, ...) + grid::grid.newpage() + glayout <- grid::grid.layout(3, 2) # widths and heights arguments + vp <- grid::viewport(layout = glayout) + grid::pushViewport(vp) + vplayout <- function(x, y) { + grid::viewport(layout.pos.row = x, layout.pos.col = y) + } + print(p1 + theme(legend.position = "none"), vp = vplayout(1, 1)) + print(p3 + theme(legend.position = "none"), vp = vplayout(1, 2)) + print(p4 + theme(legend.position = "none"), vp = vplayout(2, 1)) + print(p5 + theme(legend.position = "none"), vp = vplayout(2, 2)) + print(p2 + theme(legend.position = "right", + legend.key.size = unit(0.1, "cm")), + vp = vplayout(3, 1:2)) +} #' Summary plot for `MizerParams` objects #' @@ -1739,29 +1736,26 @@ setMethod("plot", signature(x = "MizerSim", y = "missing"), #' @family plotting functions #' @seealso [plotting_functions] #' @name plotMizerParams -#' @aliases plot,MizerParams,missing-method #' @examples #' \donttest{ #' params <- NS_params #' plot(params) #' } -setMethod("plot", signature(x = "MizerParams", y = "missing"), - function(x, ...) { - params <- validParams(x) - p11 <- plotFeedingLevel(params, ...) - p2 <- plotSpectra(params, ...) - p12 <- plotPredMort(params, ...) - grid::grid.newpage() - glayout <- grid::grid.layout(2, 2) # widths and heights arguments - vp <- grid::viewport(layout = glayout) - grid::pushViewport(vp) - vplayout <- function(x, y) { - grid::viewport(layout.pos.row = x, layout.pos.col = y) - } - print(p11 + theme(legend.position = "none"), vp = vplayout(1, 1)) - print(p12 + theme(legend.position = "none"), vp = vplayout(1, 2)) - print(p2 + theme(legend.position = "right", - legend.key.size = unit(0.1, "cm")), - vp = vplayout(2, 1:2)) - } -) +plot.MizerParams <- function(x, ...) { + params <- validParams(x) + p11 <- plotFeedingLevel(params, ...) + p2 <- plotSpectra(params, ...) + p12 <- plotPredMort(params, ...) + grid::grid.newpage() + glayout <- grid::grid.layout(2, 2) # widths and heights arguments + vp <- grid::viewport(layout = glayout) + grid::pushViewport(vp) + vplayout <- function(x, y) { + grid::viewport(layout.pos.row = x, layout.pos.col = y) + } + print(p11 + theme(legend.position = "none"), vp = vplayout(1, 1)) + print(p12 + theme(legend.position = "none"), vp = vplayout(1, 2)) + print(p2 + theme(legend.position = "right", + legend.key.size = unit(0.1, "cm")), + vp = vplayout(2, 1:2)) +} diff --git a/R/summary_methods.R b/R/summary_methods.R index a628d938e..d815ba6e8 100644 --- a/R/summary_methods.R +++ b/R/summary_methods.R @@ -600,7 +600,7 @@ get_size_range_array <- function(params, min_w = min(params@w), #' @concept summary_function #' @examples #' summary(NS_params) -setMethod("summary", signature(object = "MizerParams"), function(object, ...) { +summary.MizerParams <- function(object, ...) { params <- validParams(object) cat("An object of class \"", as.character(class(params)), "\" \n", sep = "") cat("Consumer size spectrum:\n") @@ -632,7 +632,7 @@ setMethod("summary", signature(object = "MizerParams"), function(object, ...) { toString(splist)), "\n") } invisible(params) -}) +} #### summary for MizerSim #### @@ -646,7 +646,7 @@ setMethod("summary", signature(object = "MizerParams"), function(object, ...) { #' @concept summary_function #' @examples #' summary(NS_sim) -setMethod("summary", signature(object = "MizerSim"), function(object, ...) { +summary.MizerSim <- function(object, ...) { cat("An object of class \"", as.character(class(object)), "\" \n", sep = "") cat("Parameters:\n") summary(object@params) @@ -661,7 +661,7 @@ setMethod("summary", signature(object = "MizerSim"), function(object, ...) { as.numeric(dimnames(object@n)$time)[2] - as.numeric(dimnames(object@n)$time)[1], " years\n", sep = "") invisible(object) -}) +} # Indicator functions #### #' Description of indicator functions diff --git a/man/plot.MizerRate.Rd b/man/plot.MizerRate.Rd index c7f1aec91..39ca39be6 100644 --- a/man/plot.MizerRate.Rd +++ b/man/plot.MizerRate.Rd @@ -4,7 +4,7 @@ \alias{plot.MizerRate} \title{Plot a MizerRate object} \usage{ -plot.MizerRate( +\method{plot}{MizerRate}( x, params = NULL, species = NULL, diff --git a/man/plotMizerParams.Rd b/man/plotMizerParams.Rd index 8dc28370f..1029b2aba 100644 --- a/man/plotMizerParams.Rd +++ b/man/plotMizerParams.Rd @@ -2,18 +2,18 @@ % Please edit documentation in R/plots.R \name{plotMizerParams} \alias{plotMizerParams} -\alias{plot,MizerParams,missing-method} +\alias{plot.MizerParams} \title{Summary plot for \code{MizerParams} objects} \usage{ -\S4method{plot}{MizerParams,missing}(x, y, ...) +\method{plot}{MizerParams}(x, ...) } \arguments{ \item{x}{An object of class \linkS4class{MizerParams}} -\item{y}{Not used} - \item{...}{For additional arguments see the documentation for \code{\link[=plotFeedingLevel]{plotFeedingLevel()}},\code{\link[=plotSpectra]{plotSpectra()}},\code{\link[=plotPredMort]{plotPredMort()}}} + +\item{y}{Not used} } \value{ A viewport object diff --git a/man/plotMizerSim.Rd b/man/plotMizerSim.Rd index 3c39f68d8..6594b51f4 100644 --- a/man/plotMizerSim.Rd +++ b/man/plotMizerSim.Rd @@ -2,20 +2,20 @@ % Please edit documentation in R/plots.R \name{plotMizerSim} \alias{plotMizerSim} -\alias{plot,MizerSim,missing-method} +\alias{plot.MizerSim} \title{Summary plot for \code{MizerSim} objects} \usage{ -\S4method{plot}{MizerSim,missing}(x, y, ...) +\method{plot}{MizerSim}(x, ...) } \arguments{ \item{x}{An object of class \linkS4class{MizerSim}} -\item{y}{Not used} - \item{...}{For additional arguments see the documentation for \code{\link[=plotBiomass]{plotBiomass()}}, \code{\link[=plotFeedingLevel]{plotFeedingLevel()}},\code{\link[=plotSpectra]{plotSpectra()}},\code{\link[=plotPredMort]{plotPredMort()}} and \code{\link[=plotFMort]{plotFMort()}}.} + +\item{y}{Not used} } \value{ A viewport object diff --git a/man/summary-MizerParams-method.Rd b/man/summary.MizerParams.Rd similarity index 79% rename from man/summary-MizerParams-method.Rd rename to man/summary.MizerParams.Rd index 7419ab2e2..fe8272f7a 100644 --- a/man/summary-MizerParams-method.Rd +++ b/man/summary.MizerParams.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/summary_methods.R -\name{summary,MizerParams-method} -\alias{summary,MizerParams-method} +\name{summary.MizerParams} +\alias{summary.MizerParams} \title{Summarize MizerParams object} \usage{ -\S4method{summary}{MizerParams}(object, ...) +\method{summary}{MizerParams}(object, ...) } \arguments{ \item{object}{A \code{MizerParams} object.} diff --git a/man/summary-MizerSim-method.Rd b/man/summary.MizerSim.Rd similarity index 80% rename from man/summary-MizerSim-method.Rd rename to man/summary.MizerSim.Rd index f293b14b9..60722f53f 100644 --- a/man/summary-MizerSim-method.Rd +++ b/man/summary.MizerSim.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/summary_methods.R -\name{summary,MizerSim-method} -\alias{summary,MizerSim-method} +\name{summary.MizerSim} +\alias{summary.MizerSim} \title{Summarize MizerSim object} \usage{ -\S4method{summary}{MizerSim}(object, ...) +\method{summary}{MizerSim}(object, ...) } \arguments{ \item{object}{A \code{MizerSim} object.} diff --git a/vignettes/developer_vignette.Rmd b/vignettes/developer_vignette.Rmd index b96bf9fab..69c80670c 100644 --- a/vignettes/developer_vignette.Rmd +++ b/vignettes/developer_vignette.Rmd @@ -278,6 +278,26 @@ mizer code, because the code avoids using S4 methods. In the presentation below we assume that the `MizerParams` object is called `params` and the `MizerSim` object is called `sim`. +Although `MizerParams` and `MizerSim` are S4 classes, mizer registers all +their methods as S3 methods rather than S4 methods. For example, the summary +plot for a `MizerParams` object is defined as `plot.MizerParams()` and +registered with `S3method(plot, MizerParams)` in the NAMESPACE, not via +`setMethod("plot", "MizerParams", ...)`. This works because S3 dispatch reads +the `class()` attribute of an object, which S4 objects have, so +`plot(params)` correctly finds `plot.MizerParams()`. + +The reason for preferring S3 is that calling `setMethod()` on a function that +is not already an S4 generic silently promotes it to one, changing dispatch +semantics package-wide. For instance, if mizer used `setMethod("plot", ...)`, +then `plot` would become an S4 generic for all code running in the same R +session. This can cause hard-to-diagnose failures when `plot()` is called with +objects of mixed S3/S4 types, because S4 dispatch requires an exact method +match on all arguments rather than falling back gracefully to S3 methods. + +In short: use S3 methods (named `generic.ClassName`) for `MizerParams` and +`MizerSim`, and avoid `setMethod()` unless you are extending a generic that is +already S4 in a dependency. + ## The MizerParams class An object of class 'MizerParams' holds all the information needed for the