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.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.9.1
File Size Uploaded Provenance Actions
tenqsp-0.9.1.tar.gz 811.2 kB With provenance Details for tenqsp-0.9.1.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / tenqsp-0.9.1.tar.gz

Download URL tenqsp-0.9.1.tar.gz
Size 811.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e168fe12360fdb7390bc1ac70e61ce7c39f1de279c000cef049fcca9d15449f
BLAKE2b-256 checksum
How to use checksums
64d4e30a1272de3b65b976082fae1212f9662f110b644923545949f4f74c26a0
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.1-py3-none-any.whl

Download URL tenqsp-0.9.1-py3-none-any.whl
Size 337.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
048a4724772a89be8f8efea83a6b2e87f42bace2177539139d923bf93ca79866
BLAKE2b-256 checksum
How to use checksums
9ed85dad89d91d79dc4827df6372d82ded9ccf4b148c447795fad9c905a28a2f
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.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.9.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 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