Skip to content

Commit

Permalink
Merge pull request #149 from bluescarni/pr/elp2000
Browse files Browse the repository at this point in the history
ELP2000
  • Loading branch information
bluescarni authored Nov 20, 2023
2 parents e890a1a + fd4c16c commit 908c33d
Show file tree
Hide file tree
Showing 25 changed files with 543 additions and 56 deletions.
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jobs:
conda_heyoka_head_38:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
Expand All @@ -14,6 +15,7 @@ jobs:
conda_heyoka_head_310:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
Expand All @@ -24,6 +26,7 @@ jobs:
conda_heyoka_head_312:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
Expand All @@ -32,6 +35,7 @@ jobs:
conda_heyoka_head_release_310:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
Expand All @@ -42,7 +46,7 @@ jobs:
ubuntu_arm64:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
resource_class: arm.large
steps:
- checkout
- run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh_actions_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
shell: pwsh
run: |
conda install -y python=3.10 git pybind11 numpy cmake 'llvmdev=14.*' tbb-devel tbb astroquery boost-cpp fmt spdlog sleef sympy cloudpickle zlib libzlib mppp numba
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(heyoka.py VERSION 3.1.0 LANGUAGES CXX C)
project(heyoka.py VERSION 3.2.0 LANGUAGES CXX C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")

Expand Down Expand Up @@ -118,7 +118,7 @@ find_package(fmt REQUIRED CONFIG)
message(STATUS "fmt version: ${fmt_VERSION}")

# heyoka.
find_package(heyoka 3.1.0 REQUIRED CONFIG)
find_package(heyoka 3.2.0 REQUIRED CONFIG)

# Python.

Expand Down
16 changes: 16 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
Changelog
=========

3.2.0 (unreleased)
------------------

New
~~~

- Add model implementing the ELP2000 analytical lunar theory
(`#149 <https://github.com/bluescarni/heyoka.py/pull/149>`__).

Changes
~~~~~~~

- heyoka.py now requires version 3.2.0 of the
heyoka C++ library
(`#149 <https://github.com/bluescarni/heyoka.py/pull/149>`__).

3.1.0 (2023-11-13)
------------------

Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"The restricted three-body problem*",
"parallel_mode.ipynb",
"vsop2013.ipynb",
"elp2000.ipynb",
"compiled_functions.ipynb",
"Pseudo arc-length continuation*"
]
Expand Down
3 changes: 2 additions & 1 deletion doc/examples_astro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ Celestial mechanics and astrodynamics
notebooks/mercury_precession
notebooks/ttv
notebooks/vsop2013
notebooks/elp2000
notebooks/tides_spokes
notebooks/lagrangian_propagator
notebooks/lagrangian_propagator
2 changes: 1 addition & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Dependencies
heyoka.py has several Python and C++ dependencies. On the C++ side, heyoka.py depends on:

* the `heyoka C++ library <https://github.com/bluescarni/heyoka>`__,
version 3.1.x (**mandatory**),
version 3.2.x (**mandatory**),
* the `Boost <https://www.boost.org/>`__ C++ libraries (**mandatory**),
* the `{fmt} <https://fmt.dev/latest/index.html>`__ library (**mandatory**),
* the `TBB <https://github.com/oneapi-src/oneTBB>`__ library (**mandatory**),
Expand Down
299 changes: 299 additions & 0 deletions doc/notebooks/elp2000.ipynb

Large diffs are not rendered by default.

138 changes: 110 additions & 28 deletions doc/notebooks/vsop2013.ipynb

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions heyoka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ set(HEYOKA_PY_PYTHON_FILES
_test_memcache.py
_test_celmec.py
_test_sympy.py
_test_vsop2013.py
_test_elp2000.py
model/__init__.py
)

Expand Down
28 changes: 28 additions & 0 deletions heyoka/_test_elp2000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
#
# This file is part of the heyoka.py library.
#
# This Source Code Form is subject to the terms of the Mozilla
# Public License v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


import unittest as _ut


class elp2000_test_case(_ut.TestCase):
# Just a small basic test.
def test_basic(self):
from . import make_cfunc
from .model import elp2000_cartesian_e2000, elp2000_cartesian_fk5

sol = elp2000_cartesian_e2000(thresh=1e-5)[0]
cf = make_cfunc([sol])

date = 2469000.5
self.assertAlmostEqual(cf([], time=(date - 2451545.0) / 36525)[0], -361605.79234692274)

sol = elp2000_cartesian_fk5(thresh=1e-5)[0]
cf = make_cfunc([sol])

self.assertAlmostEqual(cf([], time=(date - 2451545.0) / 36525)[0], -361605.7668217605)
28 changes: 28 additions & 0 deletions heyoka/_test_vsop2013.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
#
# This file is part of the heyoka.py library.
#
# This Source Code Form is subject to the terms of the Mozilla
# Public License v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


import unittest as _ut


class vsop2013_test_case(_ut.TestCase):
# Just a small basic test.
def test_basic(self):
from . import make_cfunc
from .model import vsop2013_elliptic, vsop2013_cartesian

sol = vsop2013_elliptic(1, 1)
cf = make_cfunc([sol])

date = 2411545.0
self.assertAlmostEqual(cf([], time=(date - 2451545.0) / 365250)[0], 0.3870979635)

sol = vsop2013_cartesian(1, thresh=1e-8)
cf = make_cfunc([sol[0]])

self.assertAlmostEqual(cf([], time=(date - 2451545.0) / 365250)[0], 0.3493879042)
22 changes: 22 additions & 0 deletions heyoka/expose_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#endif

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/models.hpp>

