Skip to main content

TenQSP

CI PyPI License: Apache-2.0 DOI

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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tenqsp 0.8.3
File Size Uploaded Provenance Actions
tenqsp-0.8.3.tar.gz 770.8 kB With provenance Details for tenqsp-0.8.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tenqsp 0.8.3
File Interpreter ABI Platform Actions
tenqsp-0.8.3-py3-none-any.whl Python 3 none any Details for tenqsp-0.8.3-py3-none-any.whl

Total release size: 1.1 MB

Release files / tenqsp-0.8.3.tar.gz

Download URL tenqsp-0.8.3.tar.gz
Size 770.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1d896756f2efdd20b60e80ac0cfece814a2186a809fc2f2219244f0241ea07af
BLAKE2b-256 checksum
How to use checksums
225c17816231a99db8149b2cd944b677d0ac90a56fe3aa559c4955b3b70afb0f
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 15, 2026.

Transparency log

Release files / tenqsp-0.8.3-py3-none-any.whl

Download URL tenqsp-0.8.3-py3-none-any.whl
Size 305.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a92cdbdd1b22995fdb658433be7bbbf4d435f7a4b4dbf6c7ba8d54421d8e22b
BLAKE2b-256 checksum
How to use checksums
84374c2518dd8be765c2e3bdf7309049977d5606fa53a840c75982a1992558d3
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 15, 2026.

Transparency log

Security for tenqsp 0.8.3

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.

Select from 2 files

Attestation for tenqsp-0.8.3.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 15, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page