Skip to content

intervals

Parameters of the single dosing intervals of a multiple dose timecourse.

A dosing protocol with the dose times \(t_1 < \dots < t_K\) splits a timecourse into the dosing intervals \([t_k, t_{k+1}]\) and the last interval \([t_K, t_K + \tau_K]\), whose length comes from the protocol or from NCAOptions.tau. compute_intervals computes the exposure of every interval of every row of a batch, the analysis of a multiple dose curve of Gabrielsson & Weiner (2016, ch. 2.8) and Rowland & Tozer (2011, ch. 11):

  • AUC(0-tau) of the interval, with the values at its bounds interpolated so that samples outside it add no area,
  • Cmax, Tmax (relative to the start of the interval), Cmin,
  • Ctrough, the value at the end of the interval, and Cstart, the value at its start (after an intravenous bolus the post-dose value; the pre-dose value of interval k is the Ctrough of interval k-1),
  • Cavg = AUC(0-tau) / tau, fluctuation = (Cmax - Cmin) / Cavg and swing = (Cmax - Cmin) / Cmin,

and, for effect timecourses, AUEC(0-tau), Emax, TEmax, Emin, Eavg and the time above NCAOptions.effect_threshold.

The variables are named with the prefix interval_ and live over the extra dimension interval of a result, so that they do not clash with the single dose and the steady state parameters of the same curve.

The bounds of an interval. The value at the start and the value at the end are interpolated from the curve (pkpdutils.nca.auc.interpolate_at), which returns an observed value when a sample was taken at the bound. Two cases need more than an interpolation:

  • after an intravenous bolus the concentration jumps at the dose. An interval which starts before the first sample of the curve therefore gets the log-linearly back-extrapolated C0 of its first two samples, the estimate compute_parameters uses for the single dose areas.
  • an interval whose end carries the next bolus ends before that dose, so a sample recorded exactly at its end may be a post-dose sample of the next dose. It is taken as such only when it lies above the last sample inside the interval, which no decline can do; the trough is then the log-linear regression of the last (up to three) positive samples inside the interval evaluated at the end of the interval, and the row carries pkpdutils.nca.options.NCAFlag.EXTRAPOLATED_TROUGH. Every other sample at the end, and every interpolated end value, is the observed trough and is used as it is; the substitution never applies to another route, since only a bolus makes the concentration jump.
  • an interval whose end is not covered by the data, or which holds no sample at all, is incomplete: its parameters are NaN and only the number of samples is reported (pkpdutils.nca.options.NCAFlag.INCOMPLETE_INTERVAL for the last interval).

interval_n_points counts the samples the interval uses; a sample at a boundary is used by both neighbouring intervals, so the counts of the intervals of a curve do not partition its samples.

interval_variables

interval_variables(options, *, has_dose)

Names of the interval variables of an analysis, in the order of the result.

Parameters:

Name Type Description Default
options NCAOptions

the options, kind selects the concentration or the effect variables

required

Other Parameters:

Name Type Description
has_dose bool

whether the batch carries dose amounts (interval_dose)

Returns:

Type Description
tuple[str, ...]

The variable names.

compute_intervals

compute_intervals(
    t, c, *, dose_amount, dose_time, tau, route, options
)

Parameters of every dosing interval of every row of a batch.

Interval k of a row runs from the dose time t_k to the next dose time t_{k+1}, the last one from t_K to t_K + tau. The rows are vectorized and the (few) intervals are looped over; a row with fewer doses than the widest protocol of the batch has NaN in its trailing columns.

Parameters:

Name Type Description Default
t ndarray

times (N, n) in the frame of the curves, NaN for missing points

required
c ndarray

values (N, n), NaN for missing values

required

Other Parameters:

Name Type Description
dose_amount ndarray | None

dose amounts (N, K), NaN padded, None without amounts (interval_dose is then not reported)

dose_time ndarray

dose times (N, K), NaN padded, sorted per row

tau ndarray

length of the last interval per row (N,), NaN when it is unknown (the row then has no last interval)

route Route | None

route of the batch

options NCAOptions

the options

Returns:

Type Description
dict[str, ndarray]

One (N, K) array per interval variable (interval_variables) and the

ndarray

mask (N,) of the rows in which the trough of at least one interval

tuple[dict[str, ndarray], ndarray]

was extrapolated (NCAFlag.EXTRAPOLATED_TROUGH).