#include "common_utils.hpp"
Expand Down Expand Up @@ -356,6 +357,27 @@ void expose_models(py::module_ &m)
"pl_idx"_a, "time"_a = hy::time, "thresh"_a.noconvert() = 1e-9);
m.def("_model_get_vsop2013_mus", &hy::model::get_vsop2013_mus);

// ELP2000.
m.def(
"_model_elp2000_spherical",
[](hy::expression t_expr, double thresh) {
return hy::model::elp2000_spherical(hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
},
"time"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
m.def(
"_model_elp2000_cartesian_e2000",
[](hy::expression t_expr, double thresh) {
return hy::model::elp2000_cartesian_e2000(hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
},
"time"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
m.def(
"_model_elp2000_cartesian_fk5",
[](hy::expression t_expr, double thresh) {
return hy::model::elp2000_cartesian_fk5(hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
},
"time"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
m.def("_model_get_elp2000_mus", &hy::model::get_elp2000_mus);

// CR3BP.
m.def(
"_model_cr3bp", [](const vex_t &mu) { return detail::cr3bp_impl(hy::model::cr3bp, mu); },
Expand Down
4 changes: 4 additions & 0 deletions heyoka/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,8 @@ def run_test_suite():
_test_memcache,
_test_celmec,
_test_sympy,
_test_vsop2013,
_test_elp2000,
)
import numpy as np
from .model import nbody
Expand All @@ -2596,6 +2598,8 @@ def run_test_suite():
suite.addTest(
tl.loadTestsFromTestCase(_test_batch_integrator.batch_integrator_test_case)
)
suite.addTest(tl.loadTestsFromTestCase(_test_vsop2013.vsop2013_test_case))
suite.addTest(tl.loadTestsFromTestCase(_test_elp2000.elp2000_test_case))
suite.addTest(tl.loadTestsFromTestCase(_test_dtens.dtens_test_case))
suite.addTest(tl.loadTestsFromTestCase(_test_mp.mp_test_case))
suite.addTest(tl.loadTestsFromTestCase(_test_model.model_test_case))
Expand Down
6 changes: 3 additions & 3 deletions tools/circleci_conda_heyoka_head_310.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ source activate $deps_dir
export HEYOKA_PY_PROJECT_DIR=`pwd`

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_WITH_MPPP=yes -DHEYOKA_WITH_SLEEF=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../../

Expand All @@ -35,7 +35,7 @@ mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_PY_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../tools

Expand Down
6 changes: 3 additions & 3 deletions tools/circleci_conda_heyoka_head_312.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ mamba create -y -q -p $deps_dir python=3.12 git pybind11 numpy mpmath cmake llvm
source activate $deps_dir

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_WITH_MPPP=yes -DHEYOKA_WITH_SLEEF=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../../

Expand All @@ -33,7 +33,7 @@ mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_PY_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../tools

Expand Down
6 changes: 3 additions & 3 deletions tools/circleci_conda_heyoka_head_38.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ source activate $deps_dir
export HEYOKA_PY_PROJECT_DIR=`pwd`

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_WITH_MPPP=yes -DHEYOKA_WITH_SLEEF=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../../

Expand All @@ -35,7 +35,7 @@ mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_PY_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../tools

Expand Down
6 changes: 3 additions & 3 deletions tools/circleci_conda_heyoka_head_release_310.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ source activate $deps_dir
export HEYOKA_PY_PROJECT_DIR=`pwd`

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DHEYOKA_WITH_MPPP=yes -DHEYOKA_WITH_SLEEF=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../../

Expand All @@ -35,7 +35,7 @@ mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DHEYOKA_PY_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../tools

Expand Down
6 changes: 3 additions & 3 deletions tools/circleci_ubuntu_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ mamba create -y -q -p $deps_dir cxx-compiler c-compiler cmake llvmdev tbb-devel
source activate $deps_dir

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build

# GCC build.
cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_WITH_SLEEF=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_MPPP=yes
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../../

Expand All @@ -34,7 +34,7 @@ mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=$deps_dir -DCMAKE_PREFIX_PATH=$deps_dir -DCMAKE_BUILD_TYPE=Debug -DHEYOKA_PY_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON
make -j2 VERBOSE=1 install
make -j4 VERBOSE=1 install

cd ../tools

Expand Down
2 changes: 1 addition & 1 deletion tools/gha_conda_asan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ source activate $deps_dir
export CXXFLAGS="$CXXFLAGS -fsanitize=address"

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build
Expand Down
2 changes: 1 addition & 1 deletion tools/gha_conda_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ conda create -y -q -p $deps_dir python=3.10 git pybind11 numpy mpmath cmake 'llv
source activate $deps_dir

# Checkout, build and install heyoka's HEAD.
git clone https://github.com/bluescarni/heyoka.git heyoka_cpp
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
cd heyoka_cpp
mkdir build
cd build
Expand Down
4 changes: 2 additions & 2 deletions tools/gha_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ echo "PYTHON_DIR: ${PYTHON_DIR}"
export NUMPY_VERSION="1.24.*"

# The heyoka version to be used for releases.
export HEYOKA_VERSION_RELEASE="3.1.0"
export HEYOKA_VERSION_RELEASE="3.2.0"

# Check if this is a release build.
if [[ "${GITHUB_REF}" == "refs/tags/v"* ]]; then
Expand All @@ -63,7 +63,7 @@ if [[ "${HEYOKA_PY_RELEASE_BUILD}" == "yes" ]]; then
tar xzf heyoka.tar.gz
cd heyoka-${HEYOKA_VERSION_RELEASE}
else
git clone https://github.com/bluescarni/heyoka.git
git clone --depth 1 https://github.com/bluescarni/heyoka.git
cd heyoka
fi

Expand Down
Loading

0 comments on commit 908c33d

Please sign in to comment.