Classes¶
Model¶
- class pkmodel.Model(args_dict)¶
A Pharmokinetic (PK) model This is a class which defines a PK model parameters by parsing the parameters from a dictionary stored within models.py file. You also need to add the parameters for Dose(t) including the start and stop times for drug administration (h), duration (h) of each administration, and the frequency of administration (h).
Parameters¶
name: string, mandatory args_dict: dictionary, mandatory, you need to import this from the models.py file.
- pkmodel.Model.add_dose_t_tophat_params(self, start_h, stop_h, duration_h, freq_h)¶
This function adds parameters to produce a tophat function to be used in creating a protocol.
Parameters¶
start_h: float, mandatory, start time in hours. stop_h: float, mandatory, stop time in hours. duration_h: float, mandatory, duration of drug administration in hours. freq_h: float, mandatory, Frequency of drug administration in hours.
Protocol¶
- class pkmodel.Protocol(args_dict, start_h=0, stop_h=240, duration_h=2, freq_h=24)¶
A Pharmokinetic (PK) protocol
- pkmodel.Protocol.dose(self, t)¶
The Dose function that drives the system.
Parameters¶
start_h: the initial time where the model begins solving
stop_h : the final time where the model stops solving
duration_h : the length of time of the dose pulse.
freq_h: the frequency at which the pulse repeats
Note the height of the top hat function is given by ‘X’ in models.py
Outputs¶
A value either 0 or X at each t
- pkmodel.Protocol.bolus_rhs(self, t, y, Q_p1, V_c, V_p1, CL, k_a, N)¶
The RHS of the bolus ODE system which solves the following system:
\[\begin{split}\frac{dq_c}{dt} &= \text{Dose}(t) - \frac{q_c}{V_c} CL - Q_{p1} \left(\frac{q_c}{V_c} - \frac{q_{p1}}{V_{p1}}\right) \\ \frac{dq_{p1}}{dt} &= Q_{p1} \left(\frac{q_c}{V_c} - \frac{q_{p1}}{V_{p1}}\right)\end{split}\]Parameters¶
Q_p1, V_c, V_p1, CL, k_a, N Note that k_a and q_0 are not used for the Bolus model. dq_0/dt = 0 for all t.
- pkmodel.Protocol.subcut_rhs(self, t, y, Q_p1, V_c, V_p1, CL, k_a, N)¶
The RHS of the bolus ODE system which solves the following system:
\[\begin{split}\frac{dq_0}{dt} &= \text{Dose}(t) - k_{a} q_{0} \\ \frac{dq_c}{dt} &= k_{a} q_{0} - \frac{q_c}{V_c} CL - Q_{p1} \left(\frac{q_c}{V_c} - \frac{q_{p1}}{V_{p1}}\right) \\ \frac{dq_{p1}}{dt} &= Q_{p1} \left(\frac{q_c}{V_c} - \frac{q_{p1}}{V_{p1}}\right)\end{split}\]Parameters¶
Q_p1, V_c, V_p1, CL, k_a, N
Solution¶
- class pkmodel.Solution(args_dict, t_eval, y0)¶
A Pharmokinetic (PK) solution
Parameters¶
Inherits model paramters from the Model class
- pkmodel.Solution.solve(self, start_h=0, stop_h=240, duration_h=24, freq_h=24)¶
A function that solves the ODE system for the model imported
Parameters¶
A list of models from models.py, a numpy array of the times to solve (t_eval) and a y_0 array for initial values.
outputs¶
saves a file with t, q_0 , q_c and q_1 saved as numpy arrays. saves as “modelname”.npz.