Fix pk.nca() error on unsorted concentration-time data (#568)#569
Merged
Conversation
Group-level concentration data (passed as conc.group/time.group to parameters such as aucint*) was passed to the calculation routines in its original row order. Parameters that interpolate/extrapolate over the full group via interp.extrap.conc() assert that time is sorted, so unsorted input rows caused a "Must be sorted" error. Sort data_conc by time at the top of pk.nca.intervals() so the group-level vectors are time-ordered. The interval-level data were already sorted per interval, so only the group-level path was affected. Adds a regression test verifying that unsorted input produces the same results as pre-sorted input across aucint*, cmax, and half.life, and a NEWS.md entry. Fixes the issue reported in humanpred/pknca issue 568. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Group-level concentration data (passed as
conc.group/time.grouptoparameters such as
aucint*) was passed to the calculation routines inits original row order. Those parameters interpolate/extrapolate over the
full group via
interp.extrap.conc(), which asserts that time is sorted,so unsorted input rows caused a "Must be sorted" error.
Fix: sort
data_concby time at the top ofpk.nca.intervals(). Theinterval-level data were already sorted per interval, so only the
group-level path was affected.
Adds a regression test (unsorted input matches pre-sorted results across
aucint*, cmax, half.life) and a NEWS.md entry.
Fixes #568.