Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Fix 325
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Jan 25, 2024
1 parent f04469a commit 2b62a3e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
2 changes: 2 additions & 0 deletions inst/include/rxode2parseHandleSs.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ extern "C" {
double *dur2,
int *canBreak,
double *curLagExtra,
int *isSsLag,
solveWith1Pt_fn solveWith1Pt);

typedef void (*handleSSinf8_fn)(double *yp,
Expand Down Expand Up @@ -923,6 +924,7 @@ extern "C" {
&dur2,
&canBreak,
&curLagExtra,
&isSsLag,
solveWith1Pt);
*istate=1;
// REprintf("Assign ind->ixds to %d (idx: %d) #6\n", ind->ixds, ind->idx);
Expand Down
34 changes: 20 additions & 14 deletions src/comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ void solveSSinf_lin(double *yp,
double *dur2,
int *canBreak,
double *curLagExtra,
int *isSsLag,
solveWith1Pt_fn solveWith1Pt) {
lin_context_c_t *lin = (lin_context_c_t*)(ctx);
int linCmt = ind->linCmt;
Expand Down Expand Up @@ -267,15 +268,18 @@ void solveSSinf_lin(double *yp,
&(lin->ka), &(lin->k10));
break;
}
if (*curLagExtra > 0) {
double lag = getLag(ind, ind->id, ind->cmt, getAllTimes(ind, ind->idx));
if (lag + *dur < *curIi) {
ind->InfusionRate[op->neq] = 0.0;
if (*isSsLag) {
if (*curLagExtra > 0) {
double lag = getLag(ind, ind->id, ind->cmt, 0.0);
if (lag + *dur < *curIi) {
ind->InfusionRate[op->neq] = 0.0;
}
ind->InfusionRate[op->neq+1] = 0.0;
} else {
ind->InfusionRate[op->neq] = ind->InfusionRate[op->neq+1] = 0.0;
}
ind->InfusionRate[op->neq+1] = 0.0;
} else {
ind->InfusionRate[op->neq] = 0.0;
ind->InfusionRate[op->neq+1] = 0.0;
ind->InfusionRate[op->neq] = ind->InfusionRate[op->neq+1] = 0.0;
}
return;
}
Expand All @@ -296,15 +300,17 @@ void solveSSinf_lin(double *yp,
&(lin->ka), &(lin->k10));
break;
}
if (*curLagExtra > 0) {
double lag = getLag(ind, ind->id, ind->cmt, getAllTimes(ind, ind->idx));
// lag + dur < ii
if (lag + *dur < *curIi) {
// should be off
if (*isSsLag) {
if (*curLagExtra > 0) {
double lag = getLag(ind, ind->id, ind->cmt, 0.0);
// lag + dur < ii
if (lag + *dur < *curIi) {
// should be off
ind->InfusionRate[op->neq + central] = 0.0;
}
} else {
ind->InfusionRate[op->neq + central] = 0.0;
}
} else {
ind->InfusionRate[op->neq + central] = 0.0;
}
}

Expand Down
34 changes: 21 additions & 13 deletions tests/testthat/test-nmtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@ solveEqual <- function(id) {
dplyr::filter(EVID == 0) |>
dplyr::mutate(Cc=Cc)
assign("s1", s1, envir=globalenv())
print(ggplot(data=s1, aes(TIME, Cc)) +
ggplot(data=s1, aes(TIME, Cc)) +
geom_line(col="red", linewidth=1.2) +
theme_bw() +
geom_line(data=d2, aes(time, cp), col="blue", lty=2, linewidth=1.2) +
ggtitle(paste0("id=", id, "; red=solved; blue: NONMEM")))
ggtitle(paste0("id=", id, "; red=solved; blue: NONMEM"))
}

# FIXME

solveEqual(9)

solveEqual(10)

fsolveEqual(12)
solveEqual(12)

solveEqual(102)

Expand All @@ -38,26 +36,21 @@ solveEqual(110)

solveEqual(210)

solveEqual(225)

solveEqual(310)

solveEqual(325)

solveEqual(410)

solveEqual(510)

solveEqual(525)


solveEqual(610)



#?
solveEqual(415)
solveEqual(425)
solveEqual(609)
solveEqual(725)



# Fixed
Expand All @@ -78,6 +71,8 @@ solveEqual(7)

solveEqual(8)

solveEqual(9)

solveEqual(11)

solveEqual(13)
Expand Down Expand Up @@ -114,20 +109,33 @@ solveEqual(211)

solveEqual(311)

solveEqual(325)

solveEqual(411)

solveEqual(425)

solveEqual(509)

solveEqual(525)


solveEqual(609)

solveEqual(625)

solveEqual(709)

solveEqual(725)

solveEqual(809)

solveEqual(909)

solveEqual(1009)

solveEqual(225)

# ?
solveEqual(409)

Expand Down

0 comments on commit 2b62a3e

Please sign in to comment.