Skip to content

Commit

Permalink
fix bug in use of user-spelied waa, maturity in projection years
Browse files Browse the repository at this point in the history
  • Loading branch information
timjmiller committed Aug 27, 2024
1 parent e8d7fde commit 24dd1ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/multi_wham.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,16 +795,26 @@ Type objective_function<Type>::operator() ()
fracyr_SSB_all.row(y) = fracyr_ssb_y;
for(int s = 0; s < n_stocks; s++) for(int a = 0; a < n_ages; a++) {

if(mature_proj.size()>1) mature_all(s,y,a) = mature_proj(s,y-n_years_model,a);
else mature_all(s,y,a) = mat_y(s,a);
if(mature_proj.size()>1) {
mat_y(s,a) = mature_proj(s,y-n_years_model,a);
// mature_all(s,y,a) = mature_proj(s,y-n_years_model,a);
}
mature_all(s,y,a) = mat_y(s,a);

if(waa_proj.size()>1) waa_ssb(s,y,a) = waa_proj(waa_pointer_ssb(s)-1,y-n_years_model,a);
else waa_ssb(s,y,a) = waa_ssb_y(s,a);
if(waa_proj.size()>1) {
waa_ssb_y(s,a) = waa_proj(waa_pointer_ssb(s)-1,y-n_years_model,a);
}
waa_ssb(s,y,a) = waa_ssb_y(s,a);
}


for(int f = 0; f < n_fleets; f++) for(int a = 0; a < n_ages; a++) {
if(waa_proj.size()>1) waa_catch(f,y,a) = waa_proj(waa_pointer_fleets(f)-1,y-n_years_model,a);
else waa_catch(f,y,a) = waa_catch_y(f,a);
if(waa_proj.size()>1) {
waa_catch_y(f,a) = waa_proj(waa_pointer_fleets(f)-1,y-n_years_model,a);
}
waa_catch(f,y,a) = waa_catch_y(f,a);
}

// see("yproj");
// see(y);
// see(annual_Ps.dim);
Expand Down
4 changes: 4 additions & 0 deletions src/projections.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ vector<Type> get_F_from_Catch(vector<Type> Catch, array<Type> NAA, array<Type> l
//log_F_iter(i+1) = log_F_iter(i) - (logcatch_at_F(log_F_i) - log(Catch))/grad_log_catch_at_F(0); //uses log(catch) for potentially slower changes in derivatives?
// log_F_iter(i+1) = log_F_iter(i) - (logcatch_at_F(log_F_i) - log(Catch))/grad_log_catch_at_F(0); //uses log(catch) for potentially slower changes in derivatives?
}
// trace = 1;
if(trace) see(Catch);
if(trace) see(logcatch_at_F(log_F_i));
if(trace) see(waacatch);
if(trace) see(log_F_iter);
vector<Type> res = exp(vector<Type> (log_F_iter.row(n-1)));
return res;
Expand Down

0 comments on commit 24dd1ab

Please # to comment.