Skip to content

Commit

Permalink
refactor distribution names
Browse files Browse the repository at this point in the history
  • Loading branch information
msupernaw committed Nov 17, 2024
1 parent 325e436 commit 8b0dbda
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 168 deletions.
6 changes: 3 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export(Parameter)
export(ParameterVector)
export(Population)
export(SetFIMSFunctions)
export(TMBDlnormDistribution)
export(TMBDmultinomDistribution)
export(TMBDnormDistribution)
export(DlnormDistribution)
export(DmultinomDistribution)
export(DnormDistribution)
export(ToJSON)
export(clear)
export(clear_logs)
Expand Down
8 changes: 4 additions & 4 deletions inst/include/interface/rcpp/rcpp_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "rcpp_objects/rcpp_population.hpp"
#include "rcpp_objects/rcpp_recruitment.hpp"
#include "rcpp_objects/rcpp_selectivity.hpp"
#include "rcpp_objects/rcpp_tmb_distribution.hpp"
#include "rcpp_objects/rcpp_distributions.hpp"


SEXP FIMS_objective_function;
Expand Down Expand Up @@ -724,7 +724,7 @@ RCPP_MODULE(fims) {
.method("get_id", &EWAAGrowthInterface::get_id)
.method("evaluate", &EWAAGrowthInterface::evaluate);

Rcpp::class_<DnormDistributionsInterface>("TMBDnormDistribution")
Rcpp::class_<DnormDistributionsInterface>("DnormDistribution")
.constructor()
.method("get_id", &DnormDistributionsInterface::get_id, "Returns a unique ID for the Dnorm distribution class.")
.method("evaluate", &DnormDistributionsInterface::evaluate, "Evaluates the normal distribution given input data and parameter values.")
Expand All @@ -734,7 +734,7 @@ RCPP_MODULE(fims) {
.field("expected_values", &DnormDistributionsInterface::expected_values, "Mean of the distribution.")
.field("log_sd", &DnormDistributionsInterface::log_sd, "The natural log of the standard deviation.");

Rcpp::class_<DlnormDistributionsInterface>("TMBDlnormDistribution")
Rcpp::class_<DlnormDistributionsInterface>("DlnormDistribution")
.constructor()
.method("get_id", &DlnormDistributionsInterface::get_id, "Returns a unique ID for the Dnorm distribution class.")
.method("evaluate", &DlnormDistributionsInterface::evaluate, "Evaluates the normal distribution given input data and parameter values.")
Expand All @@ -744,7 +744,7 @@ RCPP_MODULE(fims) {
.field("expected_values", &DlnormDistributionsInterface::expected_values, "Mean of the distribution on the log scale.")
.field("log_sd", &DlnormDistributionsInterface::log_sd, "The natural log of the standard deviation of the distribution on the log scale.");

Rcpp::class_<DmultinomDistributionsInterface>("TMBDmultinomDistribution")
Rcpp::class_<DmultinomDistributionsInterface>("DmultinomDistribution")
.constructor()
.method("get_id", &DmultinomDistributionsInterface::get_id, "Returns a unique ID for the Dnorm distribution class.")
.method("evaluate", &DmultinomDistributionsInterface::evaluate, "Evaluates the normal distribution given input data and parameter values.")
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-fims-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# fleet1 = list(
# selectivity = list(form = "LogisticSelectivity"),
# data_distribution = c(
# Index = "TMBDlnormDistribution",
# AgeComp = "TMBDmultinomDistribution"
# Index = "DlnormDistribution",
# AgeComp = "DmultinomDistribution"
# )
# ),
# survey1 = list(
# selectivity = list(form = "LogisticSelectivity"),
# data_distribution = c(
# Index = "TMBDlnormDistribution",
# AgeComp = "TMBDmultinomDistribution"
# Index = "DlnormDistribution",
# AgeComp = "DmultinomDistribution"
# )
# )
# )
Expand All @@ -24,7 +24,7 @@
# fleets = fleets,
# recruitment = list(
# form = "BevertonHoltRecruitment",
# process_distribution = c(log_devs = "TMBDnormDistribution")
# process_distribution = c(log_devs = "DnormDistribution")
# ),
# growth = list(form = "EWAAgrowth"),
# maturity = list(form = "LogisticMaturity")
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-integration-fims-estimation-with-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ fleets <- list(
fleet1 = list(
selectivity = list(form = "LogisticSelectivity"),
data_distribution = c(
Index = "TMBDlnormDistribution",
AgeComp = "TMBDmultinomDistribution"
Index = "DlnormDistribution",
AgeComp = "DmultinomDistribution"
)
),
survey1 = list(
selectivity = list(form = "LogisticSelectivity"),
data_distribution = c(
Index = "TMBDlnormDistribution",
AgeComp = "TMBDmultinomDistribution"
Index = "DlnormDistribution",
AgeComp = "DmultinomDistribution"
)
)
)
Expand All @@ -25,7 +25,7 @@ default_parameters <- data_mile1 |>
fleets = fleets,
recruitment = list(
form = "BevertonHoltRecruitment",
process_distribution = c(log_devs = "TMBDnormDistribution")
process_distribution = c(log_devs = "DnormDistribution")
),
growth = list(form = "EWAAgrowth"),
maturity = list(form = "LogisticMaturity")
Expand All @@ -44,7 +44,7 @@ modified_parameters <- list(
BevertonHoltRecruitment.log_rzero.value = log(om_input_list[[1]]$R0),
BevertonHoltRecruitment.log_devs.value = om_input_list[[1]]$logR.resid[-1],
BevertonHoltRecruitment.log_devs.estimated = FALSE,
TMBDnormDistribution.log_sd.value = om_input_list[[1]]$logR_sd
DnormDistribution.log_sd.value = om_input_list[[1]]$logR_sd
),
maturity = list(
LogisticMaturity.inflection_point.value = om_input_list[[1]]$A50.mat,
Expand Down
Loading

0 comments on commit 8b0dbda

Please sign in to comment.