From 801c15b5ac1462d035ca2b55dd415b164a9c10e4 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Wed, 9 Apr 2025 10:02:03 -0700 Subject: [PATCH 1/2] repair bug in selex 41 --- SS_readcontrol_330.tpl | 8 +++++++- SS_selex.tpl | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index b91df468..337fbd7b 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -3721,6 +3721,8 @@ else { N_selparmvec(f) = abs(seltype(f, 4)) + 1; // so reads value for age 0 through this age + if (seltype(f, 1) == 41) N_selparmvec(f) +=2; // for the scaling parameters + warning << f << " " << seltype(f, 1) << " " << N_selparmvec(f) << endl; } if (seltype(f, 1) == 41) @@ -3856,7 +3858,10 @@ } else { - for (j = 1; j <= N_selparmvec(f); j++) + + k = 0; + if (seltype(f, 1) == 41) k = 2; // reduce count for the scaling parameters + for (j = 1; j <= N_selparmvec(f) - k; j++) { ParCount++; ParmLabel += "AgeSel_P" + NumLbl(j) + "_" + fleetname(f1) + "(" + NumLbl(f1) + ")"; @@ -4407,6 +4412,7 @@ echoinput << "create mirror_mask: " << mirror_mask_a(f) << endl; echoinput << "end check on min-max ranges for age selex=11" << endl; } + // seltype 41 check on the min-max age range could go here, rather than in selex calcs parmcount += N_selparmvec(f + Nfleet); } // clang-format off diff --git a/SS_selex.tpl b/SS_selex.tpl index 5a8e1dae..f4c875e9 100644 --- a/SS_selex.tpl +++ b/SS_selex.tpl @@ -1128,7 +1128,7 @@ FUNCTION void get_selectivity() { lastage = abs(seltype(f, 4)); } - + warning << "offset " << scaling_offset << endl; for (a = 1; a <= lastage; a++) { // with use of -999, lastsel stays constant until changed, so could create a linear change in ln(selex) @@ -1138,6 +1138,7 @@ FUNCTION void get_selectivity() lastsel = sp(a + 1 + scaling_offset); } tempvec_a(a) = tempvec_a(a - 1) + lastsel; // cumulative log(selex) +// warning << a << "SP: " << sp(a + 1 + scaling_offset) << " cumul: " << tempvec_a(a) << endl; } if (scaling_offset == 0) { @@ -1147,6 +1148,7 @@ FUNCTION void get_selectivity() { int low_bin = int(value(sp(1))); int high_bin = int(value(sp(2))); + // checks and adjustments below should happen in readcontrol if (low_bin < 0) { low_bin = 0; @@ -1166,6 +1168,8 @@ FUNCTION void get_selectivity() sp(1) = low_bin; sp(2) = high_bin; temp = mean(tempvec_a(low_bin, high_bin)); +// warning << tempvec_a(low_bin, high_bin) << endl; +// warning << low_bin << " " << high_bin << " mean " << temp << endl; } sel_a(y, fs, 1) = mfexp(tempvec_a - temp); a = 0; From 57b25415794e3be2701609db750746dc9a7b6c94 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Wed, 9 Apr 2025 10:44:31 -0700 Subject: [PATCH 2/2] clean-up debugging statements --- SS_readcontrol_330.tpl | 1 - SS_selex.tpl | 1 - 2 files changed, 2 deletions(-) diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index 337fbd7b..4b09b1a7 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -3722,7 +3722,6 @@ { N_selparmvec(f) = abs(seltype(f, 4)) + 1; // so reads value for age 0 through this age if (seltype(f, 1) == 41) N_selparmvec(f) +=2; // for the scaling parameters - warning << f << " " << seltype(f, 1) << " " << N_selparmvec(f) << endl; } if (seltype(f, 1) == 41) diff --git a/SS_selex.tpl b/SS_selex.tpl index f4c875e9..d5269bd9 100644 --- a/SS_selex.tpl +++ b/SS_selex.tpl @@ -1128,7 +1128,6 @@ FUNCTION void get_selectivity() { lastage = abs(seltype(f, 4)); } - warning << "offset " << scaling_offset << endl; for (a = 1; a <= lastage; a++) { // with use of -999, lastsel stays constant until changed, so could create a linear change in ln(selex)