Closed kylebaron closed 3 months ago
The compartment is not explicitly set to 1 in reset, correct? It's just that it's left at the default value.
Yeah, that's right. The description I left was misleading on intent - I didn't have it clear in my own head at first. But now I think that's the only reasonable thing to do; and it's consistent with how ev()
objects operate on the R side.
Thanks for reviewing this.
Summary
Trying to follow a similar pattern to what we do for replace, bolus and friends; this should (hopefully) all be natural / consistent riffing on the
evtools
machinery that is already in place.EVID 3
; it resets the entire PK system (all compartments)reset()
functions withself
as the first argument (the event is sent off right away, no return) and withoutself
as first argument (you get the object back, with opportunity to interact with it)reset()
with option to pass along dosing information; this isEVID 4
in NONMEM and mrgsolve; it resets the system and then dosesreset()
with dose, I'm tacking onrate
as an optional argument, defaulting to0
(or bolus); this is a slight difference from what we've done before in that we don't provide separate functions to reset and bolus or reset and infuseI also went back into some of the previously-developed functions and used explicit
evt::
references to functions inside theevtools
namespace. I got a little spooked adding a function with a vanilla name likereset()
and wanted to get explicit about all of this in the code.Tests
You can see from Files Changed that tests are in
inst/maintenance/unit-cpp/test-evtools.R
. This can be run withmake test-cpp
from the command line.The tests are a little tedious, trying to figure out when the system was reset and when there was a dose. I thought to run the equivalent simulation with no evtools involvement and verify results later on in the process; I think this is pretty compelling, but kept the more brute force tests anyway; probably still useful for catching something that might go wrong some day.