Skip to main content

Module predictions

Module predictions 

Source
Expand description

AUC / dense-grid helpers used by the cost function.

For the AUC targets, concentrations are simulated on a dense time grid and integrated with the trapezoidal rule:

AUC(t) = Σᵢ (C[i] + C[i-1]) / 2 × (t[i] - t[i-1])

Functions§

calculate_auc_at_times
Calculate cumulative AUC at target times using the trapezoidal rule.
calculate_dense_times
Generate a dense time grid for AUC calculations.
calculate_interval_auc_per_observation
Calculate interval AUC for each observation independently.
find_last_dose_time_before
Find the time of the last dose (bolus or infusion) before a given observation time. Returns 0.0 if no dose exists before obs_time.