Skip to main content

Python interface to goss - General ODE System Solver

Project description

CI-cpp CI-fenics github pages PyPI version coverage

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygoss-0.4.2.tar.gz (14.2 MB view details)

Uploaded Source

Built Distributions

pygoss-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (378.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pygoss-0.4.2-cp311-cp311-macosx_11_0_arm64.whl (242.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pygoss-0.4.2-cp311-cp311-macosx_10_9_x86_64.whl (535.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pygoss-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (378.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pygoss-0.4.2-cp310-cp310-macosx_11_0_arm64.whl (242.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pygoss-0.4.2-cp310-cp310-macosx_10_9_x86_64.whl (535.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pygoss-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (379.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pygoss-0.4.2-cp39-cp39-macosx_11_0_arm64.whl (242.8 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pygoss-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl (535.8 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pygoss-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (379.1 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pygoss-0.4.2-cp38-cp38-macosx_11_0_arm64.whl (242.5 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pygoss-0.4.2-cp38-cp38-macosx_10_9_x86_64.whl (535.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pygoss-0.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (383.8 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pygoss-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl (530.8 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file pygoss-0.4.2.tar.gz.

File metadata

  • Download URL: pygoss-0.4.2.tar.gz
  • Upload date:
  • Size: 14.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for pygoss-0.4.2.tar.gz
Algorithm Hash digest
SHA256 128fac03baf2ffd85728b89c49f8f2e68f5bade86a591550c471290e861c001a
MD5 10c646389d697b17217e1f2026df806f
BLAKE2b-256 d37ace40def87b6934ce78e5cd566868d1da6bdab50b03fdc679eaf192f96f40

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d1fee407babb5e94bf29f427227668d6014b8de8e4e7b363453da9ad7371779
MD5 6feaa904f4670f29917ffd50ca8a412d
BLAKE2b-256 08f79a821e62d8788f03e8f87a72c83ef84543ae75d76d5e6f204d9eb415dd69

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7ce7817cbff2a2d9ddba5080de709054c74eb289300c060c6b83d11051375e3
MD5 0ce6f9adcd95552810fd8dda0119798e
BLAKE2b-256 3db074edf514516ae3ab354090ffb3969f74fa57ebe5f3bf6178f05725613cb2

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 30e0025c3a18aeb35671a901ff31269606cd3124c66edcf3a3e3a2c87895f07a
MD5 eead0bb5fbc8f679c4f9d05169c16b71
BLAKE2b-256 d6fee1b0575dca2b0f6a75b131a87b70dfe6b65fa89a4bc2f4775d24f51ceda6

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f8f40aed3a6dee1e967b2aa2098ee9c455da0e8d6f5a71c2f6f19719f170950d
MD5 df64eea2cf875d4d835773f9f7f6aac2
BLAKE2b-256 473c5dd5e72064c9045b10efaa71e92bb441748c445dd92af268532ca64fe2b7

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f93941107968329db3ee702625d94a1846fb4cbc1bb2daf84660337f0b661b9
MD5 63a6d02a082304b69f2d2c93099aeb52
BLAKE2b-256 0c3fdcda4c376dffddd7f75f04ea229d1b12e50cf46aa1862b602dafce256844

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 de1482abc9bb4957b8b9ce94b3267c05783b19dbbb15a7a291364ebf9627c1c9
MD5 237ae97f61fd8331f06edc9c08d815c1
BLAKE2b-256 bf09619f192d0c81db932f86967a5c7d812d5a222a9a14b7eeffaa25b3effd49

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50e110ca5c459feaa522abd54d4f796ae0a63f4c919ab13da44cd58d6f5c0596
MD5 b545d7a9c582dd5032c2909719ac90bc
BLAKE2b-256 f914e6a326d7a82a26f5e82e9a81f3445fe8cb83fa098f60dac2a9e8be703608

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ff00fe598ece060c93f64d7d5d76794322a9fb196dbca29b8a5694cca1b1f9c
MD5 33dd5462f3064b19cd54f632da556425
BLAKE2b-256 5ed6a60afe65a5e6805193cfcbbfc60f4e303e1901a6bed382ad3491f97347a6

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e83f08a80dc99729b58b7a961994ed6d3c930845df72e3cfb105c28c1e17d223
MD5 bdb89d2f40671c12bce249b3263b1e70
BLAKE2b-256 24280ecb600ed0b46b8a9e259a62597ebc59d262b33f80f4eff6c0ba122b8f84

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eabc65f756655165b06dc0cab12f601eb1371b310e6f9ad0a95d5fec1bea6bff
MD5 1176dc6cc27d566b5b8b711c17003816
BLAKE2b-256 36ba1de85f0476b1a672bc31d47a1be55af79364896797c9e05a3088abe85587

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ddca336f87e976a352eb3257112124e38b9f8faa45a9388e02e8654b6d5bc99
MD5 3cc8dd6ecd6992fef5575445dade64fa
BLAKE2b-256 0870c8225fd073e0f35223f8346347c0fc1361f32bc761db956d0fac967f6f16

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 18e91837571797342c7ad8dda16bd50d03dbfb0306878b92c51e3a7465990a85
MD5 3eee402bdbc4aac410a20f6ce6d4acb7
BLAKE2b-256 ac2caa55ae49baf42189d422b6a58752854041cd6e375a824315fc24e7264b3d

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c6a7ce5dd7bcfce8c7de1db2611fa2a0d43caa226700e068c1db753ddffc8f4
MD5 a306d88819457966d4940e002f9bae35
BLAKE2b-256 7ed1b6edad53a6da5bd16890018b1a8cb0591e0806c56f6e832301a74e7fb6d9

See more details on using hashes here.

File details

Details for the file pygoss-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygoss-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2fbdbff3043b5f317abfdb86536bfcdf64699472b378bf173d875d60f2834e9d
MD5 0da82be6f5f1fa487420fe412cb03fd6
BLAKE2b-256 5f7b8c6a2becae7da6e1d5d0eaaa2cf7066f302ebdee2df5574f940642317146

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page