Skip to content

Commit

Permalink
Merge pull request #74 from rahil-makadia/dev
Browse files Browse the repository at this point in the history
full de441 kernel mapping; mac wheels are back
  • Loading branch information
rahil-makadia authored Jul 10, 2024
2 parents e0d6585 + 23d9e39 commit fb88fd5
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 42 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/cpp_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'include/**'
- 'src/**'
- 'tests/cpp/**'
- 'grss/version.txt'

jobs:
prop-only:
Expand All @@ -18,7 +19,9 @@ jobs:
uses: actions/checkout@v4
- name: Build GRSS library
run: |
sudo apt-get install doxygen
cd ./extern/
python3 get_cspice.py
cd ..
source initialize.sh
source build_cpp.sh -clean
- name: Run tests
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
branches:
- main
- dev
paths:
- '.github/workflows/docs.yml'
- 'docs/**'
- 'include/**'
- 'src/**'
- 'grss/**'

jobs:
sphinx:
Expand All @@ -19,7 +25,7 @@ jobs:
run: |
python3 -m pip install --upgrade pip
sudo apt-get install pandoc doxygen
source initialize.sh
pip3 install "pybind11[global]>=2.10.0"
pip3 install .
- name: Build docs
run: |
Expand All @@ -31,7 +37,7 @@ jobs:
make clean html
cd ..
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
23 changes: 8 additions & 15 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] #, macos-latest]
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -30,15 +30,8 @@ jobs:
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: '15.1.0'
- name: Install doxygen
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install doxygen
- name: Install doxygen
if: matrix.os == 'macos-latest'
run: brew install doxygen
- name: Initialize repository
run: |
source initialize.sh
- name: Get Pybind11
run: pip3 install "pybind11[global]>=2.10.0"
- name: Build python distributions
run: source build_python.sh
- name: Upload distribution for next job
Expand All @@ -55,11 +48,11 @@ jobs:
with:
name: dist-ubuntu-latest
path: dist
# - name: Download MacOS distribution from previous job
# uses: actions/download-artifact@master
# with:
# name: dist-macos-latest
# path: dist
- name: Download MacOS distribution from previous job
uses: actions/download-artifact@master
with:
name: dist-macos-latest
path: dist
- name: Show files
run: ls -l dist
- name: Publish to Test PyPI
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
- name: Install GRSS (including dependencies)
run: |
python3 -m pip install --upgrade pip
sudo apt-get install doxygen
source initialize.sh
pip3 install "pybind11[global]>=2.10.0"
pip3 install .
- name: Run tests
run: |
Expand Down
7 changes: 4 additions & 3 deletions build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ if [[ $clean -eq 1 ]]; then
rm -rf build
fi
mkdir -p build
cd build
if [[ $docs -eq 1 ]]; then
cmake -DBUILD_DOCS=ON ..
DOCFLAG="-DBUILD_DOCS=ON"
else
cmake -DBUILD_DOCS=OFF ..
DOCFLAG="-DBUILD_DOCS=OFF"
fi
cmake $DOCFLAG -Dpybind11_DIR=$(pybind11-config --cmakedir) -DPYTHON_EXECUTABLE=$(which python) -B./build -S.
cd build
make
cd ..
8 changes: 4 additions & 4 deletions grss/kernels/get_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
# de440 planets + de441 big16
mb440_exists = os.path.exists(f'{script_dir}/de440.bsp')
sb441s_exists = os.path.exists(f'{script_dir}/sb441-n16s.bsp')
mb441_exists = os.path.exists(f'{script_dir}/de441_part-2.bsp')
mb441_exists = os.path.exists(f'{script_dir}/de441.bsp')
sb441_exists = os.path.exists(f'{script_dir}/sb441-n16.bsp')
if (not mb440_exists or not mb441_exists or not sb441s_exists or not sb441_exists):
print('Downloading DE440/441 planet and big16 asteroid kernels...')
os.system((f'curl --silent --show-error -o {script_dir}/de440.bsp '
f'{NAIF_SITE}/spk/planets/de440.bsp'))
f'{SSD_SITE}/eph/planets/bsp/de440.bsp'))
os.system((f'curl --silent --show-error -o {script_dir}/sb441-n16s.bsp '
f'{SSD_SITE}/xfr/sb441-n16s.bsp'))
os.system((f'curl --silent --show-error -o {script_dir}/de441_part-2.bsp '
f'{NAIF_SITE}/spk/planets/de441_part-2.bsp'))
os.system((f'curl --silent --show-error -o {script_dir}/de441.bsp '
f'{SSD_SITE}/eph/planets/bsp/de441.bsp'))
os.system((f'curl --silent --show-error -o {script_dir}/sb441-n16.bsp '
f'{SSD_SITE}/eph/small_bodies/asteroids_de441/sb441-n16.bsp'))

