Skip to main content

pyrtmpbc

Python interface for RT-MPBC: Real-Time Multi-Physics Bond-Graph Compiler & Symplectic Solver

pyrtmpbc brings sub-50 nanosecond Port-Hamiltonian simulation and energy-preserving geometric integration to Python.

Installation

pip install pyrtmpbc

Or from source:

git clone https://github.com/shahmdmahi15/rt-mpbc.git
cd rt-mpbc/bindings/python
pip install .

Quickstart

import numpy as np
from pyrtmpbc import SymplecticMidpointSolver

# Define an LC Tank / Mass-Spring Oscillator
# Hamiltonian H = 0.5 * q^2 / C + 0.5 * p^2 / L
n_states = 2
dt = 1e-4

# Skew-symmetric interconnection J = [0, -1; 1, 0]
J = np.array([[0.0, -1.0],
              [1.0,  0.0]])

# Resistive dissipation R = [0, 0; 0, 0.05] (small resistance)
R = np.array([[0.0, 0.0],
              [0.0, 0.05]])

# Energy matrix Q = diag(1/C, 1/L)
Q = np.diag([1.0, 1.0])

solver = SymplecticMidpointSolver(n_states=n_states, dt=dt, J=J, R=R, Q=Q)
solver.set_state([1.0, 0.0])

for _ in range(1000):
    solver.step()
    x = solver.get_state()
    h = solver.hamiltonian()
    print(f"Energy: {h:.10f} J")

Metadata

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

Built distribution (wheel)

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

Total release size: 7.4 kB

Release files / pyrtmpbc-1.1.0.tar.gz

Download URL pyrtmpbc-1.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d0a14db12b53cecc40a08f0ef500b7508e8d15e83dcd445fde4e3991f6a27be0
BLAKE2b-256 checksum
How to use checksums
0201f1f9a289d264520f56b8d7f7ec40cad5199c0b19282f9840948ea668eb8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / pyrtmpbc-1.1.0-py3-none-any.whl

Download URL pyrtmpbc-1.1.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10c3f542b10d887187c9210e5ae4168ab5ba1612adf5435722975f2901b599bc
BLAKE2b-256 checksum
How to use checksums
ff4147b534309481a2c3f2b3d7aaa0e07e63df600286b764f560b1a9c8402c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

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

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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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