Skip to content

Commit 331e857

Browse files
clean up ss_new and spawn_recr output
1 parent 86bec12 commit 331e857

3 files changed

Lines changed: 50 additions & 69 deletions

File tree

SS_benchfore.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,8 +1801,8 @@ FUNCTION void Get_Benchmarks(const int show_MSY)
18011801
}
18021802
else
18031803
{
1804-
Btgttgt2 = -Blim_frac * SSB_virgin;
1805-
Blim_report = value(SSB_virgin);
1804+
Btgttgt2 = -Blim_frac * SSB_unf;
1805+
Blim_report = value(SSB_unf);
18061806
}
18071807

18081808
for (j = 0; j <= Nloops; j++) // loop find Btarget

SS_write_report.tpl

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,8 +1891,6 @@ FUNCTION void write_bigoutput()
18911891

18921892
SS2out << endl << "#New_Expanded_Spawn_Recr_report" << endl << pick_report_name(19) << endl;
18931893
SS2out << SR_fxn << " # SR_Function" << endl;
1894-
SS2out << N_SRparm2 << " # N_SRparms" << endl;
1895-
18961894
SS2out << "# " <<endl << "Flags_for_timevary_biology_and_SR" << endl;
18971895
SS2out << timevary_bio_4SRR << " # timevary_bio_4SRR #_Compatibility_flag_for_legacy_(0)_vs_improved_(1)_impact_of_timevary_biology_on_benchmark_SRR_calcs" << endl;
18981896
SS2out << timevary_MG_firstyr << " # timevary_MG_firstyr ";
@@ -1901,6 +1899,7 @@ FUNCTION void write_bigoutput()
19011899
else
19021900
{ SS2out << " #_some_timevary_MGparm_or_EWAA: " << timevary_MG_firstyr << endl; }
19031901

1902+
SS2out << N_SRparm2 << " # N_SRparms" << endl;
19041903
SS2out << "#" << endl << "#_SRparm parm_label value phase" << endl;
19051904
for (int j = 1; j <=N_SRparm2; j++)
19061905
{
@@ -1920,7 +1919,7 @@ FUNCTION void write_bigoutput()
19201919
SS2out << " # timevary_SRparm_begin_year" << endl;
19211920
}
19221921

