Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion SS_objfunc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,17 @@ FUNCTION void evaluate_the_objective_function()
// SS_Label_Info_25.9 #Fit to tag-recapture
if(Do_TG>0)
{
k=1+2*N_TG;
for (TG=1;TG<=N_TG;TG++)
{
overdisp=TG_parm(2*N_TG+TG);
j=TG+2*N_TG;
if(TG_parm_PH(j)==-1000.)
{ }// do nothing keep k at same value
else
{
if (TG_parm_PH(j)>-1000.) {k=j;} else {k=-1000-TG_parm_PH(j)+2*N_TG;}
}
overdisp=TG_parm(k);
for (TG_t=TG_mixperiod;TG_t<=TG_endtime(TG);TG_t++)
{
TG_recap_exp(TG,TG_t)(1,Nfleet)+=1.0e-6; // add a tiny amount
Expand Down
2 changes: 1 addition & 1 deletion SS_prelim.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ PRELIMINARY_CALCS_SECTION
else
{k++;}
}
if(k!=1) {N_warn++; cout<<"error in length data"; warning<<N_warn<<" "<<" must have only 1 sample with real info in length superperiod "<<j<<endl; exit(1);}
if(k>1) {N_warn++; cout<<"error in length data"; warning<<N_warn<<" "<<" must have only 1 sample with real info in length superperiod "<<j<<endl; exit(1);}
for (i=suprper_l1(f,j);i<=suprper_l2(f,j);i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time, it would be nice to break the changes addressing 2 issues into separate commits (although I think 1 PR is fine!)

{
if(header_l(f,i,3)<0) // so one of the obs to be combined
Expand Down
16 changes: 12 additions & 4 deletions SS_readcontrol_330.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3895,6 +3895,12 @@
{TG_parm2(k,7)=-1000; } // phase
}
}

TG_parm_LO=column(TG_parm2,1);
TG_parm_HI=column(TG_parm2,2);
k=3*N_TG+2*Nfleet1;
for (j=1;j<=k;j++) TG_parm_PH(j)=TG_parm2(j,7); // write it out due to no typecast available

echoinput<<"create tag labels "<<endl;
// SS_Label_Info_4.10.1 #Create parameter count and parameter names for tag parameters
onenum=" ";
Expand All @@ -3913,6 +3919,12 @@
{
sprintf(onenum, "%d", j);
ParCount++; ParmLabel+="TG_overdispersion_"+onenum+CRLF(1);
if(TG_parm_LO(2*N_TG+j)<1.0)
{N_warn++; warning<<N_warn<<" overdispersion par_min is <1.0 for TG= "<<j<<"; value = "<<TG_parm_LO(2*N_TG+j)<<"; changed to 1.001 for run"<<endl;
TG_parm_LO(2*N_TG+j)=1.001;}
if(TG_parm2(2*N_TG+j,3)<1.0)
{N_warn++; warning<<N_warn<<" overdispersion parameter is <1.0 for TG= "<<j<<"; value = "<<TG_parm2(2*N_TG+j,3)<<"; changed to 1.001 for run"<<endl;
TG_parm2(2*N_TG+j,3)=1.001;}
}
for (j=1;j<=Nfleet;j++)
{
Expand All @@ -3931,10 +3943,6 @@
}
}

TG_parm_LO=column(TG_parm2,1);
TG_parm_HI=column(TG_parm2,2);
k=3*N_TG+2*Nfleet1;
for (j=1;j<=k;j++) TG_parm_PH(j)=TG_parm2(j,7); // write it out due to no typecast available
echoinput<<" Processed/generated Tag parameters "<<endl<<TG_parm2<<endl;

}
Expand Down
23 changes: 0 additions & 23 deletions SS_tagrecap.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ FUNCTION void Tag_Recapture()
TG_rep_decay(f) = TG_parm(k);
}
}

for (TG=1;TG<=N_TG;TG++)
{
firstseas=int(TG_release(TG,4)); // release season
Expand Down Expand Up @@ -75,7 +74,6 @@ FUNCTION void Tag_Recapture()
TG_save(TG,1)=value(TG_init_loss);
TG_save(TG,2)=value(TG_chron_loss);
}

TG_t=0;
for (y=TG_release(TG,3);y<=endyr;y++)
{
Expand Down Expand Up @@ -165,24 +163,3 @@ FUNCTION void Tag_Recapture()
} // end years
} // end loop of tag groups
} // end having tag groups

/*
// SS_Label_Info_25.9 #Fit to tag-recapture
// This code fragment resides in SS_objfunc.tpl
if(Do_TG>0)
{
for (TG=1;TG<=N_TG;TG++)
{
overdisp=TG_parm(2*N_TG+TG);
for (TG_t=TG_mixperiod;TG_t<=TG_endtime(TG);TG_t++)
{
TG_recap_exp(TG,TG_t)(1,Nfleet)+=1.0e-6; // add a tiny amount
TG_recap_exp(TG,TG_t,0) = sum(TG_recap_exp(TG,TG_t)(1,Nfleet));
TG_recap_exp(TG,TG_t)(1,Nfleet)/=TG_recap_exp(TG,TG_t,0);
if(Nfleet>1) TG_like1(TG)-=TG_recap_obs(TG,TG_t,0)* (TG_recap_obs(TG,TG_t)(1,Nfleet) * log(TG_recap_exp(TG,TG_t)(1,Nfleet)));
TG_like2(TG)-=log_negbinomial_density(TG_recap_obs(TG,TG_t,0),TG_recap_exp(TG,TG_t,0),overdisp);
}
}
if(do_once==1) cout<<" did tag obj_fun "<<TG_like1<<endl<<TG_like2<<endl;
}
*/