From 2a9a7562d1006b6c2886aefb53ab8c19ea7d1962 Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Thu, 12 May 2022 11:51:10 -0400 Subject: [PATCH 01/15] Refactor: File reading messages --- SS_prelim.tpl | 5 ++++- SS_proced.tpl | 4 ++-- SS_readcontrol_330.tpl | 9 ++++----- SS_readdata_330.tpl | 33 ++++++++++++++++++++------------- SS_readstarter.tpl | 5 +++-- 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/SS_prelim.tpl b/SS_prelim.tpl index 6d0b28bf..df8158c6 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -34,6 +34,8 @@ if (WTage_rd > 0) { ad_comm::change_datafile_name("wtatage.ss"); + echoinput << "Begin reading the empirical weight at age file" << endl; + cout << "Begin reading the empirical weight at age file" << endl; *(ad_comm::global_datafile) >> N_WTage_maxage; k = 7 + N_WTage_maxage; echoinput << " N_WTage_max " << N_WTage_maxage << endl; @@ -141,7 +143,8 @@ Wt_Age_t(styr - 3 * nseas + s, f, g) = junkvec2 / temp; } } - echoinput << "finished reading empirical wt-at-age.ss" << endl; + echoinput << "Finished reading the empirical weight at age file" << endl; + cout << "Finished reading the empirical weight at age file" << endl; } else { diff --git a/SS_proced.tpl b/SS_proced.tpl index 78706be0..aa6417d3 100644 --- a/SS_proced.tpl +++ b/SS_proced.tpl @@ -79,12 +79,12 @@ PROCEDURE_SECTION // SS_Label_Info_7.4.1 #Call fxn get_initial_conditions() to get the virgin and initial equilibrium population get_initial_conditions(); if (do_once == 1) - cout << " OK with initial conditions " << endl; + echoinput << "Finished initial_conditions" << endl; // SS_Label_Info_7.4.2 #Call fxn get_time_series() to do population calculations for each year and get expected values for observations get_time_series(); // in procedure_section if (do_once == 1) { - cout << " OK with time series" << endl; + echoinput << "Finished time_series" << endl; } // SS_Label_Info_7.4.3 #Call fxn evaluate_the_objective_function() diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index 9e1ff571..6b118ec6 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -13,8 +13,7 @@ // SS_Label_Info_4.0 #Begin Reading from Control File // /* SS_Label_Flow begin reading from control file */ ad_comm::change_datafile_name(ctlfilename); - echoinput<0) *(ad_comm::global_datafile) >> fif; - if(Do_Forecast_rd>0 && fif!=999) {cout<<" EXIT, must have 999 to verify end of forecast inputs "<0 && fif!=999) + { + cout << "EXIT, 999 should be last forecast file line, but instead read " << fif << endl; + exit(1); + } + echoinput << "Finished reading the forecast file" << endl << endl; + + TimeMax_Fcast_std = styr+(max(YrMax,endyr+50)-styr)*nseas+nseas-1; -// redefine ALK_time_max for forecast years longer than 50, but no data past 50 years - j=max(YrMax,endyr+50); - ALK_time_max=(j-styr+1)*nseas*N_subseas; // sets maximum size for data array indexing 50 years into forecast + // redefine ALK_time_max for forecast years longer than 50, but no data past 50 years + j=max(YrMax,endyr+50); + ALK_time_max=(j-styr+1)*nseas*N_subseas; // sets maximum size for data array indexing 50 years into forecast END_CALCS imatrix Show_Time(styr,TimeMax_Fcast_std,1,2) // for each t: shows year, season diff --git a/SS_readstarter.tpl b/SS_readstarter.tpl index 5ae92182..fbc310dc 100644 --- a/SS_readstarter.tpl +++ b/SS_readstarter.tpl @@ -222,7 +222,7 @@ // SS_Label_Info_1.2 #Read the starter.ss file // /* SS_Label_Flow read starter.ss */ ad_comm::change_datafile_name("starter.ss"); // get filenames - cout<<" reading from starter.ss"< Date: Thu, 12 May 2022 12:02:32 -0400 Subject: [PATCH 02/15] Style: beginning of model setup console changes --- SS_global.tpl | 1 - SS_param.tpl | 7 ++++--- SS_prelim.tpl | 15 +++++++++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/SS_global.tpl b/SS_global.tpl index c22f1053..e21b8985 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -781,7 +781,6 @@ GLOBALS_SECTION BETWEEN_PHASES_SECTION { int j_phase = current_phase(); // this is the phase to come - cout << current_phase() - 1 << " " << niter << " -log(L): " << obj_fun << " between " << endl; // SS_Label_Info_11.1 #Save last value of objective function if (j_phase > 1) diff --git a/SS_param.tpl b/SS_param.tpl index 8953426a..150dd2eb 100644 --- a/SS_param.tpl +++ b/SS_param.tpl @@ -17,7 +17,8 @@ PARAMETER_SECTION // set the filename to all ADMB output files to "ss.[ext]" ad_comm::adprogram_name = "ss"; - echoinput << "now in PARAMETER_SECTION " << endl; + echoinput << "Begin setting up parameters" << endl; + cout << "Begin setting up parameters" << endl; if (readparfile >= 1) { cout << " read parm file" << endl; @@ -564,6 +565,6 @@ PARAMETER_SECTION objective_function_value obj_fun number last_objfun vector phase_output(1,max_phase+1) - !!cout<<" end of parameter section "< Date: Thu, 12 May 2022 12:03:41 -0400 Subject: [PATCH 03/15] Style: move population dynamics output to echoinput --- SS_popdyn.tpl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/SS_popdyn.tpl b/SS_popdyn.tpl index 50ff1ed0..2f9a7b35 100644 --- a/SS_popdyn.tpl +++ b/SS_popdyn.tpl @@ -110,13 +110,13 @@ FUNCTION void get_initial_conditions() } #ifdef DO_ONCE if (do_once == 1) - cout << " MG setup OK " << endl; + echoinput << " MGsetup OK " << endl; #endif if (MG_active(2) > 0) get_growth1(); // seasonal effects and CV #ifdef DO_ONCE if (do_once == 1) - cout << " growth1 OK" << endl; + echoinput << " growth1 OK" << endl; #endif if (MG_active(2) > 0 || do_once == 1) { @@ -166,7 +166,7 @@ FUNCTION void get_initial_conditions() } #ifdef DO_ONCE if (do_once == 1) - cout << " natmort OK" << endl; + echoinput << "natmort OK" << endl; #endif if (MG_active(4) > 0) @@ -188,7 +188,9 @@ FUNCTION void get_initial_conditions() get_migration(); #ifdef DO_ONCE if (do_once == 1) - cout << " migr OK" << endl; + { + echoinput << "migr OK" << endl; + } #endif if (MG_active(7) > 0) { @@ -212,8 +214,7 @@ FUNCTION void get_initial_conditions() #ifdef DO_ONCE if (do_once == 1) { - cout << " ageerr_key OK" << endl; - echoinput << " ageerr_key recalc in " << y << endl; + echoinput << "age_err key recalc in " << y << endl; } #endif } @@ -227,7 +228,8 @@ FUNCTION void get_initial_conditions() get_selectivity(); #ifdef DO_ONCE if (do_once == 1) - cout << " selex OK, ready to call ALK and fishselex " << endl; + echoinput << "selectivity OK" << endl; + echoinput << "Calculate ALK" << endl; #endif // SS_Label_Info_23.3 #Loop seasons and subseasons @@ -316,7 +318,7 @@ FUNCTION void get_initial_conditions() #ifdef DO_ONCE if (do_once == 1) - cout << " ready for virgin age struc " << endl; + echoinput << "Begin calculating virgin age struc " << endl; #endif // SS_Label_Info_23.4 #calculate unfished (virgin) numbers-at-age eq_yr = styr - 2; @@ -405,7 +407,7 @@ FUNCTION void get_initial_conditions() // SS_Label_Info_23.5 #Calculate equilibrium using initial F #ifdef DO_ONCE if (do_once == 1) - cout << " ready for initial age struc " << endl; + echoinput << "Begin calculating initial age structure" << endl; #endif eq_yr = styr - 1; bio_yr = styr; From 777147592c4ff37848042edb8f0163ccb1a1fbe0 Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Thu, 12 May 2022 12:45:57 -0400 Subject: [PATCH 04/15] Style: remove duplicate info from console output This info is available with the default console for ADMB 13. --- SS_global.tpl | 25 ++----------------------- SS_prelim.tpl | 3 --- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/SS_global.tpl b/SS_global.tpl index e21b8985..ce0537ec 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -812,16 +812,6 @@ BETWEEN_PHASES_SECTION FINAL_SECTION { // SS_Label_Info_12.1 #Get run ending time - time(&finish); - elapsed_time = difftime(finish, start); - hour = long(elapsed_time) / 3600; - minute = long(elapsed_time) % 3600 / 60; - second = (long(elapsed_time) % 3600) % 60; - cout << endl - << "In final section " << endl; - cout << "Finish time: " << ctime(&finish); - cout << "Elapsed time: "; - cout << hour << " hours, " << minute << " minutes, " << second << " seconds." << endl; if (No_Report == 1) { @@ -830,9 +820,7 @@ FINAL_SECTION else { - cout << " Iterations: " << niter << " -log(L): " << obj_fun << endl; - cout << "Final gradient: " << objective_function_value::pobjfun->gmax << endl - << endl; + cout << " Iterations: " << niter << endl; if (objective_function_value::pobjfun->gmax > final_conv) { N_warn++; @@ -1069,16 +1057,7 @@ FINAL_SECTION warning << " N parameters are on or within 1% of min-max bound: " << Nparm_on_bound << "; check results, variance may be suspect" << endl; } warning << "N warnings: " << N_warn << endl; - cout << endl - << "!! Run has completed !! "; - if (N_warn > 0) - { - cout << "See warning.sso for N warnings: " << N_warn << endl; - } - else - { - cout << "No warnings :)" << endl; - } + cout << "See warning.sso for N warnings: " << N_warn << endl; } } // end final section diff --git a/SS_prelim.tpl b/SS_prelim.tpl index a7fa7966..b7d736f8 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -1493,9 +1493,6 @@ } else { - cout << endl - << endl - << "Begin estimating" << endl; echoinput << endl << endl << "Begin estimating" << endl; } last_objfun = 1.0e30; From 420f7c2e185e421266e941d405110a70f0561027 Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Thu, 12 May 2022 16:04:54 -0400 Subject: [PATCH 05/15] Style: additional console changes Send more messages to echoinput than cout --- SS_benchfore.tpl | 14 +++++++++----- SS_global.tpl | 39 +++++++++++++++++++-------------------- SS_objfunc.tpl | 22 ++++++++++++---------- SS_prelim.tpl | 4 ++-- SS_proced.tpl | 11 +++++++---- SS_write_report.tpl | 3 ++- SS_write_ssnew.tpl | 9 ++++++--- 7 files changed, 57 insertions(+), 45 deletions(-) diff --git a/SS_benchfore.tpl b/SS_benchfore.tpl index b4fca967..318149aa 100644 --- a/SS_benchfore.tpl +++ b/SS_benchfore.tpl @@ -773,7 +773,9 @@ FUNCTION void Get_Benchmarks(const int show_MSY) YPR_spr_profit = YPR_spr_revenue - Cost; SPR_Fmult = Fmult; if (rundetail > 0 && mceval_counter == 0 && show_MSY == 1) - cout << " got Fspr " << SPR_Fmult << " " << SPR_actual / 100. << endl; + { + echoinput << "Calculated Fspr " << SPR_Fmult << " " << SPR_actual / 100. << endl; + } Vbio_spr = totbio; Vbio1_spr = smrybio; Mgmt_quant(10) = equ_F_std; @@ -871,7 +873,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY) Btgt_Fmult = F1(1); if (rundetail > 0 && mceval_counter == 0 && show_MSY == 1) - cout << " got_F0.1: " << Btgt_Fmult << endl; + echoinput << "Calculated F0.1: " << Btgt_Fmult << endl; SPR_temp = SSB_equil; Equ_SpawnRecr_Result = Equil_Spawn_Recr_Fxn(SR_parm_work(2), SR_parm_work(3), SSB_unf, Recr_unf, SPR_temp); // returns 2 element vector containing equilibrium biomass and recruitment at this SPR Btgt = Equ_SpawnRecr_Result(1); @@ -1041,7 +1043,9 @@ FUNCTION void Get_Benchmarks(const int show_MSY) Btgt_Fmult = Fmult; if (rundetail > 0 && mceval_counter == 0 && show_MSY == 1) - cout << " got_Btgt " << Btgt_Fmult << " " << Btgt / SSB_unf << endl; + { + echoinput << "Finished Btgt: " << Btgt_Fmult << " " << Btgt / SSB_unf << endl; + } YPR_Btgt_enc = YPR_enc; // total encountered yield per recruit YPR_Btgt_dead = YPR_dead; // total dead yield per recruit YPR_Btgt_N_dead = YPR_N_dead; // total dead yield per recruit @@ -1648,14 +1652,14 @@ FUNCTION void Get_Benchmarks(const int show_MSY) Btgt_Fmult2 = Fmult; if (rundetail > 0 && mceval_counter == 0 && show_MSY == 1) - cout << " got_F_Blimit " << Btgt_Fmult2 << " " << Btgt2 / Blim_report << endl; + echoinput << "Calculated F_Blimit " << Btgt_Fmult2 << " " << Btgt2 / Blim_report << endl; Mgmt_quant(18) = Btgt2; Mgmt_quant(19) = equ_F_std; Mgmt_quant(20) = sum(equ_catch_fleet(2)) * Equ_SpawnRecr_Result(2); } // end finding F for Blimit if (rundetail > 0 && mceval_counter == 0 && show_MSY == 1) - cout << " got Fmsy " << MSY_Fmult << " " << MSY << endl; + echoinput << "Calculated Fmsy " << MSY_Fmult << " " << MSY << endl; // ***************** show management report SS_Label_740 if (show_MSY == 1) diff --git a/SS_global.tpl b/SS_global.tpl index ce0537ec..14549048 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -876,7 +876,7 @@ FINAL_SECTION } } if (mceval_phase() == 0) - cout << " finished COVAR.SSO" << endl; + echoinput << " finished COVAR.SSO" << endl; } // SS_Label_Info_12.3 #Go thru time series calculations again to get extra output quantities @@ -892,7 +892,7 @@ FINAL_SECTION if (Do_Forecast > 0) { show_MSY = 0; - Get_Forecast(); + Get_Forecast(); // First call to forecast } k = Do_Dyn_Bzero; for (j = styr - 2; j <= YrMax; j++) @@ -941,17 +941,19 @@ FINAL_SECTION { Get_Benchmarks(show_MSY); if (mceval_phase() == 0) - cout << " finished benchmark" << endl; + cout << "Finished calculating benchmarks" << endl; + echoinput << "Finished calculating benchmarks" << endl; } } if (Do_Forecast >= 0) { - report5 << "THIS FORECAST FOR PURPOSES OF GETTING DISPLAY QUANTITIES" << endl; + report5 << "THIS FORECAST IS FOR PURPOSES OF GETTING DISPLAY QUANTITIES" << endl; if (did_MSY > 0) show_MSY = 0; // so to not repeat forecast_report.sso Get_Forecast(); if (mceval_phase() == 0) - cout << " finished forecast" << endl; + cout << "Finished forecast" << endl; + echoinput << "Finished forecast" << endl; } if (write_bodywt > 0) @@ -964,10 +966,13 @@ FINAL_SECTION // SS_Label_Info_12.3.4 #call fxn STDquant() Process_STDquant(); if (mceval_phase() == 0) - cout << " finished StdDev quantities" << endl; + echoinput << "Finished StdDev quantities" << endl; get_posteriors(); if (mceval_phase() == 0) - cout << " finished posteriors" << endl; + { + cout << "Finished posteriors" << endl; + echoinput << "Finished posteriors" << endl; + } // SS_Label_Info_12.4.2 #Call fxn write_summaryoutput() if (Do_CumReport > 0) @@ -993,17 +998,17 @@ FINAL_SECTION // SS_Label_Info_12.4 #Do Outputs // SS_Label_Info_12.4.1 #Call fxn write_bigoutput() write_bigoutput(); - cout << " finished report.sso" << endl; + cout << "Finished final writing of report.sso" << endl; + echoinput << "Finished final writing of report.sso" << endl; } // SS_Label_Info_12.4.4 #Call fxn write_nudata() to create bootstrap data if (N_nudata > 0) { - cout << "Creating bootstrap files: " << N_nudata << " files"; + cout << "Begin writing *.ss_new output files: "; write_nudata(); - cout << " finished" << endl; - // SS_Label_Info_12.4.5 #Call fxn write_nucontrol() to produce control.ss_new write_nucontrol(); + cout << "finished" << endl; } else { @@ -1014,28 +1019,22 @@ FINAL_SECTION } } + echoinput << "Begin final output calculations and warnings" << endl; // SS_Label_Info_12.4.6 #Call fxn write_Bzero_output() appended to report.sso if (pick_report_use(59) == "Y") { - cout << "dynamic Bzero in FINAL_SECTION: "; write_Bzero_output(); - cout << " finished " << endl; } if (pick_report_use(54) == "Y" && Do_Benchmark > 0) { - cout << "setup_benchmark: " << endl; setup_Benchmark(); - cout << "SPR_profile: "; SPR_profile(); - cout << " finished " << endl; } if (pick_report_use(55) == "Y" && Do_Benchmark > 0) { - cout << "Global_MSY: "; Global_MSY(); - cout << " finished " << endl; } if (parm_adjust_method == 3) @@ -1053,7 +1052,6 @@ FINAL_SECTION if (Nparm_on_bound > 0) { - cout << Nparm_on_bound << " parameters are on or within 1% of min-max bound" << endl; warning << " N parameters are on or within 1% of min-max bound: " << Nparm_on_bound << "; check results, variance may be suspect" << endl; } warning << "N warnings: " << N_warn << endl; @@ -1200,7 +1198,8 @@ REPORT_SECTION get_time_series(); // in ADMB's report_section evaluate_the_objective_function(); write_bigoutput(); - cout << "Wrote bigoutput and bodywt for last_phase in REPORT_SECTION and before hessian, no benchmark or forecast " << endl; + echoinput << "Wrote first version of output files (before hessian, benchmark, and forecast)" << endl; + cout << "Wrote first version of output files (before hessian, benchmark, and forecast)" << endl; save_for_report = 0; write_bodywt = 0; // SS2out.close(); diff --git a/SS_objfunc.tpl b/SS_objfunc.tpl index 92fb55df..4ce52401 100644 --- a/SS_objfunc.tpl +++ b/SS_objfunc.tpl @@ -162,7 +162,7 @@ FUNCTION void evaluate_the_objective_function() } // end having obs for this survey } if (do_once == 1) - cout << " did survey obj_fun " << surv_like << endl; + echoinput << "Finished survey obj_fun " << surv_like << endl; } // SS_Label_Info_25.2 #Fit to discard @@ -238,7 +238,9 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " did discard obj_fun " << disc_like << endl; + { + echoinput << "Finished discard obj_fun " << disc_like << endl; + } } // SS_Label_Info_25.3 #Fit to mean body wt @@ -250,7 +252,7 @@ FUNCTION void evaluate_the_objective_function() mnwt_like(mnwtdata(3, i)) += 0.5 * (DF_bodywt + 1.) * log(1. + square(mnwtdata(6, i) - exp_mnwt(i)) / mnwtdata(9, i)) + mnwtdata(10, i); } if (do_once == 1) - cout << " did meanwt obj_fun " << mnwt_like << endl; + echoinput << " Finished meanwt obj_fun " << mnwt_like << endl; } // SS_Label_Info_25.4 #Fit to length comp @@ -391,7 +393,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " did lencomp obj_fun " << length_like_tot << endl; + echoinput << "Finished lencomp obj_fun " << length_like_tot << endl; } // SS_Label_Info_25.5 #Fit to age composition @@ -529,7 +531,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " did agecomp obj_fun " << age_like_tot << endl; + echoinput << "Finished agecomp obj_fun " << age_like_tot << endl; } // SS_Label_Info_25.6 #Fit to mean size@age @@ -563,7 +565,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " did meanlength obj_fun " << sizeage_like << endl; + echoinput << "Finished meanlength obj_fun " << sizeage_like << endl; } // SS_Label_Info_25.7 #Fit to generalized Size composition @@ -598,7 +600,7 @@ FUNCTION void evaluate_the_objective_function() } if (do_once == 1) - cout << " did sizefreq obj_fun: " << SzFreq_like << " base: " << SzFreq_like_base << endl; + cout << "Finished sizefreq obj_fun: " << SzFreq_like << " base: " << SzFreq_like_base << endl; } // SS_Label_Info_25.8 #Fit to morph composition @@ -611,7 +613,7 @@ FUNCTION void evaluate_the_objective_function() Morphcomp_like -= Morphcomp_obs(iobs, 5) * Morphcomp_obs(iobs)(6, k) * log(elem_div(Morphcomp_exp(iobs)(6, k), Morphcomp_obs(iobs)(6, k))); } if (do_once == 1) - cout << " did morphcomp obj_fun " << Morphcomp_like << endl; + cout << "Finished morphcomp obj_fun " << Morphcomp_like << endl; } // SS_Label_Info_25.9 #Fit to tag-recapture @@ -650,7 +652,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " did tag obj_fun " << TG_like1 << endl + cout << "Finished tag obj_fun " << TG_like1 << endl << TG_like2 << endl; } @@ -767,7 +769,7 @@ FUNCTION void evaluate_the_objective_function() if (do_recdev == 4) regime_like += square(sum_recdev); if (do_once == 1) - cout << " did recruitdev obj_fun " << recr_like << " " << sd_offset_rec << " " << two_sigmaRsq << endl; + cout << "Finished recruitdev obj_fun " << recr_like << " " << sd_offset_rec << " " << two_sigmaRsq << endl; } if (Do_Forecast > 0 && do_recdev > 0) { diff --git a/SS_prelim.tpl b/SS_prelim.tpl index b7d736f8..d68d006b 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -1277,11 +1277,11 @@ // SS_Label_Info_6.8.1 #Call fxn get_MGsetup() to copy MGparms to working array and applies time-varying factors get_MGsetup(styr); - echoinput << " did MG setup" << endl; + echoinput << "Finished MG setup" << endl; // SS_Label_Info_6.8.2 #Call fxn get_growth1() to calculate quantities that are not time-varying get_growth1(); - echoinput << " did growth1" << endl; + echoinput << "Finished growth1" << endl; VBK_seas = value(VBK_seas); wtlen_seas = value(wtlen_seas); CVLmin = value(CVLmin); diff --git a/SS_proced.tpl b/SS_proced.tpl index aa6417d3..aa76b9c6 100644 --- a/SS_proced.tpl +++ b/SS_proced.tpl @@ -141,8 +141,10 @@ PROCEDURE_SECTION show_MSY = 1; } // so only show details if not in mceval if (show_MSY == 1) - cout << "do benchmark and forecast if requested in sdphase" << endl; - + { + cout << "Start benchmark and forecast, if requested" << endl; + echoinput << "Start benchmark and forecast, if requested" << endl; + } setup_recdevs(); y = styr; get_initial_conditions(); @@ -164,8 +166,9 @@ PROCEDURE_SECTION // SS_Label_Info_7.7 #Call fxn Process_STDquant() to move calculated values into sd_containers Process_STDquant(); - if (rundetail > 0 && mceval_phase() == 0) - cout << "finished benchmark, forecast, and sdreporting" << endl; + if (mceval_phase() == 0) + cout << "Finished benchmark, forecast, and sdreporting" << endl; + echoinput << "Finished benchmark, forecast, and sdreporting" << endl; } // end of things to do in std_phase // SS_Label_Info_7.9 #Do screen output of procedure results from this iteration diff --git a/SS_write_report.tpl b/SS_write_report.tpl index 08059742..ed73d80d 100644 --- a/SS_write_report.tpl +++ b/SS_write_report.tpl @@ -10,7 +10,8 @@ FUNCTION void write_bigoutput() { if (mceval_counter == 0) { - cout << " writing big output now " << endl; + echoinput << "Begin writing output files" << endl; + cout << "Begin writing output files" << endl; anystring = sso_pathname + "Report.sso"; report_sso_filename = anystring; if (SS2out.is_open()) diff --git a/SS_write_ssnew.tpl b/SS_write_ssnew.tpl index d113c8e7..94cb0c36 100644 --- a/SS_write_ssnew.tpl +++ b/SS_write_ssnew.tpl @@ -29,6 +29,7 @@ FUNCTION void write_nudata() { if (Nudat == 1) { + echoinput << "Begin writing data_echo.ss_new file" << endl; anystring = ssnew_pathname + "data_echo.ss_new"; report1.open(anystring); report1 << version_info(1) << version_info(2) << version_info(3) << endl @@ -39,6 +40,7 @@ FUNCTION void write_nudata() } else if (Nudat == 2) { + echoinput << "Begin writing data_expval.ss file" << endl; anystring = ssnew_pathname + "data_expval.ss"; report1.open(anystring); report1 << version_info(1) << version_info(2) << version_info(3) << endl @@ -49,6 +51,7 @@ FUNCTION void write_nudata() } else { + echoinput << "Begin writing bootstrap data file(s)" << endl; anystring = " "; sprintf(anystring, "%d", Nudat - 2); if ((Nudat - 2) < 10) @@ -1372,7 +1375,7 @@ FUNCTION void write_nudata() /* SS_Label_FUNCTION 39 write_nucontrol write new control file and starter file */ FUNCTION void write_nucontrol() { - cout << " Write new starter file " << endl; + echoinput << "Write starter.ss_new file " << endl; anystring = ssnew_pathname + "starter.ss_new"; ofstream NuStart(anystring); NuStart << version_info(1) << version_info(2) << version_info(3) << endl @@ -1437,7 +1440,7 @@ FUNCTION void write_nucontrol() NuStart << "3.30 # check value for end of file and for version control" << endl; NuStart.close(); - cout << " Write new forecast file " << endl; + echoinput << "Write forecast.ss_new file " << endl; anystring = ssnew_pathname + "forecast.ss_new"; ofstream NuFore(anystring); NuFore << version_info(1) << version_info(2) << version_info(3) << endl; @@ -1621,7 +1624,7 @@ FUNCTION void write_nucontrol() NuFore.close(); //********************************************************** - cout << " Write new control file " << endl; + echoinput << "Write control.ss_new file " << endl; ofstream report4("control.ss_new"); report4 << version_info(1) << version_info(2) << version_info(3) << endl; From cafcc37abf09cabeb452df6f326f8f6dcdcfb283 Mon Sep 17 00:00:00 2001 From: Kathryn Doering Date: Tue, 24 May 2022 10:09:55 -0400 Subject: [PATCH 06/15] feat: additional changes to console output --- SS_global.tpl | 8 +++++--- SS_objfunc.tpl | 17 ++++++++++------- SS_param.tpl | 4 ++-- SS_prelim.tpl | 8 ++++---- SS_proced.tpl | 4 ++-- SS_readcontrol_330.tpl | 2 +- SS_readstarter.tpl | 2 +- SS_write.tpl | 2 +- SS_write_report.tpl | 2 -- 9 files changed, 26 insertions(+), 23 deletions(-) diff --git a/SS_global.tpl b/SS_global.tpl index 14549048..0a94097d 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -820,7 +820,7 @@ FINAL_SECTION else { - cout << " Iterations: " << niter << endl; + cout << "Iterations: " << niter << endl; if (objective_function_value::pobjfun->gmax > final_conv) { N_warn++; @@ -958,6 +958,8 @@ FINAL_SECTION if (write_bodywt > 0) { + cout << "Writing wtatage.ss_new" << endl; + echoinput << "Writing wtatage.ss_new" << endl; bodywtout << -9999 << " " << 1 << " " << 1 << " " << 1 << " " << 1 << " " << 0 << " " << Wt_Age_mid(1, 1) << " #terminator " << endl; bodywtout.close(); } @@ -1004,11 +1006,11 @@ FINAL_SECTION // SS_Label_Info_12.4.4 #Call fxn write_nudata() to create bootstrap data if (N_nudata > 0) { - cout << "Begin writing *.ss_new output files: "; + cout << "Begin writing *.ss_new output files... "; write_nudata(); // SS_Label_Info_12.4.5 #Call fxn write_nucontrol() to produce control.ss_new write_nucontrol(); - cout << "finished" << endl; + cout << "done" << endl; // finish writing *.ss_new output files } else { diff --git a/SS_objfunc.tpl b/SS_objfunc.tpl index 4ce52401..c97134a7 100644 --- a/SS_objfunc.tpl +++ b/SS_objfunc.tpl @@ -666,7 +666,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " initequ_catch -log(L) " << equ_catch_like << endl; + echoinput << " initequ_catch -log(L) " << equ_catch_like << endl; // SS_Label_Info_25.11 #Fit to catch by fleet/season if (F_Method > 1) @@ -696,7 +696,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - cout << " catch -log(L) " << catch_like << endl; + echoinput << " catch -log(L) " << catch_like << endl; } // SS_Label_Info_25.12 #Likelihood for the recruitment deviations @@ -769,7 +769,7 @@ FUNCTION void evaluate_the_objective_function() if (do_recdev == 4) regime_like += square(sum_recdev); if (do_once == 1) - cout << "Finished recruitdev obj_fun " << recr_like << " " << sd_offset_rec << " " << two_sigmaRsq << endl; + echoinput << "Finished recruitdev obj_fun " << recr_like << " " << sd_offset_rec << " " << two_sigmaRsq << endl; } if (Do_Forecast > 0 && do_recdev > 0) { @@ -1066,7 +1066,7 @@ FUNCTION void evaluate_the_objective_function() if (do_once == 1) { - cout << " OK with obj_func " << obj_fun << endl; + echoinput << " OK with obj_func " << obj_fun << endl; if (SSB_yr(endyr) < 0.01 * SSB_yr(styr)) { N_warn++; @@ -1595,10 +1595,13 @@ FUNCTION void get_posteriors() //******************************************************************** /* SS_Label_FUNCTION 33 get_posteriors (MCMC eval) */ if (rundetail > 1) - cout << " mceval counter: " << mceval_counter << endl; + { + cout << "mceval counter: " << mceval_counter << endl; + } if (rundetail == 0 && double(mceval_counter) / 200. == double(mceval_counter / 200.)) - cout << " mceval counter: " << mceval_counter << endl; - + { + cout << "mceval counter: " << mceval_counter << endl; + } if (mceval_header == 0 && mceval_phase()) // first pass through the mceval phase { // delete any old mcmc output files diff --git a/SS_param.tpl b/SS_param.tpl index 150dd2eb..cdea25d9 100644 --- a/SS_param.tpl +++ b/SS_param.tpl @@ -18,7 +18,7 @@ PARAMETER_SECTION // set the filename to all ADMB output files to "ss.[ext]" ad_comm::adprogram_name = "ss"; echoinput << "Begin setting up parameters" << endl; - cout << "Begin setting up parameters" << endl; + cout << "Setting up parameters... "; if (readparfile >= 1) { cout << " read parm file" << endl; @@ -565,6 +565,6 @@ PARAMETER_SECTION objective_function_value obj_fun number last_objfun vector phase_output(1,max_phase+1) - !!cout << "Finished setting up parameters" << endl; + !!cout << "done" << endl; // Finished setting up the parameters !!echoinput << "Finished setting up parameters" << endl; // } // end of parameter section diff --git a/SS_prelim.tpl b/SS_prelim.tpl index d68d006b..4e093274 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -35,7 +35,7 @@ { ad_comm::change_datafile_name("wtatage.ss"); echoinput << "Begin reading the empirical weight at age file" << endl; - cout << "Begin reading the empirical weight at age file" << endl; + cout << "Reading the empirical weight at age file..."; *(ad_comm::global_datafile) >> N_WTage_maxage; k = 7 + N_WTage_maxage; echoinput << " N_WTage_max " << N_WTage_maxage << endl; @@ -144,7 +144,7 @@ } } echoinput << "Finished reading the empirical weight at age file" << endl; - cout << "Finished reading the empirical weight at age file" << endl; + cout << "done" << endl; // Done reading the empirical weight at age file } else { @@ -1264,7 +1264,7 @@ } // SS_Label_Info_6.8 #Go thru biological calculations once, with do_once flag=1 to produce extra output to echoinput.sso - cout << "Begin evaluating biology calculations once" << endl; + cout << "Evaluating biology calculations once... "; echoinput << "Begin evaluating biology calculations once" << endl; ALK_subseas_update = 1; // vector to indicate if ALK needs recalculating do_once = 1; @@ -1459,7 +1459,7 @@ ParmTrace << endl; // SS_Label_Info_6.10 #Preliminary calcs done; Ready for estimation - cout << "Finished evaluating biology calculations once" << endl; + cout << "done" << endl; // evaluating biology calculations once echoinput << "Finished evaluating biology calculations once" << endl; if (pick_report_use(60) == "Y") diff --git a/SS_proced.tpl b/SS_proced.tpl index aa76b9c6..8d28fff5 100644 --- a/SS_proced.tpl +++ b/SS_proced.tpl @@ -142,7 +142,6 @@ PROCEDURE_SECTION } // so only show details if not in mceval if (show_MSY == 1) { - cout << "Start benchmark and forecast, if requested" << endl; echoinput << "Start benchmark and forecast, if requested" << endl; } setup_recdevs(); @@ -167,8 +166,9 @@ PROCEDURE_SECTION // SS_Label_Info_7.7 #Call fxn Process_STDquant() to move calculated values into sd_containers Process_STDquant(); if (mceval_phase() == 0) - cout << "Finished benchmark, forecast, and sdreporting" << endl; + { echoinput << "Finished benchmark, forecast, and sdreporting" << endl; + } } // end of things to do in std_phase // SS_Label_Info_7.9 #Do screen output of procedure results from this iteration diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index 6b118ec6..2ddf973e 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -4638,7 +4638,7 @@ cout<<" Unsuccessful end of control file, SS3 will abort. Check echoinput.sso for clues. Last value read: "<< fim << endl; abort(); } - cout << "Finished reading the 4 required input files" << endl << endl; + cout << "done" << endl; // Finished reading the 4 required input files END_CALCS !!// SS_Label_Info_4.14 #Create count of active parameters and derived quantities diff --git a/SS_readstarter.tpl b/SS_readstarter.tpl index fbc310dc..ef78b496 100644 --- a/SS_readstarter.tpl +++ b/SS_readstarter.tpl @@ -222,7 +222,7 @@ // SS_Label_Info_1.2 #Read the starter.ss file // /* SS_Label_Flow read starter.ss */ ad_comm::change_datafile_name("starter.ss"); // get filenames - cout << "Begin reading the 4 required input files" << endl; + cout << "Reading the 4 required input files... " ; adstring checkchar; line_adstring readline; checkchar=""; diff --git a/SS_write.tpl b/SS_write.tpl index fa2a44ad..425f60bd 100644 --- a/SS_write.tpl +++ b/SS_write.tpl @@ -794,7 +794,7 @@ FUNCTION void write_SS_summary() // report2 < Date: Tue, 24 May 2022 10:39:14 -0400 Subject: [PATCH 07/15] fix warnings re-if statements --- SS_global.tpl | 5 ++++- SS_popdyn.tpl | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/SS_global.tpl b/SS_global.tpl index 0a94097d..3faffd98 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -941,8 +941,10 @@ FINAL_SECTION { Get_Benchmarks(show_MSY); if (mceval_phase() == 0) + { cout << "Finished calculating benchmarks" << endl; echoinput << "Finished calculating benchmarks" << endl; + } } } if (Do_Forecast >= 0) @@ -951,9 +953,10 @@ FINAL_SECTION if (did_MSY > 0) show_MSY = 0; // so to not repeat forecast_report.sso Get_Forecast(); - if (mceval_phase() == 0) + if (mceval_phase() == 0) { cout << "Finished forecast" << endl; echoinput << "Finished forecast" << endl; + } } if (write_bodywt > 0) diff --git a/SS_popdyn.tpl b/SS_popdyn.tpl index 2f9a7b35..2c61ad77 100644 --- a/SS_popdyn.tpl +++ b/SS_popdyn.tpl @@ -228,8 +228,10 @@ FUNCTION void get_initial_conditions() get_selectivity(); #ifdef DO_ONCE if (do_once == 1) + { echoinput << "selectivity OK" << endl; echoinput << "Calculate ALK" << endl; + } #endif // SS_Label_Info_23.3 #Loop seasons and subseasons From bec93ec01d607a09096a178963fde8b0efa8e833 Mon Sep 17 00:00:00 2001 From: Neal Schindler Date: Fri, 10 Jun 2022 11:58:13 -0700 Subject: [PATCH 08/15] update readcontrol and readstarter To eliminate conflicts in order to merge --- SS_readcontrol_330.tpl | 63 ++-- SS_readstarter.tpl | 792 ++++++++++++++++++++++------------------- 2 files changed, 469 insertions(+), 386 deletions(-) diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index 2ddf973e..b19dbf3c 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -13,7 +13,8 @@ // SS_Label_Info_4.0 #Begin Reading from Control File // /* SS_Label_Flow begin reading from control file */ ad_comm::change_datafile_name(ctlfilename); - echoinput << "Begin reading the control file" << endl; + echoinput << endl << " Begin reading control file " << endl; + cout << " reading from control file" << endl; ifstream Control_Stream(ctlfilename); // even if the global_datafile name is used, there still is a different logical device created // SS_Label_Info_4.1 #Read and store comments at top of control file @@ -627,7 +628,7 @@ if(nseas>1) N_predparms+=N_pred*nseas; natM_5_opt=0; MGparm_point.initialize(); -// 0=1Parm; 1=segmented; 2=Lorenzen; 3=agespecific; 4=agespec with seas interpolate; 5=Maunder_M +// 0=1Parm; 1=segmented; 2=Lorenzen; 3=agespecific; 4=agespec with seas interpolate; 5=Maunder_M; 6=Lorenzen range *(ad_comm::global_datafile) >> natM_type; echoinput<> natM_amin; + echoinput << natM_amin << " natM_minage for Lorenzen" << endl; + *(ad_comm::global_datafile) >> natM_amax; + echoinput << natM_amax << " natM_maxage for Lorenzen" << endl; + break; + } } END_CALCS @@ -1046,6 +1056,14 @@ } break; } + case 6: + { + ParCount++; + ParmLabel += "NatM_Lorenzen_average" + GenderLbl(gg) + GP_Lbl(gp); + Parm_info += "val"; + Parm_minmax.push_back(3); + break; + } default: { break; @@ -1465,11 +1483,11 @@ { if(z>N_Block_Designs) {N_warn++; cout<<"Fatal_input_error, see warning"<0) {MG_active(mgp_type(f))=1;} } - if(natM_type==2 && MG_active(2)>0) MG_active(1)=1; // lorenzen M depends on growth + if ((natM_type == 2 || natM_type == 6) && MG_active(2) > 0) + { + MG_active(1) = 1; // lorenzen M depends on growth + } j=N_MGparm; if(timevary_parm_cnt_MG>0) @@ -1778,11 +1799,11 @@ { if(SR_parm_1(j,13)>N_Block_Designs) {N_warn++; cout<<"Fatal_input_error, see warning"<N_Block_Designs) {N_warn++; cout<<"Fatal_input_error, see warning"<N_Block_Designs) {N_warn++; cout<<"Fatal_input_error, see warning"<0) { N_warn++; warning<0) || ((sd_phase() || mceval_phase()) && (initial_params::mc_phase==0)) + int bigsaver; // (save_for_report>0) || ((sd_phase() || mceval_phase()) && (initial_params::mc_phase==0)) int write_bodywt; int write_bodywt_save; int save_gparm; int save_gparm_print; int N_warn; - !! save_for_report=0; - !! bigsaver=0; - !! save_gparm=0; - !! N_warn=0; - !! write_bodywt=0; - !! write_bodywt_save=0; + !! save_for_report = 0; + !! bigsaver = 0; + !! save_gparm = 0; + !! N_warn = 0; + !! write_bodywt = 0; + !! write_bodywt_save = 0; + !! special_flag = 0; int Nparm_on_bound; - int on; - int SDmode; - int maxI; + int on; + int SDmode; + int maxI; LOCAL_CALCS maxI=999; @@ -109,32 +112,31 @@ TG_t=0; Fcast_catch_start=0; retParCount=0; N_SC=0; N_DC=0; N_CC=0; N_FC=0; catch_mult_pointer=0; frac_female_pointer=0; icycle=0; No_Report=0; mcmcFlag=0; noest_flag=0; temp=0; temp1=0; save_gparm_print=0; finished_minimize=0; - // SS_Label_Info_1.1.2 #arrays for parameter labels are created in GLOBAL -// adstring_array NumLbl; -// adstring_array GenderLbl; // gender label -// adstring_array CRLF; // blank to terminate lines - - CRLF+=""; - GenderLbl+="Fem"; - GenderLbl+="Mal"; - GP_Lbl+="_GP_1"; - GP_Lbl+="_GP_2"; - GP_Lbl+="_GP_3"; - GP_Lbl+="_GP_4"; - GP_Lbl+="_GP_5"; - GP_Lbl+="_GP_6"; - onenum=" "; - for (i=1;i<=199;i++) /* SS_loop: fill string NumLbl with numbers (start at 1) */ + // SS_Label_Info_1.1.2 #arrays for parameter labels are created in GLOBAL +// adstring_array NumLbl; +// adstring_array GenderLbl; // gender label +// adstring_array CRLF; // blank to terminate lines + + CRLF += ""; + GenderLbl += "Fem"; + GenderLbl += "Mal"; + GP_Lbl += "_GP_1"; + GP_Lbl += "_GP_2"; + GP_Lbl += "_GP_3"; + GP_Lbl += "_GP_4"; + GP_Lbl += "_GP_5"; + GP_Lbl += "_GP_6"; + onenum = " "; + for (i = 1; i <= 199; i++) /* SS_loop: fill string NumLbl with numbers (start at 1) */ { - sprintf(onenum, "%d", i); - NumLbl+=onenum+CRLF(1); + sprintf(onenum, "%d", i); + NumLbl += onenum + CRLF(1); } - for (i=0;i<=198;i++) /* SS_loop: fill string NumLbl0 with numbers (start at 0) */ + for (i = 0; i <= 198; i++) /* SS_loop: fill string NumLbl0 with numbers (start at 0) */ { - sprintf(onenum, "%d", i); - NumLbl0+=onenum+CRLF(1); + sprintf(onenum, "%d", i); + NumLbl0 += onenum + CRLF(1); } - pick_report_name+="DEFINITIONS report:1";pick_report_use+="N"; pick_report_name+="LIKELIHOOD report:2";pick_report_use+="N"; pick_report_name+="Input_Variance_Adjustment report:3";pick_report_use+="N"; @@ -196,100 +198,108 @@ pick_report_name+="Dynamic_Bzero report:59";pick_report_use+="N"; pick_report_name+="wtatage.ss_new report:60";pick_report_use+="N"; -// check command line inputs +// check command line inputs - if ( (on=option_match(argc,argv,"-noest"))>-1) + if ((on = option_match(argc, argv, "-noest")) > -1) { - cout<<"SS3 is not configured to work with -noest; use -maxI instead which overrides maxphase in starter.ss"< instead"< instead which overrides maxphase in starter.ss"; + write_warning(N_warn,0,1); } - if ( (on=option_match(argc,argv,"-maxI"))>-1 || (on=option_match(argc,argv,"-stopph"))>-1) + if ((on = option_match(argc, argv, "-maxI")) > -1 || (on = option_match(argc, argv, "-stopph")) > -1) { -// if maxI > 999, maxphase will reset to maxI - maxI=atoi(ad_comm::argv[on+1]); - echoinput<<"read max phase to override starter file's maxphase "< 999, maxphase will reset to maxI + maxI = atoi(ad_comm::argv[on+1]); + echoinput << "read max phase to override starter file's maxphase " << maxI << endl; } - SDmode=1; - if ( (on=option_match(argc,argv,"-nohess"))>-1) + SDmode = 1; + if ((on = option_match(argc, argv, "-nohess")) > -1) { SDmode = 0; } - echoinput<<" -nohess flag (1 means do Hessian): "<> readline; // reads a single line from input stream - if(length(readline)>2) + Starter_Stream >> readline; // reads a single line from input stream + if (length(readline) > 2) { - checkchar=readline(1); - k=strcmp(checkchar,"#"); - checkchar=readline(1,2); - j=strcmp(checkchar,"#C"); - if(j==0) {N_SC++; Starter_Comments+=readline;} + checkchar = readline(1); + k = strcmp(checkchar,"#"); + checkchar = readline(1,2); + j = strcmp(checkchar,"#C"); + if (j == 0) + { + N_SC++; + Starter_Comments += readline; + } } } - echoinput< 3) reportdetail = 0; - echoinput< 3) + reportdetail = 0; + echoinput << reportdetail << " reportdetail 0=minimal for data-limited, 1=all, 2=no growth, 3=custom" << endl; + if (reportdetail == 3) { // -101 means to select all // -100 means to select data-limited @@ -312,134 +323,152 @@ // positive integer means to add that item to selected list // negative integer means to remove selected item from list // -999 means to stop reading items for the list - ender=0; + ender = 0; do { - ivector tempin(1,1); - *(ad_comm::global_datafile) >> tempin(1,1); - if(tempin(1)==-999) ender=1; - reportdetail_list.push_back (tempin(1,1)); - } while (ender==0); - int Nrec=reportdetail_list.size()-2; - for( int j=0;j<=Nrec;j++) { - if(reportdetail_list[j](1)==-100) rd_background=0; - if(reportdetail_list[j](1)==-101) rd_background=1; - if(reportdetail_list[j](1)==-102) rd_background=2; + ivector tempin(1,1); + *(ad_comm::global_datafile) >> tempin(1,1); + if (tempin(1) == -999) + ender = 1; + reportdetail_list.push_back (tempin(1,1)); + } while (ender == 0); + int Nrec = reportdetail_list.size() - 2; + for (int j = 0; j <= Nrec; j++) + { + if (reportdetail_list[j](1) == -100) rd_background = 0; + if (reportdetail_list[j](1) == -101) rd_background = 1; + if (reportdetail_list[j](1) == -102) rd_background = 2; } } - else{ - rd_background=reportdetail; // 0=limited; 2=brief; 1=all + else + { + rd_background = reportdetail; // 0=limited; 2=brief; 1=all } -// set background set of picked reports; then set custom if reportdetail==3 - for(k=1;k<=60;k++) {pick_report_use(k)="N";} // all off - if(rd_background==0) // limited +// set background set of picked reports; then set custom if reportdetail==3 + for (k = 1; k <= 60; k++) + { + pick_report_use(k) = "N"; // all off + } + if (rd_background == 0) // limited { - pick_report_use(1)="Y"; - pick_report_use(2)="Y"; - pick_report_use(5)="Y"; - pick_report_use(6)="Y"; - pick_report_use(14)="Y"; - pick_report_use(15)="Y"; - pick_report_use(16)="Y"; + pick_report_use(1) = "Y"; + pick_report_use(2) = "Y"; + pick_report_use(5) = "Y"; + pick_report_use(6) = "Y"; + pick_report_use(14) = "Y"; + pick_report_use(15) = "Y"; + pick_report_use(16) = "Y"; } - else if(rd_background==2) // brief, no growth or length + else if (rd_background == 2) // brief, no growth or length { - for(k=1;k<=60;k++) {pick_report_use(k)="Y";} // start with all on - pick_report_use(7)="N"; - pick_report_use(8)="N"; - pick_report_use(11)="N"; - pick_report_use(12)="N"; - pick_report_use(13)="Y"; - pick_report_use(17)="N"; - pick_report_use(18)="N"; - pick_report_use(24)="N"; - pick_report_use(25)="N"; - pick_report_use(26)="N"; - pick_report_use(27)="N"; - pick_report_use(29)="N"; - pick_report_use(31)="N"; - pick_report_use(33)="N"; - pick_report_use(34)="N"; - pick_report_use(37)="N"; - pick_report_use(38)="N"; - pick_report_use(44)="N"; - pick_report_use(45)="N"; - pick_report_use(46)="N"; - pick_report_use(47)="N"; - pick_report_use(48)="N"; - pick_report_use(49)="N"; - pick_report_use(50)="N"; - pick_report_use(53)="N"; - pick_report_use(55)="N"; - pick_report_use(57)="N"; - pick_report_use(58)="N"; - pick_report_use(59)="N"; + for (k = 1; k <= 60; k++) + { + pick_report_use(k) = "Y"; // start with all on + } + pick_report_use(7) = "N"; + pick_report_use(8) = "N"; + pick_report_use(11) = "N"; + pick_report_use(12) = "N"; + pick_report_use(13) = "Y"; + pick_report_use(17) = "N"; + pick_report_use(18) = "N"; + pick_report_use(24) = "N"; + pick_report_use(25) = "N"; + pick_report_use(26) = "N"; + pick_report_use(27) = "N"; + pick_report_use(29) = "N"; + pick_report_use(31) = "N"; + pick_report_use(33) = "N"; + pick_report_use(34) = "N"; + pick_report_use(37) = "N"; + pick_report_use(38) = "N"; + pick_report_use(44) = "N"; + pick_report_use(45) = "N"; + pick_report_use(46) = "N"; + pick_report_use(47) = "N"; + pick_report_use(48) = "N"; + pick_report_use(49) = "N"; + pick_report_use(50) = "N"; + pick_report_use(53) = "N"; + pick_report_use(55) = "N"; + pick_report_use(57) = "N"; + pick_report_use(58) = "N"; + pick_report_use(59) = "N"; } - else // all on + else // all on { - for(k=1;k<=60;k++) {pick_report_use(k)="Y";} + for (k = 1; k <= 60; k++) + { + pick_report_use(k) = "Y"; + } } - if(reportdetail==3) { - for(unsigned j=0;j<=reportdetail_list.size()-2;j++) { - if(reportdetail_list[j](1)>0 && reportdetail_list[j](1)<=60) { - pick_report_use(reportdetail_list[j](1))="Y"; - } - else if(reportdetail_list[j](1)>=-60) { - pick_report_use(-reportdetail_list[j](1))="N"; - } - else if(reportdetail_list[j](1)>-100) - { - N_warn++; warning< 0 && reportdetail_list[j](1) <= 60) + { + pick_report_use(reportdetail_list[j](1)) = "Y"; + } + else if (reportdetail_list[j](1) >= -60) + { + pick_report_use(-reportdetail_list[j](1)) = "N"; + } + else if (reportdetail_list[j](1) > -100) + { + warnstream << "custom report number: " << reportdetail_list[j](1) << " is out of range and ignored"; + write_warning(N_warn,0,0); + } } } - for(k=1;k<=60;k++) - echoinput<0) echoinput<=11 invoke multiyr with 10's digit; >=100 invoke log(ratio) with hundreds digit + !! fishery_on_off = 1; + + init_int Smry_Age; + !!echoinput << Smry_Age << " Smry_Age" << endl; + int depletion_basis; + int depletion_multi; + int depletion_log; + init_int depletion_basis_rd; // 0=skip; 1=fraction of B0; 2=fraction of Bmsy where fraction is depletion_level 3=rel to styr; values >=11 invoke multiyr with 10's digit; >=100 invoke log(ratio) with hundreds digit LOCAL_CALCS echoinput<=100) // invokes log(ratio) - {k-=100; - depletion_log=1; - depletion_basis=k; - } + if (k >= 100) // invokes log(ratio) + { + k-=100; + depletion_log=1; + depletion_basis=k; + } - if(k>10) // invokes multiyr + if (k > 10) // invokes multiyr { - depletion_multi=int(k/10); - depletion_basis=k-10*depletion_multi; + depletion_multi = int(k / 10); + depletion_basis = k - 10 * depletion_multi; } - echoinput<<"Parse into: depletion_log(ratio): "<0) - { - echoinput< 0) + { + echoinput << F_reporting_ages_R << " F_reporting_ages_R" << endl; + echoinput << "Will be checked against maxage later " << endl; + } END_CALCS - init_int F_std_basis_rd // 0=raw; 1=rel Fspr; 2=rel Fmsy ; 3=rel Fbtgt; values >=11 invoke multiyr with 10's digit; >=100 invoke log(ratio) with hundreds digit - number finish_starter - int mcmc_output_detail - number MCMC_bump // value read and added to ln(R0) when starting into MCMC - number ALK_tolerance + init_int F_std_basis_rd; // 0=raw; 1=rel Fspr; 2=rel Fmsy ; 3=rel Fbtgt; values >=11 invoke multiyr with 10's digit; >=100 invoke log(ratio) with hundreds digit + number finish_starter; + int mcmc_output_detail; + number MCMC_bump; // value read and added to ln(R0) when starting into MCMC + number ALK_tolerance; number tempin; int ender; int irand_seed; int irand_seed_rd; - int F_std_multi; // for multi-year averaging of F_std - int F_std_log; // for log(ratio) of F_std + int F_std_multi; // for multi-year averaging of F_std + int F_std_log; // for log(ratio) of F_std int F_std_basis; LOCAL_CALCS { - F_std_multi=0; - F_std_log=0; - echoinput<=100) // invokes log(ratio) + if (k >= 100) // invokes log(ratio) { - F_std_log=1; - k-=100; - F_std_basis=k; // can be overridden by next test + F_std_log = 1; + k -= 100; + F_std_basis = k; // can be overridden by next test } - if(k>10) // invokes multiyr + if (k > 10) // invokes multiyr { - F_std_multi=int(k/10); - F_std_basis=k-10*F_std_multi; + F_std_multi = int(k / 10); + F_std_basis = k - 10 * F_std_multi; } - echoinput<<"Parse into: F_std_log(ratio): "<1) {N_warn++; warning< 1) + { + warnstream << "NOTE: new feature for multiyr F_std reporting, be sure STD reporting covers all years from styr to endyr"; + write_warning(N_warn,0,0); + } + echoinput << "For Kobe plot, set depletion_basis=2; depletion_level=1.0; F_reporting=your choose; F_std_basis=2" << endl; mcmc_output_detail = 0; - MCMC_bump=0.; - ALK_tolerance=0.0; - irand_seed_rd=-1; - irand_seed=-1; - ender=0; + MCMC_bump = 0.; + ALK_tolerance = 0.0; + irand_seed_rd = -1; + irand_seed = -1; + ender = 0; //embed following reads in a do-while such that additional reads can be added while retaining backward compatibility with files that do not have the added elements // element list: // 1. MCMC_output_detail.MCMC_bump // 2. ALK_tolerance // 3. irand_seed; added for 3.30.15 // xx. finish_starter - do - { + do + { *(ad_comm::global_datafile) >> tempin; - finish_starter=tempin; - if(tempin==3.30 || tempin==999) ender=1; + finish_starter = tempin; + if (tempin == 3.30 || tempin == 999) + ender = 1; - if(tempin==999.) // finish read in 3.24 format for ss_trans - { - echoinput<<"SS read 999 from starter.ss, so will read files in 3.24 format"< 0) + if (tempin == 999.) // finish read in 3.24 format for ss_trans { - N_warn++; warning< 0) + { + warnstream << " ss_trans does not read the PAR file; readparfile set to 0" << endl; + write_warning(N_warn,0,0); + readparfile = 0; + } } - } - else // reading in 3.30 format - { - finish_starter=3.30; - echoinput<<"Read files in 3.30 format"< 2) mcmc_output_detail = 0; - echoinput<<"MCMC output detail(1=more_detail_to_posts; 2=write_report_for_each_mceval): "<> ALK_tolerance; - echoinput<<"ALK tolerance: "< 0.1) - { - N_warn++; warning<> tempin; - if(tempin==3.30) - {ender=1; irand_seed_rd=-1; irand_seed=-1;} - else - {irand_seed_rd=int(tempin); - irand_seed=irand_seed_rd; - echoinput<<"random number seed: "<> tempin; - if(tempin==3.30) - {ender=1;} - else - {N_warn++; cout<<" EXIT - see warning "< 2) + mcmc_output_detail = 0; + echoinput << "MCMC output detail(1=more_detail_to_posts; 2=write_report_for_each_mceval): " << mcmc_output_detail << endl; + echoinput << "MCMC bump to R0: " << MCMC_bump << endl; + + echoinput << "Now get ALK tolerance (0.0 is OK for no compression; 0.1 is too big; suggest 0.0001)" << endl; + *(ad_comm::global_datafile) >> ALK_tolerance; + echoinput<<"ALK tolerance: " << ALK_tolerance << endl; + // enforce valid range of ALK_tolerance + if (ALK_tolerance < 0.0 || ALK_tolerance > 0.1) + { + warnstream << "Error: ALK_tolerance must be between 0.0 and 0.1: " << ALK_tolerance; + write_warning(N_warn,1,1); } - } - } while (ender==0); - echoinput << "Finished reading the starter file" << endl << endl; + + echoinput<<"Now get random number seed; enter -1 to use long(time) as the seed"<> tempin; + if (tempin == 3.30) + { + ender = 1; + irand_seed_rd = -1; + irand_seed = -1; + } + else + { + irand_seed_rd = int(tempin); + irand_seed = irand_seed_rd; + echoinput << "random number seed: " << irand_seed << endl; + tempin = 0; + } + if (ender == 0) + { + *(ad_comm::global_datafile) >> tempin; + if (tempin == 3.30) + { + ender=1; + } + else + { + echoinput << endl << "starter.ss should have read 3.30 here; it read: " << tempin << endl; + warnstream << "starter.ss has extra input lines; check echoinput to verify read"; + write_warning(N_warn,0,1); + } + } + } + } while (ender == 0); + echoinput << " finish reading starter.ss" << endl << endl; } END_CALCS // end reading from Starter file number pi - !! pi=3.14159265358979; + !! pi = 3.14159265358979; number neglog19 - !! neglog19 = -log(19.); + !! neglog19 = -log(19.); number NilNumbers // used as the minimum for posfun and similar checks !! NilNumbers = 0.0000001; // !! NilNumbers = 0.000; !!// SS_Label_Info_1.2.1 #Set up a dummy datum for use when max phase = 0 - number dummy_datum - int dummy_phase - !! dummy_datum=1.; - !! if(Turn_off_phase<=0) {dummy_phase=0;} else {dummy_phase=-6;} + number dummy_datum; + int dummy_phase; + !! dummy_datum = 1.; + !! if (Turn_off_phase <= 0) {dummy_phase = 0;} else {dummy_phase = -6;} - int runnumber + int runnumber; int N_prof_var; - int prof_var_cnt - int prof_junk + int prof_var_cnt; + int prof_junk; LOCAL_CALCS - // SS_Label_Info_1.3 #Read runnumber.ss + // SS_Label_Info_1.3 #Read runnumber.ss ifstream fin1("runnumber.ss", ios::in); if (fin1) { - fin1>>runnumber; + fin1 >> runnumber; runnumber++; fin1.close(); } else { - runnumber=1; + runnumber = 1; } - // SS_Label_Info_1.3.1 #Increment runnumber and write to file + // SS_Label_Info_1.3.1 #Increment runnumber and write to file ofstream fin2("runnumber.ss", ios::out); fin2 << runnumber; fin2.close(); - // SS_Label_Info_1.4 #Read Profilevalues.ss file - N_prof_var=998; + // SS_Label_Info_1.4 #Read Profilevalues.ss file + N_prof_var = 998; ifstream fin3("profilevalues.ss", ios::in); - fin3>>N_prof_var; // if file is null this will not return anything - if (N_prof_var==998) {N_prof_var=0; prof_junk=0;} else {prof_junk=1;} - fin3.close(); - if(N_prof_var>0) - {ad_comm::change_datafile_name("profilevalues.ss");} + fin3 >> N_prof_var; // if file is null this will not return anything + if (N_prof_var == 998) + { + N_prof_var = 0; + prof_junk = 0; + } else - {ad_comm::change_datafile_name("runnumber.ss");} // just to have something in scope - prof_var_cnt=(runnumber-1)*N_prof_var+2; + { + prof_junk = 1; + } + fin3.close(); + if (N_prof_var > 0) + { + ad_comm::change_datafile_name("profilevalues.ss"); + } + else // just to have something in scope + { + ad_comm::change_datafile_name("runnumber.ss"); + } + prof_var_cnt = (runnumber - 1) * N_prof_var + 2; END_CALCS init_vector prof_var(1,prof_junk+runnumber*N_prof_var); From 24386623ac51d23ed6851aba0405b207fd841879 Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 07:44:04 -0700 Subject: [PATCH 09/15] fix '...': Treats ... as a word Places spaces before/after and after ... to treat it as if it is a word in its own right. --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- SS_global.tpl | 2 +- SS_param.tpl | 2 +- SS_prelim.tpl | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 198395dd..6ebfc221 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -33,7 +33,7 @@ body: attributes: label: Expected behavior description: A clear and concise description of what you expected to happen. - placeholder: I expected... + placeholder: I expected ... validations: required: true - type: textarea diff --git a/SS_global.tpl b/SS_global.tpl index 1910a0ca..1f110e1c 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -1117,7 +1117,7 @@ FINAL_SECTION // SS_Label_Info_12.4.4 #Call fxn write_nudata() to create bootstrap data if (N_nudata > 0) { - cout << "Begin writing *.ss_new output files... "; + cout << "Begin writing *.ss_new output files ... "; write_nudata(); // SS_Label_Info_12.4.5 #Call fxn write_nucontrol() to produce control.ss_new write_nucontrol(); diff --git a/SS_param.tpl b/SS_param.tpl index a010f467..02e53b71 100644 --- a/SS_param.tpl +++ b/SS_param.tpl @@ -18,7 +18,7 @@ PARAMETER_SECTION // set the filename to all ADMB output files to "ss.[ext]" ad_comm::adprogram_name = "ss"; echoinput << "Begin setting up parameters" << endl; - cout << "Setting up parameters... "; + cout << "Setting up parameters ... "; if (readparfile >= 1) { cout << " read parm file" << endl; diff --git a/SS_prelim.tpl b/SS_prelim.tpl index 848bbd9d..fea7cea7 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -35,7 +35,7 @@ { ad_comm::change_datafile_name("wtatage.ss"); echoinput << "Begin reading the empirical weight at age file" << endl; - cout << "Reading the empirical weight at age file..."; + cout << "Reading the empirical weight at age file ..."; *(ad_comm::global_datafile) >> N_WTage_maxage; k = 7 + N_WTage_maxage; echoinput << " N_WTage_max " << N_WTage_maxage << endl; @@ -1228,7 +1228,7 @@ } // SS_Label_Info_6.8 #Go thru biological calculations once, with do_once flag=1 to produce extra output to echoinput.sso - cout << "Evaluating biology calculations once... "; + cout << "Evaluating biology calculations once ... "; echoinput << "Begin evaluating biology calculations once" << endl; ALK_subseas_update = 1; // vector to indicate if ALK needs recalculating do_once = 1; From 7580439d314e38f4cb8e6a870de82022392c69ab Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 08:42:29 -0700 Subject: [PATCH 10/15] fix: Reduces spacing to 1 Nitpicky change to reduce spacing from 2 to 1 at end of line for consistency. --- SS_objfunc.tpl | 2 +- SS_readcontrol_330.tpl | 4 ++-- SS_readdata_330.tpl | 2 +- SS_write_ssnew.tpl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SS_objfunc.tpl b/SS_objfunc.tpl index ff9c1e35..0d6cdab1 100644 --- a/SS_objfunc.tpl +++ b/SS_objfunc.tpl @@ -406,7 +406,7 @@ FUNCTION void evaluate_the_objective_function() } } if (do_once == 1) - echoinput << "Finished lencomp obj_fun " << length_like_tot << endl; + echoinput << "Finished lencomp obj_fun " << length_like_tot << endl; } // SS_Label_Info_25.5 #Fit to age composition diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index d955bee2..d070dd60 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -4341,7 +4341,7 @@ TwoD_AR_cnt = 0; echoinput << " now read 0/1 for 2D_AR" << endl; *(ad_comm::global_datafile) >> TwoD_AR_do; - echoinput << TwoD_AR_do << " #_ 0/1 to request experimental 2D_AR selectivity smoother options " << endl; + echoinput << TwoD_AR_do << " #_ 0/1 to request experimental 2D_AR selectivity smoother options " << endl; if (TwoD_AR_do > 0) { @@ -4696,7 +4696,7 @@ k = 3 * N_TG + 2 * Nfleet1; for (j = 1; j <= k; j++) TG_parm_PH(j) = TG_parm2(j, 7); // write it out due to no typecast available - echoinput << "create tag labels " << endl; + echoinput << "create tag labels " << endl; // SS_Label_Info_4.10.1 #Create parameter count and parameter names for tag parameters onenum = " "; firsttagparm = ParCount; diff --git a/SS_readdata_330.tpl b/SS_readdata_330.tpl index 1ec98ef3..9f895a4a 100644 --- a/SS_readdata_330.tpl +++ b/SS_readdata_330.tpl @@ -1112,7 +1112,7 @@ } } } - echoinput << "Successful read of discard data " << endl; + echoinput << "Successful read of discard data " << endl; echoinput << "Index Survey_name N Super_Per Min_val max_val // Observations:" << endl; for (f = 1; f <= Nfleet; f++) { diff --git a/SS_write_ssnew.tpl b/SS_write_ssnew.tpl index ce312836..08a86de6 100644 --- a/SS_write_ssnew.tpl +++ b/SS_write_ssnew.tpl @@ -1881,7 +1881,7 @@ FUNCTION void write_nucontrol() } } - report4 << "# Recruitment Distribution " << endl; + report4 << "# Recruitment Distribution " << endl; j = NP + 1; if (MGP_CGD > j) { From b7c826f30744827d710a45cea822ed853d83d1ae Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 10:03:42 -0700 Subject: [PATCH 11/15] fix: Changes Finished to Calculated --- SS_benchfore.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SS_benchfore.tpl b/SS_benchfore.tpl index 074135bc..cd8c4df3 100644 --- a/SS_benchfore.tpl +++ b/SS_benchfore.tpl @@ -1063,7 +1063,7 @@ FUNCTION void Get_Benchmarks(const int show_MSY) Btgt_Fmult = Fmult; if (rundetail > 0 && mceval_counter == 0 && show_MSY == 1) { - echoinput << "Finished Btgt: " << Btgt_Fmult << " " << Btgt / SSB_unf << endl; + echoinput << "Calculated Btgt: " << Btgt_Fmult << " " << Btgt / SSB_unf << endl; } YPR_Btgt_enc = YPR_enc; // total encountered yield per recruit YPR_Btgt_dead = YPR_dead; // total dead yield per recruit From ec82bd7a4e2f425227630251234ce581d155ca4c Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 10:04:12 -0700 Subject: [PATCH 12/15] doc: Moves comment to cout Changes done to be more explicit. --- SS_global.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SS_global.tpl b/SS_global.tpl index 1f110e1c..c06d1d23 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -1121,7 +1121,7 @@ FINAL_SECTION write_nudata(); // SS_Label_Info_12.4.5 #Call fxn write_nucontrol() to produce control.ss_new write_nucontrol(); - cout << "done" << endl; // finish writing *.ss_new output files + cout << "Finished writing *.ss_new output files" << endl; } else { From 50ae4e38021bfb4fb93997dc9f5a69cbbcc236b0 Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 10:06:04 -0700 Subject: [PATCH 13/15] doc: Adds n iterations to echoinput --- SS_global.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/SS_global.tpl b/SS_global.tpl index c06d1d23..5fb2ae86 100644 --- a/SS_global.tpl +++ b/SS_global.tpl @@ -930,6 +930,7 @@ FINAL_SECTION else { cout << "Iterations: " << niter << endl; + echoinput << "Iterations: " << niter << endl; if (objective_function_value::pobjfun->gmax > final_conv) { warnstream << "Final gradient: " << objective_function_value::pobjfun->gmax << " is larger than final_conv: " << final_conv; From 6fee82cfa4f2040814b264d38310eb26a20feae9 Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 10:08:05 -0700 Subject: [PATCH 14/15] fix: Increase consistency echoinput vs cout Make the lines essentially match in what is printed to the screen versus what is saved in echoinput --- SS_param.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SS_param.tpl b/SS_param.tpl index 02e53b71..2dc1dbbf 100644 --- a/SS_param.tpl +++ b/SS_param.tpl @@ -18,7 +18,7 @@ PARAMETER_SECTION // set the filename to all ADMB output files to "ss.[ext]" ad_comm::adprogram_name = "ss"; echoinput << "Begin setting up parameters" << endl; - cout << "Setting up parameters ... "; + cout << "Begin setting up parameters ... "; if (readparfile >= 1) { cout << " read parm file" << endl; From 73abccd92f63a697594e1797e6497148895937bf Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 9 Sep 2022 10:10:32 -0700 Subject: [PATCH 15/15] fix: Changes MG setup to code MG setup is changed to MGsetup which matches what the codebase is to help users that are searching for parameter names. --- SS_prelim.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SS_prelim.tpl b/SS_prelim.tpl index fea7cea7..a0c82c56 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -1241,7 +1241,7 @@ // SS_Label_Info_6.8.1 #Call fxn get_MGsetup() to copy MGparms to working array and applies time-varying factors get_MGsetup(styr); - echoinput << "Finished MG setup" << endl; + echoinput << "Finished MGsetup" << endl; // SS_Label_Info_6.8.2 #Call fxn get_growth1() to calculate quantities that are not time-varying get_growth1();