-
Notifications
You must be signed in to change notification settings - Fork 35
Macros to determine the last record for an individual or a simulation #1327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6bab7f6
e25c711
3c01d76
d4c5f2a
693ae4f
a6e7561
4d765d3
3f2c68c
3068c9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -427,7 +427,9 @@ Rcpp::List DEVTRAN(const Rcpp::List parin, | |
|
|
||
| double tfrom = a[i].front()->time(); | ||
| double tto = tfrom; | ||
| double maxtime = a[i].back()->time(); | ||
|
|
||
| const double maxtime = a[i].back()->time(); | ||
| const int NNI = dat.inrow(i); | ||
|
|
||
| for(int k=0; k < neta; ++k) prob.eta(k,eta(i,k)); | ||
| for(int k=0; k < neps; ++k) prob.eps(k,eps(crow,k)); | ||
|
|
@@ -459,18 +461,22 @@ Rcpp::List DEVTRAN(const Rcpp::List parin, | |
| Rcpp::checkUserInterrupt(); | ||
| ic = prob.interrupt; | ||
| } | ||
|
|
||
| rec_ptr this_rec = a[i][j]; | ||
|
|
||
| if(crow == NN) continue; | ||
| this_rec->id(id); | ||
| tto = this_rec->time(); | ||
|
|
||
| // TODO: simplify | ||
| if(icrow==NNI || crow==NN || tto > maxtime) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it correct that this new
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah; it's probably on the conservative side. I discovered that it was possible for some in consequential events happening after we hit the last official output record for a given individual. For example, we only calculate the end time of an infusion at the time when it starts, not when the dose is scheduled to happen (potentially in the future through But you're right ... if Could you test with just if(icrow==NNI || crow==NN || tto > maxtime) {
continue;
}
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also ... I did open an issue to at least review cases where we can be more careful of turning stuff off.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the details/explanation. Leaning conservative/safe is of course fine by me.
Yes, the tests still all pass on my end with the condition reduced to
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for checking that. I was almost going to push a commit that removed |
||
| continue; | ||
| } | ||
|
|
||
| rec_ptr this_rec = a[i][j]; | ||
|
|
||
| // Only update row counters on output records | ||
| if(this_rec->output()) { | ||
| prob.irown(icrow); | ||
| prob.rown(crow); | ||
| } | ||
|
|
||
| this_rec->id(id); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this up for clarity. |
||
| } | ||
|
|
||
| if(prob.systemoff()) { | ||
| // This starts a loop that will finish the remaining records | ||
|
|
@@ -483,8 +489,8 @@ Rcpp::List DEVTRAN(const Rcpp::List parin, | |
| if(status==999) CRUMP("999 sent from the model."); | ||
| if(this_rec->output()) { | ||
| if(status==1) { | ||
| ans(crow,0) = this_rec->id(); | ||
| ans(crow,1) = this_rec->time(); | ||
| ans(crow,0) = id; | ||
| ans(crow,1) = tto; | ||
| for(unsigned int k=0; k < n_capture; ++k) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make consistent with main output writing code. |
||
| ans(crow,(k+capture_start)) = prob.capture(capture[k]); | ||
| } | ||
|
|
@@ -511,9 +517,7 @@ Rcpp::List DEVTRAN(const Rcpp::List parin, | |
| &prob | ||
| ); | ||
| } | ||
|
|
||
| tto = this_rec->time(); | ||
|
|
||
|
|
||
| double dt = (tto-tfrom)/(tfrom == 0.0 ? 1.0 : tfrom); | ||
|
|
||
| if((dt > 0.0) && (dt < mindt)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The total row count for "this" individual.