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

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.9.0
File Size Uploaded Provenance Actions
tenqsp-0.9.0.tar.gz 810.2 kB With provenance Details for tenqsp-0.9.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / tenqsp-0.9.0.tar.gz

Download URL tenqsp-0.9.0.tar.gz
Size 810.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c6136584f7a511c8507c6db7db07dd9e68aa9ca3e5c0d964c192462ff50729db
BLAKE2b-256 checksum
How to use checksums
c30de9526dd28438bee026c921759603c44c82ea03924f5f0e98c55e91060cd5
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 22, 2026.

Transparency log

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

Download URL tenqsp-0.9.0-py3-none-any.whl
Size 336.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1720dbee97368cce704f1911a7deba81a1ed84ee3bf52bea2cb82c3764ee261a
BLAKE2b-256 checksum
How to use checksums
f7ab142352fb77397cf8e1c666f7be3be1e873467bd5e3f73c0cfb421972ad43
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 22, 2026.

Transparency log

Security for tenqsp 0.9.0

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.9.0.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 22, 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