Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"updatePackages": true
},
"ghcr.io/rocker-org/devcontainer-features/r-packages:1": {
"packages": "covr,dplyr,devtools,ggplot2,graphics,jsonlite,github::noaa-afsc/SparseNUTS,methods,Rcpp,RcppEigen,scales,snowfall,TMB,tibble,tidyr,usethis",
"packages": "covr,dplyr,devtools,furrr,future,ggplot2,graphics,jsonlite,github::noaa-afsc/SparseNUTS,methods,Rcpp,RcppEigen,scales,snowfall,TMB,tibble,tidyr,usethis,yardstick",
"installSystemRequirements": true
}
},
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/call-update-data-r.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Update data files in /data whenever changes are made to files in /data-raw.
# This workflow automatically commits changes directly to the working branch.
name: call-update-data-r

on:
push:
paths:
- 'R/**'
- 'inst/**'
- 'data/**'
- 'data-raw/**'
- 'src/**'
workflow_dispatch:

jobs:
call-workflow:
if: github.repository == 'NOAA-FIMS/FIMS'
uses: NOAA-FIMS/ecosystemom/.github/workflows/update-data-r.yml@main
secrets:
PAT: ${{ secrets.PAT }}
with:
commit-directly: true
Comment thread
Bai-Li-NOAA marked this conversation as resolved.
18 changes: 15 additions & 3 deletions .github/workflows/run-slow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
name: ${{ matrix.os }}
# Adds the split test categories to the matrix
test_type:
- slow
- integration-caa
- integration-fims-bayesian
- integration-fims-estimation-random-effects
- integration-fleet
- integration-proportion

name: ${{ matrix.os }} (${{ matrix.test_type }})
runs-on: ${{ matrix.os }}

env:
Expand Down Expand Up @@ -85,13 +94,16 @@ jobs:
needs: check

- name: Run Slow Tests Only
env:
TEST_FILTER: ${{ matrix.test_type }}
shell: Rscript {0}
run: |
# Windows-specific fix for the "files too big" error
if (Sys.info()[["sysname"]] == "Windows") {
withr::local_options(pkg.build_extra_flags = FALSE)
}

# The filter looks for files with 'slow' in the name
devtools::test(filter = "slow")
filter_pattern <- Sys.getenv("TEST_FILTER")
message(paste("Running test suite matching filter:", filter_pattern))

devtools::test(filter = filter_pattern)
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@
src/tmp.def

#Testing files
tests/test_plan/FIMS_Integration_Test_Plan.log
tests/integration/FIMS-deterministic-inputs/
tests/testthat/fixtures/fit*.RDS
tests/testthat/fixtures/data*.RDS
tests/testthat/fixtures/parameters*.RDS
Expand Down
42 changes: 0 additions & 42 deletions R/data_.R

This file was deleted.

119 changes: 119 additions & 0 deletions R/data_big.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#' FIMS input data frame
#'
#' A data frame containing the information needed to run an age-structured stock
#' assessment model in FIMS. This data was generated using
#' the `ASSAMC` package written for the [model comparison project](
#' www.github.com/NOAA-FIMS/Age_Structured_Stock_Assessment_Model_Comparison).
#' The source code to make this dataset is in `data-raw/data_big.R` which is on
#' GitHub but will not be in your local installation because it is in the
#' .Rbuildignore file.
#'
#' @format
#' A data frame with `r NROW(data_big)` observations of `r NCOL(data_big)`
#' variables:
#' \describe{
#' \item{type}{The type of input the row contains. Allowed types include
#' `r glue::glue_collapse(fims_input_types, sep = ", ", last = ", and ")`.}
#' \item{fleet}{A character string providing the name of the information
#' source that the input was collected from, e.g., `"Trawl fishery"` or
#' `"age_zero_survey"`. Entries can be `NA` for information that is not
#' fleet/vessel specific.}
#' \item{age}{An integer age. Entry can be `NA` if information pertains to
#' multiple ages, e.g., total landings rather than landings of age-4 fish.
#' In this dataset, ages start at one, therefore recruitment happens at age
#' one not age zero.}
#' \item{length}{A numeric length. Entry can be `NA` if information doesn't
#' pertain to length.}
#' \item{timing}{The timing, i.e., year the data was collected.}
#' \item{value}{The measurement of interest.}
#' \item{unit}{A character string specifying the units of `value`. Allowed
#' units for each data type are as follows. `mt` is used for `index`,
#' `landings`, and `weight_at_age` data. `number` or `proportion` are each
#' viable units for the composition data, where the former is the preferred
#' unit of measurement.}
#' \item{uncertainty}{A real value providing a measurement of uncertainty
#' for value. For landings and indices of abundance this should be
#' the standard deviation of the logged observations if you are using the
#' lognormal distribution to fit your data. For composition data it will
#' be your input sample size.
#' }
#' }
#' @source \url{www.github.com/NOAA-FIMS/Age_Structured_Stock_Assessment_Model_Comparison}
"data_big"

