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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a04f869573b6b9b7c2ab05f84fd43f14e3331d1475a8f744163c5c640d099d9 |
|
MD5 | de667786fe6b91aa6bd763276e384306 |
|
BLAKE2b-256 | 7dbc34b6026d881ca869203cb43418646a53f918514b87fd7be4d045908f7c58 |
Hashes for pygoss-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 316f07ea1ee3201a6de25d864ac1e46b57b4491edadc2a1449edc9dfbf671405 |
|
MD5 | b695b96dd9226e022f9b62ad69c3938c |
|
BLAKE2b-256 | c6047774ac02c827e472915948dad8530a1a3577bd8c678f7b994af3f6ac0f76 |
Hashes for pygoss-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31d6fd84ff338c7c10578fc1947d71ffc75194f11aa872e98c7c895d058daaa2 |
|
MD5 | 862a99d4a33c6aa6ede5df48b38ea101 |
|
BLAKE2b-256 | 4e5c9bfc3739664b3d96574be7cf28e2aaba17d7f70f6e3d2982529fc2987287 |
Hashes for pygoss-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0794066d9d420350b531ddf177be0e98a6139afebedde3bb99df87d98324ba2 |
|
MD5 | b2e02f133f795af7bbcbbb7286c489e9 |
|
BLAKE2b-256 | 655686e0c7ae2e27a02abe748be5832635380a0463ffff2e4b3ffc2f703d3e0c |
Hashes for pygoss-0.4.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c1925fea92744c7de478e01b4cce9cc02b6ae1b02c1aaa7580c9b0454f5c549 |
|
MD5 | 294a772e3f9c5128522298960f066ddc |
|
BLAKE2b-256 | 64a26ad7a68172edb1b4510fcffe6fd323ceb303b1cc4b6bb0ff5501f90873bc |
Hashes for pygoss-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f78431c77382e77145d74405e7b6bd701b9f5e6a2b7df1e3ff815d1782ca5ac |
|
MD5 | 6f3e41fcdce41eadcf2451f46a091f5f |
|
BLAKE2b-256 | 103b484090ada5f1b5707f4b1458e74d68dd9e3976463e534a254898a09533fc |
Hashes for pygoss-0.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea0cd17565a656b4eb9332e3b7945daa24e5f1a63d87da4742c66cdb0f4661de |
|
MD5 | 764744a4a1e6d0c5a2b2105f54282347 |
|
BLAKE2b-256 | 9b8c921ba46e08c14defc8aae51fa8814ff37fc35299bcfe6d7eac104fd501b8 |
Hashes for pygoss-0.4.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ba011e5562f8e9cd82e7a5025411bbf4a691c208a662e1bef7ccf9426f50d0e |
|
MD5 | 24b7139f08c6d8098e4e9902fce47d91 |
|
BLAKE2b-256 | 917f7bc20a59ceb0a2e90eee4b0b3fa47f46f1bbba8850f40cc800286b1ab649 |
Hashes for pygoss-0.4.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21b5302ab6a16f9f1c8b259e264bc8a87226137388e6a816d929e7be5b0e4ea7 |
|
MD5 | 6f6332b8973e8c6f9cf956d0ecd2a598 |
|
BLAKE2b-256 | 4608ef37a72e74932c44007f00e0b023aad98c62fe87fbf75424dd5a655dd9b9 |
Hashes for pygoss-0.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97f1cf46f9eac39e0ea453ae1b707fed63c55fdca8d9feb2e513b8157a25a369 |
|
MD5 | 30cef66d4c1d859edfded212df8de182 |
|
BLAKE2b-256 | 1cdbfc550c44a4588cda286060a6aaee35f88b39aa871f83627198d9040118ed |
Hashes for pygoss-0.4.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28974adc638ebffb74899e1dcf7a464dea6d4956005aebd019d6e115b9e090fd |
|
MD5 | 44e95ac2fb08dbac8f960d3c961b82b5 |
|
BLAKE2b-256 | 48bd9faa765f49b6d9840dcce50c3d84d0d3b4fd70cf657110d91721198b1ebb |
Hashes for pygoss-0.4.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9c8d8ad4a717bf53a55637d1dd280008dc6fa0d7e1f42cb1c8631e9c6070d63 |
|
MD5 | b865f8e0af294a3bf5f41c5fde229eb4 |
|
BLAKE2b-256 | 9f0fe80a68410bbde9af9772d778f38f99fda913867f6fcd4ffcd45f384d8fe1 |
Hashes for pygoss-0.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42380d9d4cea6cb68b9c8acd8a54a3797967cb2c462b5f1e5f3eaab283396dd5 |
|
MD5 | 904dbafe4b9034bab2dea33505514b1b |
|
BLAKE2b-256 | e9b4634319f7c4810cb7211a806f7776d3b71974581bc48a03510d099dbe00e4 |
Hashes for pygoss-0.4.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 317dc69a1d723f5e849df191fd3d41936e8f17e448fbae041ca2168c7a1db7b8 |
|
MD5 | aa12eb55af6f77c63c2d2c70af627303 |
|
BLAKE2b-256 | 13892a616de2f2af7d33b61c86881a995250413b8160bb2ec45c1e232a202d15 |