Skip to content

Commit

Permalink
Merge branch 'FEAT-update-testing-fixtures' of https://github.com/PIF…
Browse files Browse the repository at this point in the history
…SCstockassessments/ss3diags into FEAT-update-testing-fixtures
  • Loading branch information
MOshima-PIFSC committed Jul 11, 2023
2 parents 5914793 + a5ee9f9 commit 877a017
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
24 changes: 12 additions & 12 deletions tests/testthat/SSmase_test.R
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
## File is deprecated by MOshima 6/12/23

#library(ss3diags)
# library(ss3diags)
# Tests
# sma = r4ss::SSsummarize(retro.sma)
# Check joint MASE for indices
#SSmase(retro.sma)
# SSmase(retro.sma)
# select indices
#SSmase(retro.sma, indexselect = c(4))
# SSmase(retro.sma, indexselect = c(4))
# check for length comps
# smaL = ss3diags::SSretroComps(retro.sma)
#SSmase(retro.sma, quants = "len", indexselect = 2:4)
# SSmase(retro.sma, quants = "len", indexselect = 2:4)

# check manually
#mase <- SSmase(retro.sma, residuals = T)
# mase <- SSmase(retro.sma, residuals = T)
# Joint mase from index 1, 3,4
#mae <- apply(
# mae <- apply(
# mase$Residuals[c("Pred.Res", "Naive.Res")], 2,
# function(x) mean(abs(x))
#)
# )
# MASE
#mae[1] / mae[2]
# mae[1] / mae[2]
# compare
#SSmase(retro.sma)
# SSmase(retro.sma)

# Check hake
# phk= r4ss::SSsummarize(retro.phk)
#SSmase(retro.phk, verbose = T, indexselect = 1)
# SSmase(retro.phk, verbose = T, indexselect = 1)
# check for age comps
#phkA <- ss3diags::SSretroComps(retro.phk)
#SSmase(retro.phk, quants = "age")
# phkA <- ss3diags::SSretroComps(retro.phk)
# SSmase(retro.phk, quants = "age")
4 changes: 2 additions & 2 deletions tests/testthat/test-HCxval.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Test script for hindcast cross validation and MASE

#retroSimple <- ss3diags::retroSimple
#retrosum.simple <- r4ss::SSsummarize(retroSimple)
# retroSimple <- ss3diags::retroSimple
# retrosum.simple <- r4ss::SSsummarize(retroSimple)

path <- file.path(tempdir(), "test_runs")
dir.create(path, showWarnings = FALSE)
Expand Down
28 changes: 14 additions & 14 deletions tests/testthat/test-plotJABBA.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Test script for JABBA residual plot
simple <- r4ss::SS_output(dir = test_example_path, verbose=FALSE, printstats = FALSE)
simple <- r4ss::SS_output(dir = test_example_path, verbose = FALSE, printstats = FALSE)

path <- file.path(tempdir(), "test_runs")
dir.create(path, showWarnings = FALSE)
Expand Down Expand Up @@ -30,19 +30,19 @@ test_that("file of simple_len_jabbaresiduals plot exists", {
})

## CAAL uncomment when con option is finished in function
#test_that("file of simple_con_jabbaresiduals plot exists", {
#
#SSplotJABBAres(simple,
#use_png = TRUE,
#print_plot = TRUE,
#subplots = "con",
#plotdir = path,
#filenameprefix = "simple_con_"
#)

#expect_true(file.exists(file.path(path, "simple_con_jabbaresidual.png")))
#
#})
# test_that("file of simple_con_jabbaresiduals plot exists", {
#
# SSplotJABBAres(simple,
# use_png = TRUE,
# print_plot = TRUE,
# subplots = "con",
# plotdir = path,
# filenameprefix = "simple_con_"
# )

# expect_true(file.exists(file.path(path, "simple_con_jabbaresidual.png")))
#
# })

test_that("calculate RMSE for CPUE index", {
rmse <- SSrmse(simple, quants = "cpue")
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-runs-test.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
simple <- r4ss::SS_output(dir = test_example_path, verbose=FALSE, printstats = FALSE)
simple <- r4ss::SS_output(dir = test_example_path, verbose = FALSE, printstats = FALSE)

#### Simple Model ###############################################################

Expand Down Expand Up @@ -127,11 +127,11 @@ test_that("runs test works with simple model", {
run_cpue <- SSrunstest(simple, quants = "len", indexselect = 2)
expect_match(run_cpue$Index, "SURVEY1")

# CAAL since switching to simple_small, there is no conditional-age-at-length data.
#run_con <- SSrunstest(simple, quants = "con")
# CAAL since switching to simple_small, there is no conditional-age-at-length data.
# run_con <- SSrunstest(simple, quants = "con")

#expect_match(run_con$Index, "Fishery")
#expect_match(run_con$test, "Passed")
# expect_match(run_con$Index, "Fishery")
# expect_match(run_con$test, "Passed")
})


Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-uncertainty.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test script for evaluating model uncertainty
simple <- r4ss::SS_output(dir = test_example_path, verbose=FALSE, printstats = FALSE)
simple <- r4ss::SS_output(dir = test_example_path, verbose = FALSE, printstats = FALSE)


mvln.msy <- SSdeltaMVLN(simple, Fref = "MSY")
Expand Down

0 comments on commit 877a017

Please sign in to comment.