Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jimianelli/flatfish
Browse files Browse the repository at this point in the history
# Conflicts:
#	assessments/yfs/runs/surveyloss/yfs_red.R
  • Loading branch information
31ingrid committed Aug 28, 2020
2 parents 88fcffc + 85e590b commit 85d124b
Show file tree
Hide file tree
Showing 9 changed files with 2,499 additions and 3,057 deletions.
4,834 changes: 2,350 additions & 2,484 deletions assessments/nrs/2018/fm.cpp

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion assessments/nrs/2018/fm.htp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class model_data : public ad_comm{
data_number yr1_futcat;
data_number yr2_futcat;
data_number n_retro;
data_number surv_dwnwt;
data_number cv_inc;
data_number n_comp;
data_number eof_check;
int phase_male_sel_offset;
data_int nyrs_fut;
data_vector fut_temp;
data_int styr;
Expand Down Expand Up @@ -130,13 +135,15 @@ class model_data : public ad_comm{
dvector srv_mo_frac;
data_matrix n_wts;
data_vector growth_cov;
data_int Check;
int styr_fut;
int endyr_fut;
int num_proj_Fs;
int npfs;
dvector offset_srv;
dvector offset_fsh;
double R_guess;
data_matrix future_ABC;
~model_data();
model_data(int argc,char * argv[]);
friend class model_parameters;
Expand All @@ -149,7 +156,6 @@ public:
~model_parameters();
void preliminary_calculations(void);
void set_runtime(void);
virtual void * mycast(void) {return (void*)this;}
static int mc_phase(void)
{
return initial_params::mc_phase;
Expand All @@ -176,6 +182,12 @@ public:
return *objective_function_value::pobjfun;
}
private:
dvariable adromb(dvariable(model_parameters::*f)(const dvariable&), double a, double b, int ns)
{
using namespace std::placeholders;
_func func = std::bind(f, this, _1);
return function_minimizer::adromb(func, a, b, ns);
}
ivector integer_control_flags;
dvector double_control_flags;
param_init_vector ln_q_srv;
Expand Down Expand Up @@ -217,6 +229,7 @@ private:
param_number slope_tmp;
param_number sel50_tmp;
param_init_vector sel_slope_fsh_m;
param_init_bounded_number male_sel_offset;
param_init_bounded_matrix sel_slope_fsh_devs_m;
param_init_vector sel50_fsh_m;
param_init_bounded_matrix sel50_fsh_devs_m;
Expand Down Expand Up @@ -343,6 +356,7 @@ private:
param_stddev_number endbiom;
param_stddev_number depletion;
param_stddev_matrix future_catch;
param_stddev_vector future_Fs;
param_stddev_matrix future_SSB;
param_stddev_matrix future_TotBiom;
public:
Expand Down
109 changes: 55 additions & 54 deletions assessments/nrs/2018/mod.ctl
Original file line number Diff line number Diff line change
@@ -1,91 +1,92 @@
#Growth_Option
1
0
#ABC_age_lb
6
#
#phase_age_incr
-1
#
#phase_init_age_comp
2
#
#phase_mn_rec
1
#
#phase_rec_dev
2
#
#phase_mn_f
2
#
-6
#
#phase_F40
8
#phase_fmort
3
#
7
#
#phase_proj
6
#phase_logist_sel
4
#
#phase_logist_sel_devs
4
#
#phase_male_sel
5
#
#phase_q
5
#
-0.136
#
#q_alpha_prior
-0.336
#phase_q_alpha
-4
#
0.05
#
-5
#
#q_beta_prior
0.01
#phase_q_beta_in
-4
#phase_m_f
-6
#
#phase_m_m
-7
#
6
#
#phase_sr
-33
#phase_env_cov
-4
#
#phase_sigmaR
-5
#
#phase_wtfmsy
-4
#
#pf_sigma
0.05
#
#a50_sigma
0.35
#
#slp_sigma
0.2
#
1.5
#
0.05
#
#q_exp
1.0
#q_sigma
0.056
#m_exp
0.15
#
#m_sigma
0.2
#
#sigmaR_exp
0.6
#
#sigmaR_sigma
0.6
#
#nselages
17
1
#
1
#
300
-1
1
1
1
1
1
1
#lambda
1 1 200 1 1 1 1 1 1 1
#styr_sr
1978
#endyr_sr
2012
#styr_wt
1982
#endyr_wt
2012
#yr1_futcat
65
#yr2_futcat
65
#n_retro
0
1
#surv_dwnwt
0
#cv_inc
10
#n_comp
1
#eof_check
123456
450 changes: 0 additions & 450 deletions assessments/nrs/2018/sim.dat

Large diffs are not rendered by default.

89 changes: 45 additions & 44 deletions assessments/nrs/data/nrs_2018.dat

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion assessments/yfs/runs/surveyloss/orig/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
EXEC = fm
DIST = ../../../../../../src/
ARGS = -nox -iprint 50
ARGS = -nox -iprint 50 -hbf 1

ts := $(shell /bin/date "+%Y-%m-%d---%H-%M-%S")
pn = fmpl_$(ts)
Expand Down
10 changes: 5 additions & 5 deletions assessments/yfs/runs/surveyloss/orig/mod.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#phase_mn_f
2
#phase_F40
6
4
#phase_fmort
3
#phase_proj
7
8
#phase_logist_sel
5
#phase_logist_sel_devs
Expand Down Expand Up @@ -49,9 +49,9 @@
#pf_sigma
0.05
#a50_sigma
0.2
0.1
#slp_sigma
0.4
0.2
#q_exp
1
#q_sigma
Expand All @@ -67,7 +67,7 @@
#nselages
17
#lambda
1 1 300 -1 1 1 1 1 1 1
1 1 200 -1 1 1 1 1 1 1
#styr_sr
1978
#endyr_sr
Expand Down
23 changes: 16 additions & 7 deletions assessments/yfs/runs/surveyloss/yfs_red.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,33 @@ spp="yfs"
#6.3. Get projection results
############################################################################################################################################################
#files to copy to retrospective subfolders
j=1
j=2
i=10
#retro_sub = "retro" or "survRed_retro"
#6.1. Run for full time series
#Create main retrospective subfolder
do_run <- FALSE
df_res <- NULL
for(j in 1:length(retros_sub)) {
setwd(master)
cpto <- paste0(main_dir,"/",retros_sub[j],"0" )
fc <- paste0("mkdir -p ",cpto," ; cp orig/* ",cpto)
system("fc") #IS added "fc"
#Command line to run assessment model *.exe
setwd(file.path(main_dir,paste0(retros_sub[j],"0")))
system("make") #### CHANGE TO WHATEVER YOUR EXE IS CALLED
if (do_run) system("rm fm.std; make") #### CHANGE TO WHATEVER YOUR EXE IS CALLED
#6.2 Get tier one projections
dftmp <- data.frame(read.table("ABC_OFL.rep",header=TRUE))
dftmp$peel <- 0
dftmp$retros <- retros_sub[j]
df_res <- rbind(df_res,dftmp)
<<<<<<< HEAD
setwd(master)
for(i in 0:length(endyrvec)){
=======
for(i in 1:length(endyrvec)){
setwd(master)
>>>>>>> 85e590bda024c8467c4a2fe9a16e3e9e3af480cc
cpto <- paste0(main_dir,"/",retros_sub[j],i )
fc <- paste0("mkdir -p ",cpto," ; cp orig/* ",cpto)
system(fc)
Expand All @@ -91,18 +99,17 @@ for(j in 1:length(retros_sub)) {
ctl$n_retro <- i
ctl$surv_dwnwt <- j-1
write_dat(ctl,"mod.ctl")
system("make") #### CHANGE TO WHATEVER YOUR EXE IS CALLED
if (do_run) system("rm fm.std; make") #### CHANGE TO WHATEVER YOUR EXE IS CALLED
dftmp <- data.frame(read.table("ABC_OFL.rep",header=TRUE))
dftmp$peel <- -i
dftmp$retros <- retros_sub[j]
df_res <- rbind(df_res,dftmp)
setwd(master)
}
}
setwd(master)


6. Summarize results
#6. Summarize results
write.csv(df_res,"yfs_results.csv")
names(df_res)
# Some dumb figure----------
Expand All @@ -111,10 +118,11 @@ ggplot(aes(x=Endyr,y=SSB,color=retros)) + geom_line(size=2) + theme_few()

# Pool up retro results------------------
df_retro <- data.frame(matrix(ncol=9,nrow=0, dimnames=list(NULL, c("Year","Peel","SSB","SSB_sd","Totbio","Totbio_sd","Rec","Rec_sd","run"))))
j=1; i=2
j=1; i=4
for(j in 1:length(retros_sub)) {
for(i in 1:length(endyrvec)){
for(i in 0:length(endyrvec)){
retro_dir <- paste0(main_dir,"/",retros_sub[j],i )
print(c(retros_sub[j],i ))
rep <- read_rep(paste0(retro_dir,"/fm.rep"))
df_tmp <- data.frame(
Year = rep$SSB[,1],
Expand All @@ -132,6 +140,7 @@ for(j in 1:length(retros_sub)) {
df_retro <- rbind(df_retro,df_tmp)
}
}
setwd(master)
write.csv(df_retro,"yfs_retros.csv")

###--jim stopped here...-------------------------------------
Expand Down
Loading

0 comments on commit 85d124b

Please sign in to comment.