From 36de275d281d17976bb0cf498a5243ff2c18e90f Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Thu, 15 May 2025 13:56:37 -0700 Subject: [PATCH 1/3] first commit for mirroring age retention --- SS_benchfore.tpl | 4 ++-- SS_selex.tpl | 18 ++++++++++++++---- SS_write_report.tpl | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/SS_benchfore.tpl b/SS_benchfore.tpl index fd9982c3..cc9b6f97 100644 --- a/SS_benchfore.tpl +++ b/SS_benchfore.tpl @@ -89,7 +89,7 @@ FUNCTION void setup_Benchmark() // and forecast { discmort2_a(y, f, gg) = tempvec_a / temp; } - if (seltype(f + Nfleet, 2) > 0) // using age retention + if (seltype(f + Nfleet, 2) != 0) // using age retention { tempvec_a.initialize(); for (y = Fcast_Sel_yr1; y <= Fcast_Sel_yr2; y++) @@ -470,7 +470,7 @@ FUNCTION void setup_Benchmark() // and forecast tempvec_a += discmort2_a(y, f, gg); } discmort2_a(styr - 3, f, gg) = tempvec_a / temp; - if (seltype(f + Nfleet, 2) > 0) // using age retention + if (seltype(f + Nfleet, 2) != 0) // using age retention { tempvec_a.initialize(); for (y = Bmark_Yr(3); y <= Bmark_Yr(4); y++) diff --git a/SS_selex.tpl b/SS_selex.tpl index d5269bd9..1806d646 100644 --- a/SS_selex.tpl +++ b/SS_selex.tpl @@ -1956,7 +1956,15 @@ FUNCTION void Make_FishSelex() Wt_Age_t(tz, f, g) = Wt_Age_mid(s, g); } sel_num(s, f, g) = sel_a(yf, f, gg); // selected numbers - switch (seltype(f + Nfleet, 2)) // age-retention function + int j = seltype(f + Nfleet, 2); + int k = j; + if (j < 0) // invokes mirror + { + j = -j; // fleet number being mirrored for retention + k = seltype(j + Nfleet, 2); // discard approach for fleet j + // note that retain_a and discmort2_a have already been mirrored earlier in this fxn + } + switch (k) // age-retention function { case 0: // no discarding, so just copy the selected quantities { @@ -1981,6 +1989,7 @@ FUNCTION void Make_FishSelex() sel_ret_num(s, f, g) = elem_prod(sel_num(s, f, g), retain_a(y, f, gg)); // retained numbers sel_dead_bio(s, f, g) = elem_prod(Wt_Age_t(tz, f, g), discmort2_a(y, f, gg)); // dead wt sel_dead_num(s, f, g) = discmort2_a(y, f, gg); // dead numbers +// if (y == styr) warning << f << " sel_ret " << sel_ret_bio(s, f, g) << endl << " sel_dead " << sel_dead_bio(s, f, g) << endl; break; } case 3: // all selected fish are dead; use this for a discard only fleet @@ -1992,10 +2001,11 @@ FUNCTION void Make_FishSelex() break; } } - if (docheckup == 1 && y == styr) + if (docheckup == 1 && y == styr && do_once == 1) { - echoinput << " sel_ret_bio " << sel_ret_bio(s, f, g) << endl - << " sel_dead_bio " << sel_dead_bio(s, f, g) << endl; + echoinput << f << " sel_ret_bio " << sel_ret_bio(s, f, g) << endl + << f << "retain_a " << retain_a(y, f, gg) << endl + << f << " sel_dead_bio " << sel_dead_bio(s, f, g) << endl; } } diff --git a/SS_write_report.tpl b/SS_write_report.tpl index 8f0373ce..f51aa464 100644 --- a/SS_write_report.tpl +++ b/SS_write_report.tpl @@ -2924,7 +2924,7 @@ FUNCTION void write_bigoutput() } for (f = 1; f <= Nfleet; f++) { - if (seltype(f + Nfleet, 2) > 0) // using age retention + if (seltype(f + Nfleet, 2) != 0) // using age retention { for (y = styr - 3; y <= YrMax; y++) for (gg = 1; gg <= gender; gg++) From 7d7784ad1aec992d4caf34a26a687a878f17fc54 Mon Sep 17 00:00:00 2001 From: Elizabeth Perl Date: Fri, 16 May 2025 09:59:51 -0400 Subject: [PATCH 2/3] Add additional ubuntu libraries to get run-ss3-bootstrap.yml running --- .github/workflows/run-ss3-bootstrap.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-ss3-bootstrap.yml b/.github/workflows/run-ss3-bootstrap.yml index a886e18c..af3fd92d 100644 --- a/.github/workflows/run-ss3-bootstrap.yml +++ b/.github/workflows/run-ss3-bootstrap.yml @@ -43,6 +43,7 @@ jobs: sudo apt-get install --only-upgrade libstdc++6 sudo apt-get install -y libcurl4-openssl-dev sudo apt-get install -y libfontconfig1-dev + sudo apt-get install -y libharfbuzz-dev libfribidi-dev - name: Setup R uses: r-lib/actions/setup-r@v2 From 556588af2de80f5b9240ee3478f642bf5478cf04 Mon Sep 17 00:00:00 2001 From: Elizabeth Perl Date: Fri, 16 May 2025 14:24:37 +0000 Subject: [PATCH 3/3] update r4ss gha with extra ubuntu libraries needed --- .github/workflows/test-r4ss-with-ss3.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-r4ss-with-ss3.yml b/.github/workflows/test-r4ss-with-ss3.yml index d853359b..e1d9e618 100644 --- a/.github/workflows/test-r4ss-with-ss3.yml +++ b/.github/workflows/test-r4ss-with-ss3.yml @@ -43,6 +43,7 @@ jobs: sudo apt-get install --only-upgrade libstdc++6 sudo apt-get install -y libcurl4-openssl-dev sudo apt-get install -y libfontconfig1-dev + sudo apt-get install -y libharfbuzz-dev libfribidi-dev - name: Setup R uses: r-lib/actions/setup-r@v2