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

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.6.1
File Size Uploaded Provenance Actions
tenqsp-0.6.1.tar.gz 686.7 kB With provenance Details for tenqsp-0.6.1.tar.gz

Built distribution (wheel)

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

Total release size: 957.7 kB

Release files / tenqsp-0.6.1.tar.gz

Download URL tenqsp-0.6.1.tar.gz
Size 686.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7d577b43696117b096e06cfc8d89ea2eeb9fbe9b03f44bd3b2923977bf6d76b1
BLAKE2b-256 checksum
How to use checksums
4c973a4874d2c767786e616f0f544826b0720d9715976c01f632affcb4a1fc5e
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 Oct 30, 2026.

Transparency log

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

Download URL tenqsp-0.6.1-py3-none-any.whl
Size 271.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3d94c1299e15ac2140a731b4effaa0c8333a21018d4618aa566843914dbc89a
BLAKE2b-256 checksum
How to use checksums
14f9fb8be02ea81a928bce35dc3e9cc19d4bbe7028ac6a27d7034b3052dc2372
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 Oct 30, 2026.

Transparency log

Security for tenqsp 0.6.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.

Select from 2 files

Attestation for tenqsp-0.6.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 Oct 30, 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