Python interface to goss - General ODE System Solver
Project description
goss
- General ODE System Solver
goss
is python wrapper around a C++ library for solving ordinary differential equations with a variety of different schemes.
Documentation is hosted at https://computationalphysiology.github.io/goss Source code is found at https://github.com/ComputationalPhysiology/goss
Motivation
The general idea is that you define your ODE in a gotran ode file
and hand the ode over to goss
.
First define the ode in a gotran ODE file
# lorentz.ode
parameters(
sigma=10.0,
rho=28.0,
beta=8/3
)
# The values of the states represent the initial conditions
states(
x=0.0,
y=1.0,
z=1.05
)
dx_dt = sigma * (y - x)
dy_dt = x * (rho - z) - y
dz_dt = x * y - beta * z
You can now solve the ode as follows
import numpy as np
import matplotlib.pyplot as plt
from gotran import load_ode
import goss
# Import the ode in gotran
lorentz = load_ode("lorentz.ode")
# Jit compile the code for the right hand side
ode = goss.ParameterizedODE(lorentz)
# Select a solver and instantiate the solver
solver = goss.solvers.RKF32(ode)
# Select the time steps you want to solve for
t = np.linspace(0, 100, 10001)
# Solve the system
u = solver.solve(t)
# Plot the solution
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.plot(u[:, 0], u[:, 1], u[:, 2], lw=0.5)
ax.set_xlabel("X Axis")
ax.set_ylabel("Y Axis")
ax.set_zlabel("Z Axis")
ax.set_title("Lorenz Attractor")
plt.show()
For more examples, check out the demo folder
There is also a command line interface that can be used to list the available solvers, run the solver and generate the goss code
Install
You can install goss with pip
python -m pip install pygoss
See installation instructions for more options
Known issues
- There is currently an issue on Apple Silicon with exceptions raised from by the jit compiled code which means the one test is not passing. An issue has been filed for this here
Contributing
Contributions are very welcomed. To contribute please fork the repo, create a branch a submit a pull request. Before the pull request can be accepted it has to pass the test suit for the python and C++ code. Also note that we try to enforce an consistent coding style. To ensure that you follow the coding style you can install the pre-commit hook in the repo
python -m pip install pre-commit
pre-commit install
For every future commit, you will now run a set of tests that will make sure that you follow the coding style.
See the contributing section for more info.
License
goss
is licensed under the GNU LGPL, version 3 or (at your option) any later version.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pygoss-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8c6b47a39cf94ac0f95f75ea47110eb57dda0539f3c50c9b61a85b0520454dd |
|
MD5 | 2460e0d5bd8989dae244dff3a56111f5 |
|
BLAKE2b-256 | 6373f1af51b75bc3b8461e8cc5f96087156dbb4f3b089d4b31702d580717b8f9 |
Hashes for pygoss-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca8bfc2401c419943f28ad347c8738490bc7c2820f6238ed63e904fd72f2a1a |
|
MD5 | ad771f0b19ee15748e9c6d5dce7c799c |
|
BLAKE2b-256 | ec2d1609284f3bd9b86072f9898522fb93a48bdf04f68f5dec9cd9c5ce7fb7df |
Hashes for pygoss-0.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60dc48761a69fdb7cece1bfcc49893412bf7569c5693af42ad160311a8de7082 |
|
MD5 | 10be134cb4e6e55840ad7838be406c39 |
|
BLAKE2b-256 | 463fdef0728e2adac7ad863dc89669141d780f81e2ceb742be52f1462f14642d |
Hashes for pygoss-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 976de2c915d108ac59b234ffe4e9e746b4486b18210bee8f551538d370737128 |
|
MD5 | 094ba1c6defc647ace9772bd6c288df0 |
|
BLAKE2b-256 | a3a08b9113363ea6d14a7ee1cb0fa04423738753edf5891a13bb481f56b38248 |
Hashes for pygoss-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee2c32af8c105ba9f272cf917f7a4eed89d33e75eb62ae5bc0af381693e009ef |
|
MD5 | 2b6028737b0ca3037793a40ba150a204 |
|
BLAKE2b-256 | 48f6b250636ce8563f95510f43d562d774bdfb1f40a40bcf31635d0b6b4cb56d |
Hashes for pygoss-0.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d12dccc82d0454523627b8cf4bc291777b5fce70598ae180692d791d20b72f05 |
|
MD5 | f2b9ee39400ab88bd58c5f757640ae20 |
|
BLAKE2b-256 | d2eb396670d973d73ebd774b89402a00f991ecc358989ed938af23033a420e90 |
Hashes for pygoss-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7abf0e73e645588ab95995d1e037adfe89bd370380a1a109311c272e892d115e |
|
MD5 | 4fdee5e683f1f42454378d5872f4e061 |
|
BLAKE2b-256 | 2e6eec2412bebca8d63e05f396242a446afd69892a2d3a44201eaf7be7959991 |
Hashes for pygoss-0.4.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a3cfcd0933f9018dd11800ca38319b216976b761ce6a01b599ef6da6fdf32b |
|
MD5 | 656d91545a777a90592afbb8566b34f5 |
|
BLAKE2b-256 | 914bc2cba4372fb98debcdd68a3f2d8df1d2682cfb35e841271abdb56bb03ca9 |
Hashes for pygoss-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97a2e74dced2039a78fc6160aa7c432787a52453b319f0837e78149ceb78ece4 |
|
MD5 | 8c0f9feac5f893835baff5a4be7ad2c5 |
|
BLAKE2b-256 | 2e58616fb8607e3db785c508fe5433ebed21fd98a7dd83d74b00d9bc860ea1e6 |
Hashes for pygoss-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a3f6997abe64c8f180588ba8cb1b5003dca35ab53693130430c23b6d212df95 |
|
MD5 | e7216bbea996dfc3bf75a5b7ed3df2a7 |
|
BLAKE2b-256 | 61a6be425626761ef4e611fb57aa6dd5947ff437ba552cab5ebdeaa25f330c60 |
Hashes for pygoss-0.4.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bae5e80ea9180802b11d1d826274d2272b46779d0aec7fb6a19ab2fc5565557 |
|
MD5 | 0240d3aca3e129bd5d084df521bd12f9 |
|
BLAKE2b-256 | c739250340ece55e4fe1db172b89e05110ef0398dcd79d9127d68a94f339ab9b |
Hashes for pygoss-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b527e54d77a7a983a31b8ca831e5dea38a04e604b7a16a9dde5af88c0aea1406 |
|
MD5 | 472b847bde062a5fa40fce50445a151b |
|
BLAKE2b-256 | 3c3fa4bc61761f2bea874842f3faef16ba7bcc94f0117d37d69addb2551e513b |
Hashes for pygoss-0.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbc2b27da08bb2530a5d3d592731d7acadbc6c7c11e73a9c3be8a8d2ae36ada6 |
|
MD5 | 6ac023a86c61857642939450d857d2e3 |
|
BLAKE2b-256 | 8cadecae4f8fd2fed953650c069ca7af1490a5ab19869b24b8609fc54e1ad1a6 |
Hashes for pygoss-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d22918c9dbdd94165973049675d7b185c30aafd037b8b9d522a2bd0201ea10f4 |
|
MD5 | 94454578ff8f89633123ad75143fefe4 |
|
BLAKE2b-256 | 56482cca1e42312d044bd2524e291cd7eac63717d069aac037da6aede1e9ca2e |