1923-
SS2out << endl << "#" << endl << "Quantities for MSY and other benchmark calculations " << endl << "Benchmark_years: 1_beg_bio 2_end_bio 3_beg_selex 4_end_selex 5_beg_relF 6_end_relF 7_beg_recr_dist 8_end_recr_dist 9_beg_SRparm 10_end_SRparm" << endl;
1922+
SS2out << "#" << endl << "Quantities for MSY and other benchmark calculations " << endl << "Benchmark_years: 1_beg_bio 2_end_bio 3_beg_selex 4_end_selex 5_beg_relF 6_end_relF 7_beg_recr_dist 8_end_recr_dist 9_beg_SRparm 10_end_SRparm" << endl;
19241923
SS2out << "Benchmark_years: " << Bmark_Yr << endl;
19251924
for ( int k = 1; k <=9; k+=2)
19261925
{ if (Bmark_Yr(k+1) > Bmark_Yr(k))
@@ -1938,7 +1937,7 @@ FUNCTION void write_bigoutput()
19381937
SS2out << "Ln(R0): " << SRparm(1) << endl << "R0: " << mfexp(SRparm(1)) << endl;
19391938
SS2out << "steepness: " << steepness << endl;
19401939
SS2out << "Ln(alpha)_derived: " << log(alpha) << " alpha " << alpha << endl;
1941-
SS2out << "Ln(beta)_derived: " << log(beta) << " beta " << beta;
1940+
SS2out << "Ln(beta)_derived: " << log(beta) << " beta " << beta << endl;
19421941
break;
19431942
}
19441943
case 10: // Beverton-Holt with alpha, beta
@@ -2000,22 +1999,12 @@ FUNCTION void write_bigoutput()
20001999
}
20012000
}
20022001
SS2out << endl << "#" << endl << "Initial_equilibrium: " << init_equ_steepness << " # 0/1_to_use_spawner-recruitment_in_initial_equ_recruitment_calculation" << endl << "#" << endl;
2003-
if (SR_fxn == 10) SS2out << "#_Note:_h_curr_and_R0_curr_are_for_info_only;_calculated_from_alpha_beta_and_current_SPR0" << endl;
2004-
SS2out << "#_columns_with_P_will_show_time_vary_SR_parameters" << endl << "#" << endl;
2005-
SS2out << "Yr SpawnBio exp_recr with_regime bias_adjusted pred_recr dev biasadjuster era mature_bio mature_num raw_dev SPR0_curr ";
2006-
if(SR_fxn == 10)
2007-
{SS2out << "h_curr R0_curr ";}
2008-
else
2009-
{SS2out << "NA1 NA2 ";}
2010-
;
2011-
for (j = 1; j <= N_SRparm2; j++)
2012-
{SS2out << "P" << j << " ";}
2013-
SS2out << endl;
2014-
SS2out << "S/Rcurve " << SSB_virgin << " " << Recr_virgin << endl;
2002+
SS2out << "Yr SpawnBio exp_recr with_regime bias_adjusted pred_recr dev biasadjuster era mature_bio mature_num raw_dev SPR0_curr " << endl;
2003+
20152004
y = styr - 2;
2016-
SS2out << "Virg " << SSB_yr(y) << " " << exp_rec(y) << " - " << 0.0 << " Virg " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " 0.0 " << endl;
2005+
SS2out << "Virg " << SSB_yr(y) << " " << exp_rec(y) << " - " << 0.0 << " Virg " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " 0.0 " << " " << SSBpR_virgin << endl;
20172006
y = styr - 1;
2018-
SS2out << "Init " << SSB_yr(y) << " " << exp_rec(y) << " - " << 0.0 << " Init " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " " << 0.0 << endl;
2007+
SS2out << "Init " << SSB_yr(y) << " " << exp_rec(y) << " - " << 0.0 << " Init " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " " << 0.0 << " " << SSBpR_virgin << endl;
20192008

20202009
if (recdev_first < styr)
20212010
{
@@ -2059,18 +2048,9 @@ FUNCTION void write_bigoutput()
20592048
}
20602049
else
20612050
{
2062-
SS2out << " _ _ Fixed";
2063-
}
2064-
dvariable SPR_curr = Smry_Table(y, 11) / Recr_virgin;
2065-
SS2out << " " << SPR_curr << " ";
2066-
if (SR_fxn == 10)
2067-
{
2068-
SS2out << alpha * SPR_curr / (4. + alpha * SPR_curr) << " "; // steepness with current SPR
2069-
SS2out << 1. / beta * (alpha - (1. / SPR_curr)) << " "; // R0 with current SPR
2051+
SS2out << " _ _ Fixed " << SSB_B_yr(y) << " " << SSB_N_yr(y) << " _ ";
20702052
}
2071-
else
2072-
{SS2out << " - - ";}
2073-
SS2out << SRparm_byyr(y)(1,N_SRparm2) << endl;
2053+
SS2out << " " << Smry_Table(y, 11) / Recr_virgin << endl;
20742054
}
20752055

20762056
// REPORT_KEYWORD SPAWN_RECR_CURVE

