Skip to content

Commit

Permalink
fix selectivity for N1_model = 1 option. Fix infinte residual plot is…
Browse files Browse the repository at this point in the history
…sue for Ecov
  • Loading branch information
timjmiller committed May 2, 2022
1 parent 9ae86ab commit 865ca3d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
wham 1.0.6.9000
=========================

### Bug fixes

* Fix age of full selection for N1_model = 1 [issue 56][https://github.com/timjmiller/wham/issues/56].


wham 1.0.6 (2022-04-08)
=========================
Expand Down
8 changes: 6 additions & 2 deletions R/wham_plots_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ plot.osa.residuals <- function(mod, do.tex=FALSE, do.png=FALSE, fontfam="", res=
# set plot lims using max residual for any component (easier to compare if all the same)
ylim.max <- max(abs(range(resids, na.rm=TRUE)))
if(is.infinite(ylim.max)) {
cat("Infinite osa residuals for catch proportions at age in fleet ", f, ", so using +/-10 for range of y axis \n")
cat("Infinite osa residuals for catch proportions at age in fleet ", f, ", so using +/-10 for range \n")
ylim.max = 10
}
ylims <- c(-ylim.max, ylim.max)
Expand Down Expand Up @@ -333,7 +333,7 @@ plot.osa.residuals <- function(mod, do.tex=FALSE, do.png=FALSE, fontfam="", res=
# set plot lims using max residual for any component (easier to compare if all the same)
ylim.max <- max(abs(range(resids, na.rm=TRUE)))
if(is.infinite(ylim.max)) {
cat("Infinite osa residuals for proportions at age in index ", f, ", so using +/-10 for range of y axis \n")
cat("Infinite osa residuals for proportions at age in index ", f, ", so using +/-10 for range \n")
ylim.max = 10
}
ylims <- c(-ylim.max, ylim.max)
Expand Down Expand Up @@ -427,6 +427,10 @@ plot.osa.residuals <- function(mod, do.tex=FALSE, do.png=FALSE, fontfam="", res=

# set plot lims using max residual for any component (easier to compare if all the same)
ylim.max <- max(abs(range(dat$residual, na.rm=TRUE)))
if(is.infinite(ylim.max)) {
cat("Infinite osa residuals for Environmental observations in series ", f, ", so using +/-10 for range of y axis \n")
ylim.max = 10
}
ylims <- c(-ylim.max, ylim.max)

# 1. trend vs. year
Expand Down
4 changes: 2 additions & 2 deletions src/wham_v0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,8 @@ Type objective_function<Type>::operator() ()
if(a==0) NAA(0,0) = exp(log_N1_pars(0));
else
{
if(a == n_ages-1) NAA(0,a) = NAA(0,a-1)/(1.0 + exp(-MAA(0,a) - exp(log_N1_pars(1)) * FAA_tot(0,a)/FAA_tot(0,n_ages-1)));
else NAA(0,a) = NAA(0,a-1)* exp(-MAA(0,a) - exp(log_N1_pars(1)) * FAA_tot(0,a)/FAA_tot(0,n_ages-1));
if(a == n_ages-1) NAA(0,a) = NAA(0,a-1)/(1.0 + exp(-MAA(0,a) - exp(log_N1_pars(1)) * FAA_tot(0,a)/FAA_tot(0,which_F_age(0)-1)));
else NAA(0,a) = NAA(0,a-1)* exp(-MAA(0,a) - exp(log_N1_pars(1)) * FAA_tot(0,a)/FAA_tot(0,which_F_age(0)-1));
}
}
SSB(0) += NAA(0,a) * waa(waa_pointer_ssb-1,0,a) * mature(0,a) * exp(-ZAA(0,a)*fracyr_SSB(0));
Expand Down

0 comments on commit 865ca3d

Please sign in to comment.