Skip to content

Regimens

Doses given when a model is run, replacing the doses written in the model; see Doses and regimens.

tenqsp.bolus(target, amount, *, times=None, start=None, every=None, n=None, shape=None)

Bolus doses: bolus("depot", 100, times=[0, 12]), or repeated, bolus("depot", 100, start=0, every=12, n=7) (seven doses). amount is one number for every time or one per time. The target is a compartment, or one element of a field: C.at(organ="gut", sub="vascular") or "C[organ=gut, sub=vascular]", or a field over continuous axes with shape, which spreads each amount as an initial value's shape does: bolus("G", 100, times=[0, 12], shape=tq.point("g", at=0)).

tenqsp.infusion(target, *, rate=None, amount=None, duration=None, start=None, times=None, every=None, n=None, shape=None)

Zero-order infusions: give two of rate (amount per time), amount and duration, e.g. infusion("centr", rate=50, duration=2, start=48). Repeated: start=0, every=24, n=5, or times=[...] (the start of each). Into a field over continuous axes, shape spreads the rate as for bolus.

tenqsp.regimen_from_table(table, *, targets=None)

A regimen from NONMEM-style dose records: a pandas DataFrame or a mapping of columns.

Columns (case-insensitive): TIME, AMT, CMT (a compartment name, or a number mapped by targets={1: "depot", 2: "centr"}); optional RATE (0 or missing: a bolus; > 0: an infusion of AMT at that rate), DUR (an infusion of AMT over DUR), ADDL and II (additional doses every II), EVID (rows with EVID 1 are doses; 0 and 2 are not) and MDV. Rows with AMT missing or 0 are not doses. Other columns (DV, covariates) are not read.

Not supported, so refused rather than read differently: resets (EVID 3 or 4), steady state (SS other than 0), several subjects (ID with more than one value: one regimen per subject), a fractional ADDL, and both RATE and DUR on one row.

tenqsp.regimens_from_table(table, *, targets=None)

One regimen per subject from NONMEM-style dose records with an ID column: {ID: Regimen}, in the order the subjects first appear. Each subject's rows are read by regimen_from_table (same columns, same rules); a subject with no dose rows (only observations) gets an empty regimen. A whole-number ID is given as an int.

tenqsp.Regimen

Boluses and infusions; combine with +. Regimen() is no doses.

tenqsp.Bolus dataclass

amount into target (sliced by where) at time.

tenqsp.Infusion dataclass

rate (amount per time) into target from start for duration.