Giter VIP home page Giter VIP logo

heyoka.py's Introduction

heyoka.py

Build Status Build Status

Anaconda-Server Badge PyPI


Logo

Modern Taylor's method via just-in-time compilation
Explore the docs »

Report bug · Request feature · Discuss

The heyókȟa [...] is a kind of sacred clown in the culture of the Sioux (Lakota and Dakota people) of the Great Plains of North America. The heyoka is a contrarian, jester, and satirist, who speaks, moves and reacts in an opposite fashion to the people around them.

heyoka.py is a Python library for the integration of ordinary differential equations (ODEs) via Taylor's method, based on automatic differentiation techniques and aggressive just-in-time compilation via LLVM. Notable features include:

  • support for single-precision, double-precision, extended-precision (80-bit and 128-bit), and arbitrary-precision floating-point types,
  • high-precision zero-cost dense output,
  • accurate and reliable event detection,
  • builtin support for analytical mechanics - bring your own Lagrangians/Hamiltonians and let heyoka.py formulate and solve the equations of motion,
  • builtin support for high-order variational equations - compute not only the solution, but also its partial derivatives,
  • builtin support for machine learning applications via neural network models,
  • the ability to maintain machine precision accuracy over tens of billions of timesteps,
  • batch mode integration to harness the power of modern SIMD instruction sets (including AVX/AVX2/AVX-512/Neon/VSX),
  • ensemble simulations and automatic parallelisation,
  • interoperability with SymPy.

heyoka.py is based on the heyoka C++ library.

If you are using heyoka.py as part of your research, teaching, or other activities, we would be grateful if you could star the repository and/or cite our work. For citation purposes, you can use the following BibTex entry, which refers to the heyoka.py paper (arXiv preprint):

