Skip to content

Commit

Permalink
Update settings in preparation for new PyPI release
Browse files Browse the repository at this point in the history
  • Loading branch information
akoumjian authored May 29, 2024
1 parent 058891a commit 8c6fc38
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 81 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pip-build-lint-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
run: |
pip install pip --upgrade
pip install ".[dev]"
# Install pyoorb propagator from source
pip install git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git@main
- name: Lint
run: pdm run lint
- name: Test with coverage
Expand Down
46 changes: 17 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

`adam_core` is used by a variety of library and services at the Asteroid Institute. Sharing these common classes, types, and conversions amongst our tools ensures consistency and accuracy.

## Installation

ADAM Core is available on PyPI

```bash
pip install adam_core
```

## Usage

### Orbits
Expand Down Expand Up @@ -152,17 +160,17 @@ 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. 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.
You will need to install either 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):
To propagate orbits with ASSIST (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 PYOORBPropagator
from adam_core.propagator.adam_assist import ASSISTPropagator, download_jpl_ephemeris_files
from adam_core.time import Timestamp

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

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

# Define propagation times
times = initial_time.from_mjd(initial_time.mjd() + np.arange(0, 100))
Expand All @@ -189,10 +198,10 @@ propagated_orbits = propagator.propagate_orbits(
#### Ephemeris Generation
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.
You will need to install adam-pyoorb in order to use the ephemeris generator, which is currently only available on GitHub.

```sh
pip install adam-core[pyoorb]
pip install git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git
```


Expand All @@ -201,7 +210,7 @@ import numpy as np
from astropy import units as u

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

Expand Down Expand Up @@ -286,7 +295,7 @@ import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_sbdb
from adam_core.propagator import PYOORBPropagator
from adam_core.propagator.adam_pyoorb import PYOORBPropagator
from adam_core.observers import Observers
from adam_core.dynamics import generate_ephemeris_2body
from adam_core.time import Timestamp
Expand Down Expand Up @@ -345,25 +354,4 @@ adam_core
└── utils # Utility classes like Indexable or conversions like times_from_df
```

## Installation

ADAM Core is available on PyPI

```bash
pip install adam_core
```

## Development

Development is made easy with our Docker container environment.

```bash
# Build the container
docker compose build

# Run tests in the container
docker compose run adam_core pytest .

# Run a shell in the container
docker compose run adam_core bash
```
100 changes: 50 additions & 50 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,39 @@ description = "Core libraries for the ADAM platform"
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Astronomy",
]
license = { file = "LICENSE.md" }

keywords = ["astronomy", "orbital mechanics", "propagation"]

dependencies = [
"astropy",
"astroquery",
"healpy",
"jax",
"jaxlib",
"numpy>=1.20,<1.25",
"pyarrow>=13.0.0",
"pandas",
"ray",
"requests",
"scipy",
"spiceypy",
"quivr==0.7.3a1",
"mpc-obscodes",
"naif-de440",
"naif-leapseconds",
"naif-eop-high-prec",
"naif-eop-predict",
"naif-eop-historical",
"naif-earth-itrf93",
"astropy",
"astroquery",
"healpy",
"jax",
"jaxlib",
"numpy>=1.20,<1.25",
"pyarrow>=13.0.0",
"pandas",
"ray",
"requests",
"scipy",
"spiceypy",
"quivr==0.7.3a1",
"mpc-obscodes",
"naif-de440",
"naif-leapseconds",
"naif-eop-high-prec",
"naif-eop-predict",
"naif-eop-historical",
"naif-earth-itrf93",
]

[build-system]
Expand All @@ -51,11 +59,14 @@ write_to = "adam_core/_version.py"
write_template = "__version__ = '{}'"



[tool.pdm.scripts]
check = {composite = ["lint", "typecheck", "test"]}
format = { composite = ["black ./src/adam_core", "isort ./src/adam_core"]}
lint = { composite = ["ruff check ./src/adam_core", "black --check ./src/adam_core", "isort --check-only ./src/adam_core"] }
check = { composite = ["lint", "typecheck", "test"] }
format = { composite = ["black ./src/adam_core", "isort ./src/adam_core"] }
lint = { composite = [
"ruff check ./src/adam_core",
"black --check ./src/adam_core",
"isort --check-only ./src/adam_core",
] }
fix = "ruff ./src/adam_core --fix"
typecheck = "mypy --strict ./src/adam_core"

Expand All @@ -73,30 +84,21 @@ coverage = "pytest --cov=adam_core --cov-report=xml"

[project.optional-dependencies]
assist = [
"adam-assist @ git+https://github.com/B612-Asteroid-Institute/adam-assist.git@main",
]
pyoorb = [
"adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git@main",
]
all = [
"adam-assist @ git+https://github.com/B612-Asteroid-Institute/adam-assist.git@main",
"adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git@main",
"adam-assist>=0.1.1a1"
]


dev = [
"adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git@main",
"black",
"ipython",
"isort",
"mypy",
"pdm",
"pytest-benchmark",
"pytest-cov",
"pytest-doctestplus",
"pytest-mock",
"pytest",
"ruff",
"black",
"ipython",
"isort",
"mypy",
"pdm",
"pytest-benchmark",
"pytest-cov",
"pytest-doctestplus",
"pytest-mock",
"pytest",
"ruff",
]

[tool.black]
Expand All @@ -114,6 +116,4 @@ exclude = ["build"]
[tool.pytest.ini_options]
# In order for namespace packages to work during tests,
# we need to import from the installed modules instead of local source
addopts = [
"--pyargs", "adam_core",
]
addopts = ["--pyargs", "adam_core"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

import pytest

from adam_core.propagator.adam_pyoorb import PYOORBPropagator
try:
from adam_core.propagator.adam_pyoorb import PYOORBPropagator
except ImportError:
PYOORBPropagator = None

from ..differential_correction import fit_least_squares


@pytest.mark.skipif(
os.environ.get("OORB_DATA") is None, reason="OORB_DATA environment variable not set"
)
@pytest.mark.skipif(PYOORBPropagator is None, reason="PYOORBPropagator not available")
def test_fit_least_squares_pure_iod_orbit(pure_iod_orbit):
# Test that fit_least_squares can fit and improve a pure orbit from an IOD
# process using least squares
Expand Down
7 changes: 6 additions & 1 deletion src/adam_core/orbit_determination/tests/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
import pytest
import quivr as qv

from adam_core.propagator.adam_pyoorb import PYOORBPropagator
try:
from adam_core.propagator.adam_pyoorb import PYOORBPropagator
except ImportError:
PYOORBPropagator = None

from ..evaluate import evaluate_orbits


@pytest.mark.skipif(
os.environ.get("OORB_DATA") is None, reason="OORB_DATA environment variable not set"
)
@pytest.mark.skipif(PYOORBPropagator is None, reason="PYOORBPropagator not available")
def test_evaluate_orbits(pure_iod_orbit):
# Test that evaluate_orbit correctly calculates residuals and other
# parameters for an input orbit
Expand Down Expand Up @@ -60,6 +64,7 @@ def test_evaluate_orbits(pure_iod_orbit):
@pytest.mark.skipif(
os.environ.get("OORB_DATA") is None, reason="OORB_DATA environment variable not set"
)
@pytest.mark.skipif(PYOORBPropagator is None, reason="PYOORBPropagator not available")
def test_evaluate_orbits_outliers(pure_iod_orbit):
# Test that evaluate_orbit correctly calculates residuals and other
# parameters for an input orbit with outliers defined
Expand Down

0 comments on commit 8c6fc38

Please sign in to comment.