From dc252412cd935584f606ff89faefda01d6f32376 Mon Sep 17 00:00:00 2001 From: Dario Izzo Date: Tue, 10 Dec 2024 18:49:18 +0100 Subject: [PATCH 1/4] refresh --- CMakeLists.txt | 13 ++--- cmake_modules/PykepFindBoost.cmake | 57 ------------------- .../yacma/YACMACompilerLinkerSettings.cmake | 25 ++++++-- cmake_modules/yacma/YACMAPythonSetup.cmake | 6 +- keplerian_toolbox-config.cmake.in | 1 - pykep/CMakeLists.txt | 11 +--- pykep/__init__.py | 2 +- pykep/trajopt/_launchers.py | 27 ++++----- tools/gha-osx-debug.sh | 11 ++-- tools/gha-ubuntu-debug.sh | 8 +-- tools/gha-windows-debug.ps1 | 2 +- 11 files changed, 58 insertions(+), 105 deletions(-) delete mode 100644 cmake_modules/PykepFindBoost.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f4cf2130..7b1f44f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ # Main pykep project version. -set(PYKEP_PROJECT_VERSION 2.6.2) +set(PYKEP_PROJECT_VERSION 2.6.3) # CMake version check. -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.18.0) # Module path setup. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules" "${CMAKE_SOURCE_DIR}/cmake_modules/yacma") @@ -155,14 +155,12 @@ list(REMOVE_ITEM KEP_TOOLBOX_CXX_FLAGS_DEBUG "-Wold-style-cast") if(PYKEP_BUILD_PYKEP) include(YACMAPythonSetup) # NOTE: for the time being, require that dcgp/dcgpy versions are matching exactly. - find_package(keplerian_toolbox ${PYKEP_PROJECT_VERSION} EXACT REQUIRED) - - # Internal variable that will be used to tell PykepFindBoost to locate Boost.Python. - set(_PYKEP_FIND_BOOST_PYTHON TRUE) + find_package(keplerian_toolbox ${PYKEP_PROJECT_VERSION} EXACT REQUIRED CONFIG) endif() # Boost setup. Will allow using Boost::library_name for the needed components -include(PykepFindBoost) +find_package(Boost 1.69 REQUIRED COMPONENTS serialization date_time python CONFIG) + if(PYKEP_BUILD_KEP_TOOLBOX) # List of source files. @@ -298,7 +296,6 @@ if(PYKEP_BUILD_KEP_TOOLBOX) ) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/keplerian_toolbox-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/keplerian_toolbox-config.cmake" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/keplerian_toolbox-config.cmake" DESTINATION "lib/cmake/keplerian_toolbox") - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/PykepFindBoost.cmake" DESTINATION "lib/cmake/keplerian_toolbox") install(EXPORT keplerian_toolbox_export NAMESPACE Keplerian_toolbox:: DESTINATION lib/cmake/keplerian_toolbox) # Take care of versioning. include(CMakePackageConfigHelpers) diff --git a/cmake_modules/PykepFindBoost.cmake b/cmake_modules/PykepFindBoost.cmake deleted file mode 100644 index 0462a21d..00000000 --- a/cmake_modules/PykepFindBoost.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# Run a first pass for finding the headers only, -# and establishing the Boost version (used to define the python lib name) -set(_PYKEP_BOOST_MINIMUM_VERSION 1.55.0) -find_package(Boost ${_PYKEP_BOOST_MINIMUM_VERSION} QUIET REQUIRED) - -set(_PYKEP_REQUIRED_BOOST_LIBS date_time serialization) - -if(_PYKEP_FIND_BOOST_PYTHON) - # NOTE: since Boost 1.67, the naming of the Boost.Python library has changed to include the - # major and minor python version as a suffix. See the release notes: - # https://www.boost.org/users/history/version_1_67_0.html - if(${Boost_MAJOR_VERSION} GREATER 1 OR (${Boost_MAJOR_VERSION} EQUAL 1 AND ${Boost_MINOR_VERSION} GREATER 66)) - list(APPEND _PYKEP_REQUIRED_BOOST_LIBS "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}") - else() - if(${PYTHON_VERSION_MAJOR} EQUAL 2) - list(APPEND _PYKEP_REQUIRED_BOOST_LIBS python) - else() - list(APPEND _PYKEP_REQUIRED_BOOST_LIBS python3) - endif() - endif() -endif() -message(STATUS "Required Boost libraries: ${_PYKEP_REQUIRED_BOOST_LIBS}") -find_package(Boost ${_PYKEP_BOOST_MINIMUM_VERSION} REQUIRED COMPONENTS ${_PYKEP_REQUIRED_BOOST_LIBS}) -if(NOT Boost_FOUND) - message(FATAL_ERROR "Not all requested Boost components were found, exiting.") -endif() -message(STATUS "Detected Boost version: ${Boost_VERSION}") -message(STATUS "Boost include dirs: ${Boost_INCLUDE_DIRS}") -# Might need to recreate targets if they are missing (e.g., older CMake versions). -if(NOT TARGET Boost::boost) - message(STATUS "The 'Boost::boost' target is missing, creating it.") - add_library(Boost::boost INTERFACE IMPORTED) - set_target_properties(Boost::boost PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") -endif() -if(NOT TARGET Boost::disable_autolinking) - message(STATUS "The 'Boost::disable_autolinking' target is missing, creating it.") - add_library(Boost::disable_autolinking INTERFACE IMPORTED) - if(WIN32) - set_target_properties(Boost::disable_autolinking PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") - endif() -endif() -foreach(_PYKEP_BOOST_COMPONENT ${_PYKEP_REQUIRED_BOOST_LIBS}) - if(NOT TARGET Boost::${_PYKEP_BOOST_COMPONENT}) - message(STATUS "The 'Boost::${_PYKEP_BOOST_COMPONENT}' imported target is missing, creating it.") - string(TOUPPER ${_PYKEP_BOOST_COMPONENT} _PYKEP_BOOST_UPPER_COMPONENT) - if(Boost_USE_STATIC_LIBS) - add_library(Boost::${_PYKEP_BOOST_COMPONENT} STATIC IMPORTED) - else() - add_library(Boost::${_PYKEP_BOOST_COMPONENT} UNKNOWN IMPORTED) - endif() - set_target_properties(Boost::${_PYKEP_BOOST_COMPONENT} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") - set_target_properties(Boost::${_PYKEP_BOOST_COMPONENT} PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${Boost_${_PYKEP_BOOST_UPPER_COMPONENT}_LIBRARY}") - endif() -endforeach() diff --git a/cmake_modules/yacma/YACMACompilerLinkerSettings.cmake b/cmake_modules/yacma/YACMACompilerLinkerSettings.cmake index 8d2779d6..e5632184 100644 --- a/cmake_modules/yacma/YACMACompilerLinkerSettings.cmake +++ b/cmake_modules/yacma/YACMACompilerLinkerSettings.cmake @@ -82,6 +82,7 @@ if(NOT _YACMACompilerLinkerSettingsRun) # Configuration bits specific for GCC. if(YACMA_COMPILER_IS_GNUCXX) _YACMA_CHECK_ENABLE_CXX_FLAG(-fdiagnostics-color=auto) + _YACMA_CHECK_ENABLE_CXX_FLAG(-Woverloaded-virtual) # New in GCC 9. _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Waddress-of-packed-member) endif() @@ -109,7 +110,6 @@ if(NOT _YACMACompilerLinkerSettingsRun) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wc99-designator) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wreorder-init-list) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wsizeof-pointer-div) - _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wsizeof-array-div) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wxor-used-as-pow) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wfinal-dtor-non-final-class) # New warnings in clang 11. @@ -122,18 +122,35 @@ if(NOT _YACMACompilerLinkerSettingsRun) # NOTE: this is a new flag in Clang 13 which seems to give # incorrect warnings for UDLs. _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wno-reserved-identifier) - + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Warray-bounds-pointer-arithmetic) + # New warnings in clang 14. + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Warray-parameter) + # NOTE: clang 17 enables by default a new compiler flag called "-fassume-unique-vtables": + # + # https://releases.llvm.org/17.0.1/tools/clang/docs/ReleaseNotes.html#c-language-changes + # + # This flag however seems to be buggy: + # + # https://github.com/llvm/llvm-project/issues/71196 + # + # On our part, in several projects we are experiencing Boost.serialization failures when + # (de)serialising derived objects through pointers to bases. Thus, we forcibly disable + # this new flag. + _YACMA_CHECK_ENABLE_CXX_FLAG(-fno-assume-unique-vtables) endif() # Common configuration for GCC, clang and Intel. if(YACMA_COMPILER_IS_CLANGXX OR YACMA_COMPILER_IS_INTELXX OR YACMA_COMPILER_IS_GNUCXX) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wall) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wextra) - _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wnon-virtual-dtor) + # NOTE: this flag has been superseded by "-Wdelete-non-virtual-dtor" + # (enabled by "-Wall"). See: + # https://gcc.gnu.org/pipermail/gcc-cvs/2022-November/374730.html + # _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wnon-virtual-dtor) # NOTE: this flag is a bit too chatty, let's disable it for the moment. #_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wnoexcept) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wlogical-op) - #_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wconversion) + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wconversion) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wdeprecated) # This limit is supposed to be at least 1024 in C++11, but for some reason # clang sets this to 256, and gcc to 900. diff --git a/cmake_modules/yacma/YACMAPythonSetup.cmake b/cmake_modules/yacma/YACMAPythonSetup.cmake index 2d31cebb..d4364f18 100644 --- a/cmake_modules/yacma/YACMAPythonSetup.cmake +++ b/cmake_modules/yacma/YACMAPythonSetup.cmake @@ -24,7 +24,7 @@ if(_YACMA_PYTHON_MODULE_NEED_LINK) else() # NOTE: we need to determine the include dir on our own. if(NOT YACMA_PYTHON_INCLUDE_DIR) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from __future__ import print_function\nfrom distutils import sysconfig\nprint(sysconfig.get_python_inc())" + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from __future__ import print_function\nimport sysconfig\nprint(sysconfig.get_path('include'))" OUTPUT_VARIABLE _YACMA_PYTHON_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) if(_YACMA_PYTHON_INCLUDE_DIR) set(YACMA_PYTHON_INCLUDE_DIR "${_YACMA_PYTHON_INCLUDE_DIR}" CACHE PATH "Path to the Python include dir.") @@ -66,7 +66,7 @@ if(UNIX) if(NOT YACMA_PYTHON_MODULES_INSTALL_PATH) # NOTE: here we use this contraption (instead of the simple method below for Win32) because like this we can # support installation into the CMake prefix (e.g., in the user's home dir). - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from __future__ import print_function\nimport distutils.sysconfig\nimport os\nprint(os.path.split(distutils.sysconfig.get_python_lib())[-1])" + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from __future__ import print_function\nimport sysconfig\nimport os\nprint(os.path.split(sysconfig.get_path('platlib'))[-1])" OUTPUT_VARIABLE _YACMA_PY_PACKAGES_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "Python packages dir is: ${_YACMA_PY_PACKAGES_DIR}") set(YACMA_PYTHON_MODULES_INSTALL_PATH "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${_YACMA_PY_PACKAGES_DIR}" CACHE PATH "Install path for Python modules.") @@ -78,7 +78,7 @@ elseif(WIN32) set(_YACMA_PY_MODULE_EXTENSION "pyd") if(NOT YACMA_PYTHON_MODULES_INSTALL_PATH) # On Windows, we will install directly into the install path of the Python interpreter. - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'))" OUTPUT_VARIABLE _YACMA_PYTHON_MODULES_INSTALL_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) set(YACMA_PYTHON_MODULES_INSTALL_PATH "${_YACMA_PYTHON_MODULES_INSTALL_PATH}" CACHE PATH "Install path for Python modules.") mark_as_advanced(YACMA_PYTHON_MODULES_INSTALL_PATH) diff --git a/keplerian_toolbox-config.cmake.in b/keplerian_toolbox-config.cmake.in index 8735cc35..43975710 100644 --- a/keplerian_toolbox-config.cmake.in +++ b/keplerian_toolbox-config.cmake.in @@ -4,7 +4,6 @@ get_filename_component(_KEP_TOOLBOX_CONFIG_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" #Find the deps.Alter the cmake module path. set(_KEP_TOOLBOX_CONFIG_OLD_MODULE_PATH "${CMAKE_MODULE_PATH}") list(APPEND CMAKE_MODULE_PATH "${_KEP_TOOLBOX_CONFIG_SELF_DIR}") -include(PykepFindBoost) #Restore original module path. set(CMAKE_MODULE_PATH "${_KEP_TOOLBOX_CONFIG_OLD_MODULE_PATH}") diff --git a/pykep/CMakeLists.txt b/pykep/CMakeLists.txt index 4bf0f70e..011ae865 100644 --- a/pykep/CMakeLists.txt +++ b/pykep/CMakeLists.txt @@ -10,15 +10,8 @@ endif() # NOTE: since Boost 1.67, the naming of the Boost.Python library has changed to include the # major and minor python version as a suffix. See the release notes: # https://www.boost.org/users/history/version_1_67_0.html -if(${Boost_MAJOR_VERSION} GREATER 1 OR (${Boost_MAJOR_VERSION} EQUAL 1 AND ${Boost_MINOR_VERSION} GREATER 66)) - set(PYKEP_BP_TARGET "Boost::python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}") -else() - if(${PYTHON_VERSION_MAJOR} EQUAL 2) - set(PYKEP_BP_TARGET "Boost::python") - else() - set(PYKEP_BP_TARGET "Boost::python3") - endif() -endif() +set(PYKEP_BP_TARGET "Boost::python") + # Boost.Python version 1.64 (and possibly later?) has issues with default hidden visibility. if(${Boost_MAJOR_VERSION} GREATER 1 OR (${Boost_MAJOR_VERSION} EQUAL 1 AND ${Boost_MINOR_VERSION} GREATER 63)) diff --git a/pykep/__init__.py b/pykep/__init__.py index fdb1c2a1..ca4a0ab2 100644 --- a/pykep/__init__.py +++ b/pykep/__init__.py @@ -59,7 +59,7 @@ ########################################################### # We define pykep module ########################################################### -version = '2.6.1' +version = '2.6.3' __doc__ = 'pykep is the answer ... but what was the question?' __all__ = ['core', 'sims_flanagan', 'pontryagin', 'orbit_plots', 'examples', 'trajopt', 'phasing', 'util', 'planet', 'test'] diff --git a/pykep/trajopt/_launchers.py b/pykep/trajopt/_launchers.py index 5d0fe17f..dea52a30 100644 --- a/pykep/trajopt/_launchers.py +++ b/pykep/trajopt/_launchers.py @@ -1,9 +1,10 @@ -from scipy.interpolate import interp2d, interp1d +from scipy.interpolate import RectBivariateSpline, interp1d from math import sqrt +import numpy as np _vinfs_A5 = [0., 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6] _decls_A5 = [-90, -40, -30, -29, -28.5, -20, -10, 0, 10, 20, 28.5, 29, 30, 40, 90] -_data_A5 = [ +_data_A5 = np.array([ [1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0], @@ -19,14 +20,14 @@ [10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1] -] +]) _vinfs_A551 = [sqrt(elem) for elem in [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, 45, 50, 55, 60]] _data_A551 = [5995, 5780, 5570, 5360, 5160, 4965, 4775, 4585, 4405, 4230, 4055, 3890, 3730, 3570, 3420, 3270, 3130, 2995, 2860, 2670, 2380, 2120, 1900, 1695] _vinfs_SF = [0, 1, 2, 3, 4, 5] _decls_SF = [-90, -65, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50, 65, 90] -_data_SF = [ +_data_SF = np.array([ [1e-3, 1e-3, 1e-3, 1e-3, 1e-3, 1e-3], [100., 100.00000, 100.00000, 100.00000, 100.00000, 100.00000], [1830.50000, 1830.50000, 1815.90000, 1737.70000, 1588.00000, 1344.30000], @@ -42,14 +43,14 @@ [1805.90000, 1805.90000, 1796.00000, 1722.70000, 1571.60000, 1327.60000], [100.00000, 100.00000, 100.00000, 100.00000, 100.00000, 100.00000], [1e-3, 1e-3, 1e-3, 1e-3, 1e-3, 1e-3] -] +]) # Ariane 5: data provided to ESOC by Arianespace when they were still considering Ariane launch for ExoMars. # Negative mass values have been substituted with exp(m/1000) to avoid problems. # Declination has been extended up to 90 degrees. _vinfs_Ariane5 = [0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. ] _decls_Ariane5 = [-90, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 90] -_data_Ariane5 = [ +_data_Ariane5 = np.array([ [4.97870684e-02, 3.01973834e-02, 1.83156389e-02, 1.11089965e-02, 6.73794700e-03, 2.47875218e-03, 9.11881966e-04, 3.35462628e-04, 1.23409804e-04, 4.53999298e-05, 1.67017008e-05, 6.14421235e-06], [4.97870684e-02, 3.01973834e-02, 1.83156389e-02, 1.11089965e-02, 6.73794700e-03, 2.47875218e-03, 9.11881966e-04, 3.35462628e-04, 1.23409804e-04, 4.53999298e-05, 1.67017008e-05, 6.14421235e-06], [8.20849986e-02, 4.97870684e-02, 3.01973834e-02, 1.83156389e-02, 1.11089965e-02, 6.73794700e-03, 2.47875218e-03, 9.11881966e-04, 3.35462628e-04, 1.23409804e-04, 4.53999298e-05, 1.67017008e-05], @@ -73,7 +74,7 @@ [5.47700000e+03, 5.23900000e+03, 4.88200000e+03, 4.40100000e+03, 3.79500000e+03, 3.67879441e-01, 1.35335283e-01, 4.97870684e-02, 1.83156389e-02, 6.73794700e-03, 2.47875218e-03, 9.11881966e-04], [5.30200000e+03, 5.02100000e+03, 4.60400000e+03, 4.04400000e+03, 3.67879441e-01, 1.35335283e-01, 4.97870684e-02, 1.83156389e-02, 6.73794700e-03, 2.47875218e-03, 9.11881966e-04, 3.35462628e-04], [5.30200000e+03, 5.02100000e+03, 4.60400000e+03, 4.04400000e+03, 3.67879441e-01, 1.35335283e-01, 4.97870684e-02, 1.83156389e-02, 6.73794700e-03, 2.47875218e-03, 9.11881966e-04, 3.35462628e-04] -] +]) class _launchers: """ @@ -92,10 +93,10 @@ class _launchers: """ def __init__(self): - self._atlas501 = interp2d(_vinfs_A5, _decls_A5, _data_A5, kind='linear', fill_value=0.1, copy=False) + self._atlas501 = RectBivariateSpline(_vinfs_A5, _decls_A5, _data_A5.T, kx=1, ky=1) self._atlas551 = interp1d(_vinfs_A551, _data_A551, kind='linear', fill_value=0.1, copy=False, bounds_error=False) - self._soyuzf = interp2d(_vinfs_SF, _decls_SF, _data_SF, kind='linear', fill_value=1e-3, copy=False) - self._ariane5 = interp2d(_vinfs_Ariane5, _decls_Ariane5, _data_Ariane5, kind='linear', fill_value=1e-3, copy=False) + self._soyuzf = RectBivariateSpline(_vinfs_SF, _decls_SF, _data_SF.T, kx=1, ky=1) + self._ariane5 = RectBivariateSpline(_vinfs_Ariane5, _decls_Ariane5, _data_Ariane5.T, kx=1, ky=1) def atlas501(self, vinfs, decls): """atlas501(vinfs, decls) @@ -110,7 +111,7 @@ def atlas501(self, vinfs, decls): Numpy array containg the mass delivered to escape with said declinations and magnitudes. """ - return self._atlas501(vinfs, decls) + return self._atlas501(vinfs, decls).T def atlas551(self, vinfs): """atlas551(vinfs) @@ -140,7 +141,7 @@ def soyuzf(self, vinfs, decls): Returns: Numpy array containg the mass delivered to escape with said declinations and magnitudes. """ - return self._soyuzf(vinfs, decls) + return self._soyuzf(vinfs, decls).T def ariane5(self, vinfs, decls): """ariane5(vinfs, decls) @@ -155,4 +156,4 @@ def ariane5(self, vinfs, decls): Returns: Numpy array containg the mass delivered to escape with said declinations and magnitudes. """ - return self._ariane5(vinfs, decls) + return self._ariane5(vinfs, decls).T diff --git a/tools/gha-osx-debug.sh b/tools/gha-osx-debug.sh index 819da7d2..20131e73 100644 --- a/tools/gha-osx-debug.sh +++ b/tools/gha-osx-debug.sh @@ -6,12 +6,15 @@ set -x # Exit on error. set -e +# Core deps. +sudo apt-get install wget + # Install conda+deps. -wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-x86_64.sh -O mambaforge.sh +wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh export deps_dir=$HOME/local -export PATH="$HOME/mambaforge/bin:$PATH" -bash mambaforge.sh -b -p $HOME/mambaforge -mamba create -y -q -p $deps_dir c-compiler cxx-compiler cmake boost boost-cpp python=3.11 scipy matplotlib +export PATH="$HOME/miniforge/bin:$PATH" +bash miniforge.sh -b -p $HOME/miniforge +conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel python scipy matplotlib ninja source activate $deps_dir # Create the build dir and cd into it. diff --git a/tools/gha-ubuntu-debug.sh b/tools/gha-ubuntu-debug.sh index 8af75fca..20131e73 100644 --- a/tools/gha-ubuntu-debug.sh +++ b/tools/gha-ubuntu-debug.sh @@ -10,11 +10,11 @@ set -e sudo apt-get install wget # Install conda+deps. -wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh +wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh export deps_dir=$HOME/local -export PATH="$HOME/mambaforge/bin:$PATH" -bash mambaforge.sh -b -p $HOME/mambaforge -mamba create -y -q -p $deps_dir c-compiler cxx-compiler cmake boost boost-cpp python=3.11 scipy matplotlib +export PATH="$HOME/miniforge/bin:$PATH" +bash miniforge.sh -b -p $HOME/miniforge +conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel python scipy matplotlib ninja source activate $deps_dir # Create the build dir and cd into it. diff --git a/tools/gha-windows-debug.ps1 b/tools/gha-windows-debug.ps1 index d7e04635..1be359d1 100644 --- a/tools/gha-windows-debug.ps1 +++ b/tools/gha-windows-debug.ps1 @@ -1,7 +1,7 @@ # Powershell script # Install conda environment conda config --set always_yes yes -conda create --name pykep cmake boost boost-cpp python=3.11 scipy matplotlib +conda create --name pykep cmake libboost-devel python scipy matplotlib conda activate pykep mkdir build From f5a93a6ab92eb3c1c55b2606c12e34e123bf2f0e Mon Sep 17 00:00:00 2001 From: Dario Izzo Date: Tue, 10 Dec 2024 18:58:05 +0100 Subject: [PATCH 2/4] fix for path --- tools/gha-osx-debug.sh | 2 +- tools/gha-ubuntu-debug.sh | 2 +- tools/gha-windows-debug.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/gha-osx-debug.sh b/tools/gha-osx-debug.sh index 20131e73..263167b9 100644 --- a/tools/gha-osx-debug.sh +++ b/tools/gha-osx-debug.sh @@ -14,7 +14,7 @@ wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge export deps_dir=$HOME/local export PATH="$HOME/miniforge/bin:$PATH" bash miniforge.sh -b -p $HOME/miniforge -conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel python scipy matplotlib ninja +conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel libboost-python-devel python scipy matplotlib ninja source activate $deps_dir # Create the build dir and cd into it. diff --git a/tools/gha-ubuntu-debug.sh b/tools/gha-ubuntu-debug.sh index 20131e73..263167b9 100644 --- a/tools/gha-ubuntu-debug.sh +++ b/tools/gha-ubuntu-debug.sh @@ -14,7 +14,7 @@ wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge export deps_dir=$HOME/local export PATH="$HOME/miniforge/bin:$PATH" bash miniforge.sh -b -p $HOME/miniforge -conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel python scipy matplotlib ninja +conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel libboost-python-devel python scipy matplotlib ninja source activate $deps_dir # Create the build dir and cd into it. diff --git a/tools/gha-windows-debug.ps1 b/tools/gha-windows-debug.ps1 index 1be359d1..f4e5d5a4 100644 --- a/tools/gha-windows-debug.ps1 +++ b/tools/gha-windows-debug.ps1 @@ -1,7 +1,7 @@ # Powershell script # Install conda environment conda config --set always_yes yes -conda create --name pykep cmake libboost-devel python scipy matplotlib +conda create --name pykep cmake libboost-devel libboost-python-devel python scipy matplotlib conda activate pykep mkdir build From f7d808725fcf3a6523222019a05855f9f609c0ff Mon Sep 17 00:00:00 2001 From: Dario Izzo Date: Wed, 11 Dec 2024 08:10:15 +0100 Subject: [PATCH 3/4] building also on old python --- .github/workflows/main.yml | 12 +++++-- tools/gha-ubuntu-release-py312.sh | 54 +++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 tools/gha-ubuntu-release-py312.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a932d57f..b767a7ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,22 +19,28 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" + ubuntu-release-py311: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build + run: bash tools/gha-ubuntu-release-py311.sh ubuntu-debug: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build run: bash tools/gha-ubuntu-debug.sh osx-debug: runs-on: macos-10.15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build run: bash tools/gha-osx-debug.sh windows-2019: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.2 - uses: conda-incubator/setup-miniconda@v2 diff --git a/tools/gha-ubuntu-release-py312.sh b/tools/gha-ubuntu-release-py312.sh new file mode 100644 index 00000000..f284b1d8 --- /dev/null +++ b/tools/gha-ubuntu-release-py312.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Echo each command +set -x + +# Exit on error. +set -e + +# Core deps. +sudo apt-get install wget + +# Install conda+deps. +wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh +export deps_dir=$HOME/local +export PATH="$HOME/miniforge/bin:$PATH" +bash miniforge.sh -b -p $HOME/miniforge +conda create -y -q -p $deps_dir c-compiler cxx-compiler cmake libboost-devel libboost-python-devel python=3.11 scipy matplotlib ninja +source activate $deps_dir + +# Create the build dir and cd into it. +mkdir build + +# Install keplerian_toolbox +cd build +cmake \ + -DBoost_NO_BOOST_CMAKE=ON \ + -DCMAKE_INSTALL_PREFIX=$deps_dir \ + -DCMAKE_PREFIX_PATH=$deps_dir \ + -DCMAKE_BUILD_TYPE=Debug \ + -DPYKEP_BUILD_KEP_TOOLBOX=yes \ + -DPYKEP_BUILD_PYKEP=no \ + -DPYKEP_BUILD_SPICE=yes \ + -DPYKEP_BUILD_TESTS=yes \ + .. +make VERBOSE=1 install +ctest -j4 -V +cd .. + +# Install pykep +mkdir build_pykep +cd build_pykep +cmake \ + -DBoost_NO_BOOST_CMAKE=ON \ + -DCMAKE_INSTALL_PREFIX=$deps_dir \ + -DCMAKE_PREFIX_PATH=$deps_dir \ + -DCMAKE_BUILD_TYPE=Debug \ + -DPYKEP_BUILD_KEP_TOOLBOX=no \ + -DPYKEP_BUILD_PYKEP=yes \ + .. + +make VERBOSE=1 install +python -c "import pykep.test; pykep.test.run_test_suite()" +set +e +set +x \ No newline at end of file From c20bfaef75585ced652d7c67f6061ce6da9c2842 Mon Sep 17 00:00:00 2001 From: Dario Izzo Date: Wed, 11 Dec 2024 08:28:49 +0100 Subject: [PATCH 4/4] typo fix --- .../{gha-ubuntu-release-py312.sh => gha-ubuntu-release-py311.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tools/{gha-ubuntu-release-py312.sh => gha-ubuntu-release-py311.sh} (100%) diff --git a/tools/gha-ubuntu-release-py312.sh b/tools/gha-ubuntu-release-py311.sh similarity index 100% rename from tools/gha-ubuntu-release-py312.sh rename to tools/gha-ubuntu-release-py311.sh