@article{10.1093/mnras/stab1032,
    author = {Biscani, Francesco and Izzo, Dario},
    title = "{Revisiting high-order Taylor methods for astrodynamics and celestial mechanics}",
    journal = {Monthly Notices of the Royal Astronomical Society},
    volume = {504},
    number = {2},
    pages = {2614-2628},
    year = {2021},
    month = {04},
    issn = {0035-8711},
    doi = {10.1093/mnras/stab1032},
    url = {https://doi.org/10.1093/mnras/stab1032},
    eprint = {https://academic.oup.com/mnras/article-pdf/504/2/2614/37750349/stab1032.pdf}
}

heyoka.py's novel event detection system is described in the following paper (arXiv preprint):

@article{10.1093/mnras/stac1092,
    author = {Biscani, Francesco and Izzo, Dario},
    title = "{Reliable event detection for Taylor methods in astrodynamics}",
    journal = {Monthly Notices of the Royal Astronomical Society},
    volume = {513},
    number = {4},
    pages = {4833-4844},
    year = {2022},
    month = {04},
    issn = {0035-8711},
    doi = {10.1093/mnras/stac1092},
    url = {https://doi.org/10.1093/mnras/stac1092},
    eprint = {https://academic.oup.com/mnras/article-pdf/513/4/4833/43796551/stac1092.pdf}
}

Installation

Via pip:

$ pip install heyoka

Via conda + conda-forge:

$ conda install heyoka.py

Documentation

The full documentation can be found here.

Authors

  • Francesco Biscani (European Space Agency)
  • Dario Izzo (European Space Agency)

License

heyoka.py is released under the MPL-2.0 license.

heyoka.py's People

Contributors

bluescarni avatar darioizzo avatar sceki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

heyoka.py's Issues

[BUG] 0.21.8 fails to build with heyoka-1.0.0

/wrkdirs/usr/ports/math/py-heyoka/work-py39/heyoka.py-0.21.8/heyoka/core.cpp:49:10: fatal error: 'heyoka/celmec/vsop2013.hpp' file not found
#include <heyoka/celmec/vsop2013.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

[BUG]

Describe the bug
No Taylor coefficients with ensemble_propagate_until

Hi there, awesome program!
I just stumbled upon an issue. Below is a somewhat minimal example:

To Reproduce

import heyoka as hy

qp = hy.make_vars(*[f"coord_q0", f"coord_p0"])
q, p = qp

hameqs = [(q, p),
          (p, 2.3 * q**2)]

integrator = hy.taylor_adaptive(hameqs, [0]*2)

q0, p0 = 0.03, -0.05
qp0 = np.array([[q0], [p0]])

def gen(tacp, i):
    tacp.state[:] = qp0[:, i]
    return tacp

results = hy.ensemble_propagate_for(integrator, delta_t=1, n_iter=1, gen=gen, write_tc=True)

Then I try (in various orders, e.g.):

integrator.update_d_output(t=0.4)
integrator.tc 

Expected behavior
I was expecting that
integrator.tc
has some non-zero Taylor coefficients for the map around zero, transporting the initial coordinates from t=0 to t=0.4. However, I only see zeros. Perhaps I did something wrong? Same problem with ensemble_propagate_until.

Environment

  • Linux
  • Heyoka version: 0.18.0

[BUG] Failed build with numpy-1.25.0

Describe the bug
I failed build heyoka.py with numpy-1.25.0 on FreeBSD-14, while it build well with numpy-1.24.1, the last lines of build log is :
[ 82% 16/17] /usr/local/libexec/ccache/c++ -DFMT_SHARED -DUSING_pybind11 -Dcore_EXPORTS -isystem /usr/local/include -isystem /usr/local/include/python3.9 -isystem /usr/local/lib/python3.9/site-packages/numpy/core/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -std=c++17 -flto=thin -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -ftemplate-depth=1024 -fdiagnostics-show-template-tree -MD -MT heyoka/CMakeFiles/core.dir/expose_expression.cpp.o -MF heyoka/CMakeFiles/core.dir/expose_expression.cpp.o.d -o heyoka/CMakeFiles/core.dir/expose_expression.cpp.o -c /wrkdirs/usr/ports/math/py-heyoka/work-py39/heyoka.py-0.21.7/heyoka/expose_expression.cpp
[ 88% 16/17] /usr/local/libexec/ccache/c++ -DFMT_SHARED -DUSING_pybind11 -Dcore_EXPORTS -isystem /usr/local/include -isystem /usr/local/include/python3.9 -isystem /usr/local/lib/python3.9/site-packages/numpy/core/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -std=c++17 -flto=thin -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -ftemplate-depth=1024 -fdiagnostics-show-template-tree -MD -MT heyoka/CMakeFiles/core.dir/expose_batch_integrators.cpp.o -MF heyoka/CMakeFiles/core.dir/expose_batch_integrators.cpp.o.d -o heyoka/CMakeFiles/core.dir/expose_batch_integrators.cpp.o -c /wrkdirs/usr/ports/math/py-heyoka/work-py39/heyoka.py-0.21.7/heyoka/expose_batch_integrators.cpp
[ 94% 16/17] /usr/local/libexec/ccache/c++ -DFMT_SHARED -DUSING_pybind11 -Dcore_EXPORTS -isystem /usr/local/include -isystem /usr/local/include/python3.9 -isystem /usr/local/lib/python3.9/site-packages/numpy/core/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -std=c++17 -flto=thin -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -ftemplate-depth=1024 -fdiagnostics-show-template-tree -MD -MT heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o -MF heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o.d -o heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o -c /wrkdirs/usr/ports/math/py-heyoka/work-py39/heyoka.py-0.21.7/heyoka/numpy_memory.cpp
FAILED: heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o
/usr/local/libexec/ccache/c++ -DFMT_SHARED -DUSING_pybind11 -Dcore_EXPORTS -isystem /usr/local/include -isystem /usr/local/include/python3.9 -isystem /usr/local/lib/python3.9/site-packages/numpy/core/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -std=c++17 -flto=thin -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -ftemplate-depth=1024 -fdiagnostics-show-template-tree -MD -MT heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o -MF heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o.d -o heyoka/CMakeFiles/core.dir/numpy_memory.cpp.o -c /wrkdirs/usr/ports/math/py-heyoka/work-py39/heyoka.py-0.21.7/heyoka/numpy_memory.cpp
/wrkdirs/usr/ports/math/py-heyoka/work-py39/heyoka.py-0.21.7/heyoka/numpy_memory.cpp:505:17: error: use of undeclared identifier 'PyDataMem_SetHandler'; did you mean 'PyDataMem_Handler'?
auto *old = PyDataMem_SetHandler(new_mem_handler);
^
/usr/local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:663:3: note: 'PyDataMem_Handler' declared here
} PyDataMem_Handler;
^
1 error generated.

Any suggestions ?

Issue on page /install.html

The installation from source procedure doesn't play well with pip:
Heyoka cannot be named as a dependency for another python project as pip isn't aware that it is installed.

[BUG] Failed import after conda install

Describe the bug
I can install heyoka.py through conda, but after that I am unable to import it: ModuleNotFoundError: No module named 'heyoka'.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new environment. Install numpy and cloudpicke.
  2. conda install heyoka or conda install heyoka -c conda-forge or exactly the method you describe to force the conda-forge to be used with strict.
  3. Try to import heyoka. The following ensues (example where I did conda install heyoka -c conda-forge, but all install methods end up the same):
(envtest3) C:\>conda install heyoka -c conda-forge
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\MYUSERNAME\Miniconda3\envs\envtest3

  added / updated specs:
    - heyoka


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    boost-cpp-1.78.0           |       h9f4b32c_1        17.1 MB  conda-forge
    ca-certificates-2022.9.24  |       h5b45459_0         189 KB  conda-forge
    certifi-2022.9.24          |     pyhd8ed1ab_0         155 KB  conda-forge
    fmt-8.1.1                  |       h5362a0b_0         179 KB  conda-forge
    heyoka-0.19.0              |       hb4083ac_0        57.6 MB  conda-forge
    libzlib-1.2.12             |       hcfcfb64_3          71 KB  conda-forge
    openssl-1.1.1q             |       h8ffe710_0         5.8 MB  conda-forge
    sleef-3.5.1                |       hcc89e0a_2        1008 KB  conda-forge
    spdlog-1.10.0              |       h2d74725_0         318 KB  conda-forge
    tbb-2021.6.0               |       h91493d7_0         174 KB  conda-forge
    ucrt-10.0.20348.0          |       h57928b3_0         1.2 MB  conda-forge
    vs2015_runtime-14.29.30139 |       h890b9b1_7         1.3 MB  conda-forge
    zstd-1.5.2                 |       h7755175_4         401 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        85.4 MB

The following NEW packages will be INSTALLED:

  boost-cpp          conda-forge/win-64::boost-cpp-1.78.0-h9f4b32c_1 None
  fmt                conda-forge/win-64::fmt-8.1.1-h5362a0b_0 None
  heyoka             conda-forge/win-64::heyoka-0.19.0-hb4083ac_0 None
  libzlib            conda-forge/win-64::libzlib-1.2.12-hcfcfb64_3 None
  sleef              conda-forge/win-64::sleef-3.5.1-hcc89e0a_2 None
  spdlog             conda-forge/win-64::spdlog-1.10.0-h2d74725_0 None
  tbb                conda-forge/win-64::tbb-2021.6.0-h91493d7_0 None
  ucrt               conda-forge/win-64::ucrt-10.0.20348.0-h57928b3_0 None
  zstd               conda-forge/win-64::zstd-1.5.2-h7755175_4 None

The following packages will be UPDATED:

  ca-certificates    pkgs/main::ca-certificates-2022.07.19~ --> conda-forge::ca-certificates-2022.9.24-h5b45459_0 None
  certifi            pkgs/main/win-64::certifi-2022.9.14-p~ --> conda-forge/noarch::certifi-2022.9.24-pyhd8ed1ab_0 None
  vs2015_runtime     pkgs/main::vs2015_runtime-14.27.29016~ --> conda-forge::vs2015_runtime-14.29.30139-h890b9b1_7 None

The following packages will be SUPERSEDED by a higher-priority channel:

  openssl              pkgs/main::openssl-1.1.1q-h2bbff1b_0 --> conda-forge::openssl-1.1.1q-h8ffe710_0 None


Proceed ([y]/n)? y


Downloading and Extracting Packages
libzlib-1.2.12       | 71 KB     | ############################################################################ | 100%
ucrt-10.0.20348.0    | 1.2 MB    | ############################################################################ | 100%
ca-certificates-2022 | 189 KB    | ############################################################################ | 100%
heyoka-0.19.0        | 57.6 MB   | ############################################################################ | 100%
sleef-3.5.1          | 1008 KB   | ############################################################################ | 100%
tbb-2021.6.0         | 174 KB    | ############################################################################ | 100%
fmt-8.1.1            | 179 KB    | ############################################################################ | 100%
zstd-1.5.2           | 401 KB    | ############################################################################ | 100%
spdlog-1.10.0        | 318 KB    | ############################################################################ | 100%
boost-cpp-1.78.0     | 17.1 MB   | ############################################################################ | 100%
openssl-1.1.1q       | 5.8 MB    | ############################################################################ | 100%
certifi-2022.9.24    | 155 KB    | ############################################################################ | 100%
vs2015_runtime-14.29 | 1.3 MB    | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Retrieving notices: ...working... done

(envtest3) C:\>python
Python 3.10.4 | packaged by conda-forge | (main, Mar 30 2022, 08:38:02) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import heyoka
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'heyoka' 

Expected behavior
It should import the package without failing.

Environment:

  • OS: Windows 10
  • Installation method: conda
  • Version: 0.19.0

Additional context

  1. I wanted to benchmark heyoka against the older packages taylor by Jorba and Zou (which got updated to v2.0 very recently), and TIDES from Abad et al, which both work for me.

  2. I am not sure if I understood correctly, but I have not installed the C++ libraries separately, since I believe everything is taken care of by conda, and we can see that it indeed pulls boost-cpp, tbb, fmt. But was it a correct assumption, that I do not have to have anything preinstalled prior to doing conda install ?

  3. I tried deleted and recreating the environment, deactivating it and reactivating it, updating conda, nothing worked.
    I tried many other random packages in this environment, before and after installing heyoka, and they got installed and imported fine, so this is the only package that does this for me, and the first time I encounter this behavior for a package too.

  4. One thing I noticed is that in C:\Users\MYUSERNAME\Miniconda3\envs\envtest3\Lib\site-packages there are no packages related to the supposed install of heyoka: no heyoka, boost, tbb, fmt, that supposedly got downloaded and installed from the logs as seen above. Whereas when I install random other packages they always end up there.
    I find instances of heyoka in C:\Users\MYUSERNAME\Miniconda3\pkgs though: the folder heyoka-0.19.0-hb4083ac_0 is there. tbb, fmt, and boost-cpp have the same 'problem' (boost-cpp does show up as boost-cpp-1.78.0-h9f4b32c_1.json in C:\Users\MYUSERNAME\Miniconda3\envs\envtest3\conda-meta if that helps).
    I tried importing heyoka it in the base environment just in case, but it doesn't work either (conda list doesn't show heyoka in base anyway as expected, whereas it appears in my envtest3 even though I cannot import it).
    So maybe it is an install path problem ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.