SS_write_ssnew.tpl

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,11 +1509,11 @@ FUNCTION void write_nucontrol()
15091509
<< version_info2 << endl;
15101510
if (N_SC > 0)
15111511
NuStart << Starter_Comments << endl;
1512-
NuStart << datfilename << endl
1513-
<< ctlfilename << endl;
1514-
NuStart << readparfile << " # 0=use init values in control file; 1=use ss.par" << endl;
1515-
NuStart << rundetail << " # run display detail (0 = minimal; 1=one line per iter; 2=each logL)" << endl;
1516-
NuStart << reportdetail << " # detailed output (0=minimal for data-limited, 1=high (w/ wtatage.ss_new), 2=brief, 3=custom) " << endl;
1512+
NuStart << datfilename << " #_datfile" << endl
1513+
<< ctlfilename << " #_ctlfile" << endl;
1514+
NuStart << readparfile << " #_init_values_src: 0 (use init values in control file); 1 (use ss3.par)" << endl;
1515+
NuStart << rundetail << " #_screen_display: 0 (minimal); 1 (one line per iter); 2 (each logL)" << endl;
1516+
NuStart << reportdetail << " #_report_table_selection: 0 (minimal; no wtatage.ss_new); 1 (all tables); 2 (brief), 3 (custom, read list) " << endl;
15171517
if (reportdetail == 3)
15181518
{
15191519
NuStart << "# custom report options: -100 to start with minimal; -101 to start with all; -number to remove, +number to add, -999 to end" << endl;
@@ -1524,35 +1524,36 @@ FUNCTION void write_nucontrol()
15241524
}
15251525
else
15261526
{
1527-
NuStart << "#COND: custom report options: -100 to start with minimal; -101 to start with all; -number to remove, +number to add, -999 to end" << endl;
1527+
NuStart << "# COND: custom report options: -100 to start with minimal; -101 to start with all; -number to remove, +number to add, -999 to end" << endl;
15281528
}
15291529

1530-
NuStart << docheckup << " # write 1st iteration details to echoinput.sso file (0,1) " << endl;
1531-
NuStart << Do_ParmTrace << " # write parm values to ParmTrace.sso (0=no,1=good,active; 2=good,all; 3=every_iter,all_parms; 4=every,active)" << endl;
1532-
NuStart << Do_CumReport << " # write to cumreport.sso (0=no,1=like&timeseries; 2=add survey fits)" << endl;
1533-
NuStart << Do_all_priors << " # Include prior_like for non-estimated parameters (0,1) " << endl;
1534-
NuStart << SoftBound << " # Use Soft Boundaries to aid convergence (0,1) (recommended)" << endl;
1530+
NuStart << docheckup << " #_checkup: write more 1st iteration age-specific details to echoinput.sso file (0,1) " << endl;
1531+
NuStart << Do_ParmTrace << " #_parmtrace: write parm values to ParmTrace.sso: 0 (no); 1 (good_iter,active_parms); 2 (good,all); 3 (every,all); 4 (every,active)" << endl;
1532+
NuStart << Do_CumReport << " #_cumreport: write to cumreport.sso: 0 (no); 1 (like&timeseries); 2 (add survey fits)" << endl;
1533+
NuStart << Do_all_priors << " #_prior_like: include prior_like for non-estimated parameters (0,1) " << endl;
1534+
NuStart << SoftBound << " #_soft_bounds: Use Soft Boundaries to aid convergence (0,1) (recommended)" << endl;
15351535
NuStart << "#" << endl
1536-
<< N_nudata_read << " # Number of datafiles to produce: 0 turns off all *.ss_new; 1st is data_echo.ss_new, 2nd is data_expval.ss, 3rd and higher are data_boot_**N.ss," << endl;
1537-
NuStart << Turn_off_phase_rd << " # Turn off estimation for parameters entering after this phase" << endl;
1536+
<< N_nudata_read << " #_N_bootstraps: Number of datafiles to produce: 0 turns off all *.ss_new; 1st is data_echo.ss_new, 2nd is data_expval.ss, 3rd and higher are data_boot_**N.ss," << endl;
1537+
NuStart << Turn_off_phase_rd << " #_last_estimation_phase: turn off estimation for parameters entering after this phase" << endl;
15381538
NuStart << "#" << endl
1539-
<< burn_intvl << " # MCeval burn interval" << endl;
1540-
NuStart << thin_intvl << " # MCeval thin interval" << endl;
1541-
NuStart << jitter << " # jitter initial parm value by this fraction" << endl;
1542-
NuStart << STD_Yr_min_rd << " # min year for sdreport outputs (-1 for styr); #_" << STD_Yr_min << endl;
1543-
NuStart << STD_Yr_max_rd << " # max year for sdreport outputs (-1 for endyr+1; -2 for endyr+Nforecastyrs); #_" << STD_Yr_max << endl;
1544-
NuStart << N_STD_Yr_RD << " # N individual STD years " << endl;
1539+
<< burn_intvl << " #_MCMCburn" << endl;
1540+
NuStart << thin_intvl << " #_MCMCthin" << endl;
1541+
NuStart << jitter << " # jitter_fraction: jitter within parameter bounds" << endl;
1542+
1543+
NuStart << STD_Yr_min_rd << " #_minyr_sdreport: min year for sdreport outputs (-1 for styr); #_" << STD_Yr_min << endl;
1544+
NuStart << STD_Yr_max_rd << " #_maxyr_sdreport: max year for sdreport outputs (-1 for endyr+1; -2 for endyr+Nforecastyrs); #_" << STD_Yr_max << endl;
1545+
NuStart << N_STD_Yr_RD << " #_N_STD_yrs: N individual STD years " << endl;
15451546
NuStart << "#COND: vector of year values if N>0" << endl
15461547
<< STD_Yr_RD << endl;
15471548

