Skip to content

Commit

Permalink
Move PYOORB to a namespace package and update packaging utilities (#113)
Browse files Browse the repository at this point in the history
Remove pyoorb and update package settings.
  • Loading branch information
akoumjian authored May 25, 2024
1 parent 9930785 commit 058891a
Show file tree
Hide file tree
Showing 175 changed files with 142 additions and 711 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/docker-build-lint-test.yml

This file was deleted.

18 changes: 11 additions & 7 deletions .github/workflows/pip-build-lint-test-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: hatch - Build Lint Test and Coverage
name: Build Lint Test and Coverage

on:
push:
Expand All @@ -15,6 +15,8 @@ jobs:
defaults:
run:
shell: bash -l {0}
env:
OORB_DATA: /tmp/oorb/data

steps:
- name: Checkout git repo
Expand All @@ -30,16 +32,18 @@ jobs:
run: |
sudo apt-get update -y
sudo apt-get install -y gfortran liblapack-dev
- name: Install Hatch
wget -P /tmp/ https://storage.googleapis.com/oorb-data/oorb_data.tar.gz
mkdir -p /tmp/oorb/
tar -xvf /tmp/oorb_data.tar.gz -C /tmp/oorb/
- name: Install Testing Dependencies
run: |
pip install pip --upgrade
pip install hatch
pip install ".[dev]"
- name: Lint
run: hatch run dev:lint
- name: Test, with coverage report
run: hatch run dev:coverage
run: pdm run lint
- name: Test with coverage
run: pdm run coverage
- name: Coverage report to coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
path-to-lcov: coverage.xml
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install Hatch
- name: Install Development Dependencies
run: |
pip install pip --upgrade
pip install hatch
pip install ".[dev]"
- name: Build Source Distribution and Wheel
run: hatch build
run: pdm build
- name: Publish adam_core to Test PyPI
if: ${{ inputs.test_pypi }}
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ dmypy.json

# Convenience file for docker development
.docker_bash_history.txt

# Ignore lock files
pdm.lock
.pdm-build/*
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,19 @@ spherical_elements = orbits.coordinates.to_spherical()
```

### Propagator
The propagator class in `adam_core` provides a generalized interface to the supported orbit integrators and ephemeris generators. By default,
`adam_core` ships with PYOORB.
The propagator class in `adam_core` provides a generalized interface to the supported orbit integrators and ephemeris generators. The propagator class is designed to be used with the `Orbits` class and can handle multiple orbits and times.

You will need to install either adam_core[pyoorb] or adam_core[assist], or another compatible propagator in order to use propagation, ephemeris generation, or impact analysis.

#### Propagation
To propagate orbits with PYOORB (here we grab some orbits from Horizons first):

```python
import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_horizons
from adam_core.propagator import PYOORB
from adam_core.propagator import PYOORBPropagator
from adam_core.time import Timestamp

# Get orbits to propagate
Expand All @@ -169,7 +171,7 @@ object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_horizons(object_ids, initial_time)

# Make sure PYOORB is ready
propagator = PYOORB()
propagator = PYOORBPropagator()

# Define propagation times
times = initial_time.from_mjd(initial_time.mjd() + np.arange(0, 100))
Expand All @@ -185,14 +187,21 @@ propagated_orbits = propagator.propagate_orbits(
```

#### Ephemeris Generation
The propagator class can also be used to generate ephemerides for a set of orbits and observers.
Ephemeris generation requires a propagator that implements the EphemerisMixin interface. This is currently only implemented by the PYOORB propagator. The ephemeris generator will automatically map the propagated covariance matrices to the sky-plane.

You will need to install adam-pyoorb in order to use the ephemeris generator.

```sh
pip install adam-core[pyoorb]
```


```python
import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_horizons
from adam_core.propagator import PYOORB
from adam_core.propagator import PYOORBPropagator
from adam_core.observers import Observers
from adam_core.time import Timestamp

Expand All @@ -202,7 +211,7 @@ object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_horizons(object_ids, initial_time)

# Make sure PYOORB is ready
propagator = PYOORB()
propagator = PYOORBPropagator()

# Define a set of observers and observation times
times = Timestamp.from_mjd(initial_time.mjd() + np.arange(0, 100))
Expand Down Expand Up @@ -277,7 +286,7 @@ import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_sbdb
from adam_core.propagator import PYOORB
from adam_core.propagator import PYOORBPropagator
from adam_core.observers import Observers
from adam_core.dynamics import generate_ephemeris_2body
from adam_core.time import Timestamp
Expand All @@ -287,7 +296,7 @@ object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_sbdb(object_ids)

# Make sure PYOORB is ready
propagator = PYOORB()
propagator = PYOORBPropagator()

# Define a set of observers and observation times
times = Timestamp.from_mjd(np.arange(59000, 60000), scale="tdb")
Expand Down
5 changes: 0 additions & 5 deletions adam_core/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion adam_core/__version__.py

This file was deleted.

9 changes: 0 additions & 9 deletions adam_core/propagator/__init__.py

This file was deleted.

Loading

0 comments on commit 058891a

Please sign in to comment.