Expand Down
2 changes: 1 addition & 1 deletion grss/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.1
4.1.2
2 changes: 1 addition & 1 deletion include/spk.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct SpkCacheItem {
* It is set to 32, which is a bit of a buffer on the usual number of
* 27 SpiceBodies in each PropSimulation (Sun+8planets+Moon+Pluto+16Asteriods).
*/
#define SPK_CACHE_ITEM_SIZE 32
#define SPK_CACHE_ITEM_SIZE 44

/**
* @brief Structure to hold a cache of SPK data.
Expand Down
6 changes: 2 additions & 4 deletions initialize.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/bash

# get cspice and install pybind11
cd ./extern/
python3 get_cspice.py
# get pybind11
pip3 install "pybind11[global]>=2.10.0"

# get debiasing data and kernels
cd ../grss/debias/
cd grss/debias/
python3 get_debiasing_data.py
cd ../kernels/
python3 get_kernels.py
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ dependencies = {file = "requirements.txt"}
[tool.cibuildwheel]
before-build = [
"pip install pybind11",
"rm -rf build",
"mkdir build",
"pybind11_DIR=$(pybind11-config --cmakedir)",
"cmake -DBUILD_DOCS=OFF -Dpybind11_DIR=$pybind11_DIR -DPYTHON_EXECUTABLE=$(which python) -B./build -S.",
". ./build_cpp.sh -clean",
]

[tool.cibuildwheel.macos]
environment = {MACOSX_DEPLOYMENT_TARGET = "14"}
archs = ["arm64"]

[tool.cibuildwheel.linux]
Expand Down
2 changes: 1 addition & 1 deletion src/grss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ PYBIND11_MODULE(libgrss, m) {
&PropSimulation::set_integration_parameters, py::arg("tf"),
py::arg("tEval") = std::vector<real>(),
py::arg("tEvalUTC") = false, py::arg("evalApparentState") = false,
py::arg("convergedLightTims") = false,
py::arg("convergedLightTime") = false,
py::arg("observerInfo") = std::vector<std::vector<real>>(),
py::arg("adaptiveTimestep") = true, py::arg("dt0") = 0.0L,
py::arg("dtMin") = 1.0e-4L, py::arg("dtChangeFactor") = 0.25L,
Expand Down
2 changes: 1 addition & 1 deletion src/pck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ PckInfo* pck_init(const std::string &path) {
int m = bpc->num - 1;
// New target?
if (bpc->num == 0 || sum->code != bpc->targets[m].code) {
if (bpc->num <= bpc->allocatedNum) {
if (bpc->num == bpc->allocatedNum) {
bpc->allocatedNum += 4; // increase space in batches of PCK_CACHE_ITEM_SIZE(4)
bpc->targets = (PckTarget *)realloc(
bpc->targets, bpc->allocatedNum * sizeof(PckTarget));
Expand Down
2 changes: 1 addition & 1 deletion src/simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ PropSimulation::PropSimulation(std::string name, real t0,
"Be sure that you need the coverage provided by DE441."
<< std::endl;
kernel_sb = DEkernelPath + "sb441-n16.bsp";
kernel_mb = DEkernelPath + "de441_part-2.bsp";
kernel_mb = DEkernelPath + "de441.bsp";
}
real G = 6.6743e-11L /
(149597870700.0L * 149597870700.0L * 149597870700.0L) *
Expand Down
2 changes: 1 addition & 1 deletion src/spk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ SpkInfo* spk_init(const std::string &path) {
int m = bsp->num - 1;
// New target?
if (bsp->num == 0 || sum->code != bsp->targets[m].code) {
if (bsp->num <= bsp->allocatedNum) {
if (bsp->num == bsp->allocatedNum) {
bsp->allocatedNum += SPK_CACHE_ITEM_SIZE; // increase space in batches of SPK_CACHE_ITEM_SIZE
bsp->targets = (SpkTarget *)realloc(
bsp->targets, bsp->allocatedNum * sizeof(SpkTarget));
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/prop/spk_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int main(){

kernel = 441;
kernel_sb = "../../../grss/kernels/sb441-n16.bsp";
kernel_mb = "../../../grss/kernels/de441_part-2.bsp";
kernel_mb = "../../../grss/kernels/de441.bsp";
spiceIds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 199, 299, 301, 399,
// de440 asteroids
2000107, 2000001, 2000065, 2000511, 2000015, 2000031, 2000052, 2000010,
Expand Down

0 comments on commit fb88fd5

Please sign in to comment.