Skip to main content

PhysioModeler

PhysioModeler is an educational tool for modelling and simulating physiological systems described by ordinary differential equations (ODEs). It is built for physiological models, but works for a wide range of ODE models.

The interface aims to be explicit and easy to read. You describe a model by its state components, the functions that say how the state changes, and its parameters and inputs. PhysioModeler solves it with SciPy and returns the result as a pandas DataFrame.

Installation

pip install physiomodeler

PhysioModeler requires Python 3.12 or newer.

Example: an undamped pendulum

A pendulum is described by its angle theta and angular velocity dtheta. The dynamics function receives the current state and returns how each state component changes.

import math

from physiomodeler import Model


def pendulum(time, state, inputs, parameters):
    g = inputs["g"]
    l = parameters["l"]
    return {
        "dtheta": state["dtheta"],
        "ddtheta": -g / l * math.sin(state["theta"]),
    }


model = Model(
    dynamics=pendulum,
    state_components=["theta", "dtheta"],
    parameters={"l": 1},     # length of the pendulum (m)
    inputs={"g": 9.81},      # gravity (m/s²)
)

result = model.run_simulation(time=10, initial_state={"theta": 1, "dtheta": 0})
result.plot(subplots=True)

Parameters and inputs are part of the model, so comparing scenarios only takes a change in the arguments, for example the same pendulum on the Moon:

moon = model.run_simulation(
    time=10,
    initial_state={"theta": 1, "dtheta": 0},
    inputs={"g": 1.625},
)

Features

  • Combine several dynamics functions, or nest models within other models.
  • Inputs that are constant or change over time.
  • Events, for example to detect when a state crosses a value or to stop a simulation.
  • Post-analysis functions that add calculated values to the result.
  • Run many simulations at once, or run a model until it reaches equilibrium.

Documentation

The full documentation, with more examples, is at https://psomhorst.github.io/physiomodeler/.

See the changelog for what changed between versions.

License

PhysioModeler is released under the MIT License.

Metadata

Release files for physiomodeler 1.1.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 physiomodeler 1.1.3
File Size Uploaded Provenance Actions
physiomodeler-1.1.3.tar.gz 155.9 kB Without provenance Details for physiomodeler-1.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 185.4 kB

Release files / physiomodeler-1.1.3.tar.gz

Download URL physiomodeler-1.1.3.tar.gz
Size 155.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6371af3aa5b0514818584babb6dd2fe358f968388403d2e15ae3772c43509700
BLAKE2b-256 checksum
How to use checksums
be451da26e0ab1c828ed65ef690f6b361e99b078288b14f9c938d68ad512b263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / physiomodeler-1.1.3-py3-none-any.whl

Download URL physiomodeler-1.1.3-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
956ff31483bb95b4f071d703488d3d693a5866ea598e1b9df8b124bd601656ef
BLAKE2b-256 checksum
How to use checksums
ca4090c6ca665b58234d142d05d3c371b802e5180fec21cb51feb725414899bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for physiomodeler 1.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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