1548-
NuStart << final_conv << " # final convergence criteria (e.g. 1.0e-04) " << endl;
1549-
NuStart << retro_yr - endyr << " # retrospective year relative to end year (e.g. -4)" << endl;
1550-
NuStart << Smry_Age << " # min age for calc of summary biomass" << endl;
1551-
NuStart << depletion_basis_rd << " # Depletion basis: denom is: 0=skip; 1=X*SSBvirgin; 2=X*SSBmsy; 3=X*SSB_styr; 4=X*SSB_endyr; 5=X*dyn_Bzero; 6=X*Bmark_SSB_unf; values>=11 invoke N multiyr with 10s & 100s digit; append .1 to invoke log(ratio); e.g. 122.1 produces log(12 yr trailing average of B/Bmsy)" << endl;
1549+
NuStart << final_conv << " #_converge_criterion: (e.g. 1.0e-04) " << endl;
1550+
NuStart << retro_yr - endyr << " #_retro_yr: retrospective year relative to end year (e.g. -4)" << endl;
1551+
NuStart << Smry_Age << " #_min_age_summary_bio" << endl;
1552+
NuStart << depletion_basis_rd << " #_depl_basis: Depletion denom is: 0=skip; 1=X*SSB_virgin; 2=X*SSB_msy; 3=X*SSB_styr; 4=X*SSB_endyr; 5=X*dyn_Bzero; 6=X*SSB_unf_bmark; values>=11 invoke N multiyr with 10s & 100s digit; append .1 to invoke log(ratio); e.g. 122.1 produces log(12 yr trailing average of B/Bmsy)" << endl;
15521553
NuStart << "# If value = 1, then Btarget in benchmark will be a fraction of SSB_virgin, else will be a fraction of SSB_benchmark" << endl;
1553-
NuStart << depletion_level << " # Fraction (X) for Depletion denominator (e.g. 0.4)" << endl;
1554-
NuStart << SPR_reporting << " # SPR_report_basis: 0=skip; 1=(1-SPR)/(1-SPR_tgt); 2=(1-SPR)/(1-SPR_MSY); 3=(1-SPR)/(1-SPR_Btarget); 4=1-SPR; 5=SPR" << endl;
1555-
NuStart << F_reporting << " # F_std_reporting_units: 0=skip; 1=exploitation(Bio); 2=exploitation(Num); 3=sum(Apical_F's); 4=mean F for range of ages (numbers weighted); 5=unweighted mean F for range of ages" << endl;
1554+
NuStart << depletion_level << " #_depl_denom_frac: fraction (X) for Depletion denominator (e.g. 0.4)" << endl;
1555+
NuStart << SPR_reporting << " #_SPR_basis: 0 (skip); 1 (1-SPR)/(1-SPR_tgt); 2 (1-SPR)/(1-SPR_MSY); 3 (1-SPR)/(1-SPR_Btarget); 4 (1-SPR); 5 (SPR)" << endl;
1556+
NuStart << F_reporting << " # F_std_units: 0 (skip); 1 (exploitation(Bio)); 2 (exploitation(Num)); 3 (sum(Apical_F's)); 4 (mean F for range of ages (numbers weighted)); 5 (unweighted mean F for range of ages)" << endl;
15561557
if (F_reporting == 4 || F_reporting == 5)
15571558
{
15581559
NuStart << F_reporting_ages << " # min and max age over which mean F will be calculated, with F=Z-M" << endl;
@@ -1561,12 +1562,12 @@ FUNCTION void write_nucontrol()
15611562
{
15621563
NuStart << "#COND 10 15 #_min and max age over which mean F will be calculated with F_reporting=4 or 5" << endl;
15631564
}
1564-
NuStart << F_std_basis_rd << " # F_std_scaling: 0=no scaling; 1=F/Fspr; 2=F/Fmsy; 3=F/Fbtgt; where F means annual F_std, Fmsy means F_std@msy; values >=11 invoke N multiyr using 10s and 100s digit; append .1 to invoke log(ratio)" << endl;
1565-
NuStart << double(mcmc_output_detail) + MCMC_bump << " # MCMC output detail: integer part (0=default; 1=adds obj func components; 2= +write_report_for_each_mceval); and decimal part (added to SR_LN(R0) on first call to mcmc)" << endl;
1566-
NuStart << ALK_tolerance << " # ALK tolerance ***disabled in code" << endl;
1567-
NuStart << irand_seed_rd << " # random number seed for bootstrap data (-1 to use long(time) as seed): # " << irand_seed << endl;
1568-
NuStart << timevary_bio_4SRR << " # Compatibility flag for legacy (0) vs improved (1) impact of timevary biology on benchmark SRR calcs >=3.30.24" << endl;
1569-
NuStart << "3.30 # check value for end of file and for version control" << endl;
1565+
NuStart << F_std_basis_rd << " # F_std_basis: 0=no scaling; 1 (F/Fspr); 2 (F/Fmsy); 3 (F/Fbtgt); where F means annual F_std, Fmsy means F_std@msy; values >=11 invoke N multiyr using 10s and 100s digit; append .1 to invoke log(ratio)" << endl;
1566+
NuStart << double(mcmc_output_detail) + MCMC_bump << " #_MCMC_output_detail: integer part (0=default; 1=adds obj func components; 2= +write_report_for_each_mceval); and decimal part (added to SR_LN(R0) on first call to mcmc)" << endl;
1567+
NuStart << ALK_tolerance << " #_deprecated: ALK tolerance ***disabled in code" << endl;
1568+
NuStart << irand_seed_rd << " #_seed: random number seed for bootstrap data (-1 to use long(time) as seed): # " << irand_seed << endl;
1569+
NuStart << timevary_bio_4SRR << " #_Compatibility: flag for legacy (0) vs improved (1) impact of timevary biology on benchmark SRR calcs >=3.30.24" << endl;
1570+
NuStart << "3.30 #_final: check value for end of file and for version control" << endl;
15701571
NuStart.close();
15711572

15721573
echoinput << "Write forecast.ss_new file " << endl;
@@ -1576,7 +1577,7 @@ FUNCTION void write_nucontrol()
15761577
if (N_FC > 0)
15771578
NuFore << Forecast_Comments << endl;
15781579
NuFore << "# for all year entries except rebuilder; enter either: actual year, -999 for styr, 0 for endyr, neg number for rel. endyr" << endl;
1579-
NuFore << Do_Benchmark << " # Benchmarks: 0=skip; 1=calc F_spr,F_btgt,F_msy; 2=calc F_spr,F0.1,F_msy; 3=add F_Blimit; " << endl;
1580+
NuFore << Do_Benchmark << " # Benchmarks: 0=skip; 1=calc F_spr,F_Btgt,F_msy; 2=calc F_spr,F0.1,F_msy; 3=add F_Blimit; " << endl;
15801581
NuFore << Do_MSY << " # Do_MSY: 1= set to F(SPR); 2=calc F(MSY); 3=set to F(Btgt) or F0.1; 4=set to F(endyr); 5=calc F(MEY) with MSY_unit options" << endl;
15811582
NuFore << "# if Do_MSY=5, enter MSY_Units; then list fleet_ID, cost/F, price/mt, include_in_Fmey_scaling; # -fleet_ID to fill; -9999 to terminate" << endl;
15821583
if (Do_MSY == 5)
@@ -1594,13 +1595,13 @@ FUNCTION void write_nucontrol()
15941595

15951596
NuFore << SPR_target << " # SPR target (e.g. 0.40)" << endl;
15961597
NuFore << BTGT_target << " # Biomass target (e.g. 0.40) as fraction of SSB_virgin if depletion basis = 1, else as fraction of SSB_unfished in benchmark" << endl;
1597-
if (Do_Benchmark == 3)
1598-
NuFore << Blim_frac << " # COND: Do_Benchmark==3; Blimit as fraction of Bmsy (neg value to use as frac of Bzero) (e.g. 0.50)" << endl;
1599-
NuFore << "#_Bmark_years: beg_bio, end_bio, beg_selex, end_selex, beg_relF, end_relF, beg_recr_dist, end_recr_dist, beg_SRparm, end_SRparm (enter actual year, or values of 0 or -integer to be rel. endyr)" << endl
1598+
if (Do_Benchmark != 3) NuFore << "#";
1599+
NuFore << Blim_frac << " # COND: Do_Benchmark==3; Blimit as fraction of Bmsy (neg value to use as frac of SSB_virgin or SSB_unfished) (e.g. 0.50)";
1600+
NuFore << "#" << endl << "# Bmark_years: beg_bio, end_bio, beg_selex, end_selex, beg_relF, end_relF, beg_recr_dist, end_recr_dist, beg_SRparm, end_SRparm (enter actual year, or values of 0 or -integer to be rel. endyr)" << endl
16001601
<< Bmark_Yr_rd << endl
16011602
<< "# " << Bmark_Yr << endl;
16021603
NuFore << "# value <0 convert to endyr-value; except -999 converts to start_yr; must be >=start_yr and <=endyr" << endl;
1603-
NuFore << Bmark_RelF_Basis << " #Bmark_relF_Basis: 1 = use year range; 2 = set relF same as forecast below" << endl;
1604+
NuFore << Bmark_RelF_Basis << " # Bmark_relF_Basis: 1 = use year range; 2 = set relF same as forecast below" << endl;
16041605
NuFore << "#" << endl
16051606
<< Do_Forecast_rd << " # Forecast: -1=none; 0=simple_1yr; 1=F(SPR); 2=F(MSY) 3=F(Btgt) or F0.1; 4=Ave F (uses first-last relF yrs); 5=input annual F scalar" << endl;
16061607
NuFore << "# where none and simple require no input after this line; simple sets forecast F same as end year F" << endl;
@@ -1621,7 +1622,7 @@ FUNCTION void write_nucontrol()
16211622
}
16221623
// else
16231624
{ // new list based format for Fcast years
1624-
NuFore << anystring << endl << anystring << "-12345 # code to invoke new format for expanded fcast year controls" << endl
1625+
NuFore << anystring << endl << anystring << " -12345 # code to invoke new format for expanded fcast year controls" << endl
16251626
<< "# biology and selectivity vectors are updated annually in the forecast according to timevary parameters, so check end year of blocks and dev vectors" << endl
16261627
<< "# input in this section directs creation of means over historical years to override any time_vary changes" << endl
16271628
<< "# Factors implemented so far: 1=M, 4=recr_dist, 5=migration, 10=selectivity, 11=rel_F, 12=recruitment" << endl

0 commit comments

Comments
 (0)