TenQSP
Structured-population PDEs for quantitative systems pharmacology, in JAX.
Pharmacometric and QSP models describe populations: drug molecules, bacteria, blood cells, tumour cells. Often a population is not uniform. Cells differ in age, maturation, dormancy, depth in a tissue or genotype, and that difference decides how they respond to a drug. The usual remedy is a chain of compartments, which hides the structure in a choice of how many compartments to use.
TenQSP lets you write the structure itself. A population becomes a field over axes, continuous (age, maturation, depth) or categorical (phenotype, organ), next to ordinary compartments, and the model is written as equations, the way a paper writes them:
model delayed_pk
axis z in [0, 1] n=20 kind=one_way # progress through the gut: 0 swallowed, 1 absorbed
param MTT=1.5, ka=2, CL=4, V=30
field G(z) # drug in transit, by progress
d_t(G) = -d_z(G/MTT) using sharp # moves along z at speed 1/MTT
at z=1: outflow
d_t(depot) = G(z=1)/MTT - ka*depot
d_t(centr) = ka*depot - CL/V*centr
dose G at t=0 to 48 every 12: 100*point(z, at=0)
observable conc = centr/V
import tenqsp as tq
m = tq.load("delayed_pk.tq")
sol = m.solve((0, 72), times=range(73))
sol["conc"]
TenQSP turns the model into a system of ODEs by the finite-volume method, works out which states affect which (the sparse Jacobian), and solves it with a stiff solver: scipy's, or TenQSP's own in JAX. The same model can be built step by step in Python, run over many scenarios, and differentiated with respect to its parameters, dose amounts and dose times.
- Equations as in a paper, with boundary conditions under their equation;
m.to_latex()prints them for an article,m.explain()says what each term means. - Books that balance: a ledger accounts for every cell, molecule or phage.
- Nothing hidden: no value is clipped or capped behind your back.
- One build, many runs: changing parameters, doses or output times never rebuilds.
- Exact gradients through JAX, for estimation and sensitivity analysis.
Install
pip install tenqsp
TenQSP needs Python 3.12 or later. For plots add tenqsp[plot]; for labelled array output,
tenqsp[xarray].
Documentation
https://tenqsp.github.io/tenqsp/: start here, the user guide, twelve tutorials, and the notation and Python references.
Cite
If you use TenQSP in your work, please cite it. Each release is archived on Zenodo:
doi:10.5281/zenodo.23804658 cites TenQSP in
general, and the Zenodo page gives a DOI for each version. See also
CITATION.cff, or "Cite this repository" on GitHub.
Licence and credit
TenQSP is free and open source under the Apache License 2.0. It was created by
Dongwoo Chae, MD, PhD, Yonsei University College of Medicine
(ORCID 0000-0002-7675-3821); copyright 2026 Yonsei
University Health System (see NOTICE). Its code was written with AI assistance
(Claude Code, Anthropic) under the author's design, review and testing.
Contributions are welcome: see CONTRIBUTING.md.
Metadata
Release files for tenqsp 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tenqsp-0.8.1.tar.gz | 765.1 kB | With provenance | Details for tenqsp-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tenqsp-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for tenqsp-0.8.1-py3-none-any.whl |
Total release size: 1.1 MB
Release files / tenqsp-0.8.1.tar.gz
| Download URL | tenqsp-0.8.1.tar.gz |
|---|---|
| Size | 765.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b84758cbec00bf309997824eca4773855ce20ee5e3c818d802e19ea1595fa9d1
|
|
BLAKE2b-256 checksum How to use checksums |
40d0a46a2f5dba34a1f4d3a3a3b37b71c55f9516dec1a2e146d0434831526147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logRelease files / tenqsp-0.8.1-py3-none-any.whl
| Download URL | tenqsp-0.8.1-py3-none-any.whl |
|---|---|
| Size | 303.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
105c5026ac0f7ec4a5dd898e4c127754b8193e7225b6659d52b0bda0d68a93b2
|
|
BLAKE2b-256 checksum How to use checksums |
b1db82496de0a6ca2febd988b673bee5d4f2547f59320148614d0cd2c1a23b3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logSecurity for tenqsp 0.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tenqsp-0.8.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.