#' FIMS parameters tibble
#'
#' A tibble containing the parameters needed to run an age-structured stock
#' assessment model in FIMS. This data was generated using the `ASSAMC` package
#' written for the [model comparison project](www.github.com/NOAA-FIMS/Age_Structured_Stock_Assessment_Model_Comparison).
#' The source code to make this dataset is in `data-raw/parameters_.R` which is
#' on GitHub but will not be in your local installation because it is in the .Rbuildignore file.
#'
#' @format
#' A tibble with `r NROW(parameters_big)` observations of `r NCOL(parameters_big)` variables:
#' \describe{
#' \item{\code{model_family}:}{The specified model family (e.g.,
#' "catch_at_age").}
#' \item{\code{module_name}:}{The name of the FIMS module (e.g.,
#' "Data", "Selectivity", "Recruitment", "Growth", "Maturity"). These
#' entries are always written in PascalCase to match the names used in the
#' C++ code.}
#' \item{\code{fleet}:}{The name of the fleet the module applies to. This
#' will be `NA` for non-fleet-specific modules like "Recruitment".}
#' \item{\code{data}:}{A list-column containing a `tibble` with detailed
#' parameters. Unnesting this column reveals:
#' \describe{
#' \item{\code{module_type}:}{The specific type of the module (e.g.,
#' "Logistic" for a "Selectivity" module). This column will always be
#' written in PascalCase to match the names used in the C++ code.}
#' \item{\code{label}:}{The name of the parameter (e.g.,
#' "inflection_point").}
#' \item{\code{age}:}{The age the parameter applies to.}
#' \item{\code{length}:}{The length bin the parameter applies to.}
#' \item{\code{time}:}{The time step (i.e., year) the parameter applies
#' to.}
#' \item{\code{value}:}{The initial value of the parameter.}
#' \item{\code{estimation_type}:}{The type of estimation (e.g.,
#' "constant", "fixed_effects", "random_effects").}
#' \item{\code{distribution_type}:}{The type of distribution (e.g.,
#' "Data", "process"), where a process distribution can refer to a
#' fixed effect or a random effect but it does not fit to data, e.g.,
#' recruitment deviations.}
#' \item{\code{distribution}:}{The name of distribution (e.g.,
#' "Dlnorm", `Dmultinom`). The column will always be written in
#' PascalCase to match the names used in the C++ code.}
#' }
#' }
#' }
#' @source \url{www.github.com/NOAA-FIMS/Age_Structured_Stock_Assessment_Model_Comparison}
"parameters_big"

#' FIMS fit
#'
#' An object of class `FIMSFit`, where the structure is the same
#' regardless if `optimize = TRUE` or not. Uncertainty information is only
#' included in the `estimates` slot if `get_sd = TRUE`.
#'
#' @format
#' An object of class `FIMSFit` with the following slots:
#' `r paste(slotNames(fit_with_optimization_big), collapse = ", ")`
#' @rdname fit_with_optimization_big
"fit_with_optimization_big"

#' @rdname fit_with_optimization_big
"fit_without_optimization_big"

#' FIMS estimates
#'
#' A tibble containing the estimates from a fitted FIMS model. The structure is
#' the same regardless if `optimize = TRUE` or not. Uncertainty information is
#' only included if `get_sd = TRUE`.
#' @format
#' A tibble with `r NROW(estimates_with_optimization_big)`
#' observations of `r NCOL(estimates_with_optimization_big)` variables:
#' `r paste(colnames(estimates_with_optimization_big), collapse = ", ")`
#' @rdname estimates_with_optimization_big
"estimates_with_optimization_big"

#' @rdname estimates_with_optimization_big
"estimates_without_optimization_big"
4 changes: 2 additions & 2 deletions R/fimsframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,11 @@ methods::setValidity(
present_types <- unique(object@data[["type"]])

# Issues warning if there are any unrecognized types
unknown_types <- sort(setdiff(present_types, fims_input_types))
unknown_types <- sort(setdiff(present_types, FIMS::fims_input_types))
if (length(unknown_types) > 0) {
cli::cli_warn(c(
"!" = "Data contains unexpected type{?s}: {.var {unknown_types}}.",
"i" = "Allowed types are: {.var {fims_input_types}}.",
"i" = "Allowed types are: {.var {FIMS::fims_input_types}}.",
"i" = "Model will run but check that data types are correct."
))
}
Expand Down
Loading
Loading