diff --git a/.github/workflows/conda-build-lint-test.yml b/.github/workflows/conda-build-lint-test.yml index 616af9a3..369a5525 100644 --- a/.github/workflows/conda-build-lint-test.yml +++ b/.github/workflows/conda-build-lint-test.yml @@ -39,10 +39,10 @@ jobs: sed -e '2d' ObsCodes.html | grep -v "<" > OBSCODE.dat rm -f ObsCodes.html cp OBSCODE.dat $CONDA_PREFIX/share/openorb/OBSCODE.dat - - name: Install adam_core and quivr + - name: Install adam_core and adam-pyoorb run: | - pip install adam-core@git+https://github.com/B612-Asteroid-Institute/adam_core@main - pip install quivr@git+https://github.com/moeyensj/quivr@concatenate-empty-attributes + pip install adam-core>=0.2.0 + pip install git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main#egg=adam-pyoorb - name: Build and install run: pip install . --no-deps - name: Lint diff --git a/pyproject.toml b/pyproject.toml index 90ba84a4..149b7be7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,3 +5,11 @@ build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "thor/version.py" write_to_template = "__version__ = '{version}'" + +[tool.pytest.ini_options] +python_functions = "test_*" +addopts = "-m \"not (integration or memory)\"" + +[tool.pytest.ini_options.markers] +integration = "Mark a test as an integration test." +memory = "Mark a test as a memory test." diff --git a/requirements.txt b/requirements.txt index dba91178..ca529523 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -adam-core @ git+https://github.com/B612-Asteroid-Institute/adam_core@ef8ee48976dbf9c70580c166de4cc4fd6195fa36 -quivr >= 0.7.1 +adam-core >= 0.2.0 +quivr == 0.7.3a1 astropy >= 5.3.1 astroquery difi diff --git a/setup.cfg b/setup.cfg index 64dab1d6..183a46a9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,8 @@ setup_requires = wheel setuptools_scm >= 6.0 install_requires = - adam-core @ git+https://github.com/B612-Asteroid-Institute/adam_core@c8f5aae352308ccd97c512c8d8e0a2e17c86ee18#egg=adam_core + adam-core>=0.2.0 + adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main astropy >= 5.3.1 astroquery difi @@ -44,7 +45,7 @@ install_requires = pyarrow >= 14.0.0 pydantic < 2.0.0 pyyaml >= 5.1 - quivr @ git+https://github.com/moeyensj/quivr@concatenate-empty-attributes + quivr == 0.7.3a1 ray[default] scikit-learn scipy @@ -57,6 +58,7 @@ tests = pytest-memray pytest-cov pre-commit + matplotlib dev = ipython diff --git a/thor/main.py b/thor/main.py index f8b13953..bb384abc 100644 --- a/thor/main.py +++ b/thor/main.py @@ -7,7 +7,7 @@ import quivr as qv import ray -from adam_core.propagator import PYOORB +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.ray_cluster import initialize_use_ray from .checkpointing import create_checkpoint_data, load_initial_checkpoint_values diff --git a/thor/orbit.py b/thor/orbit.py index a9a48705..c51ece7b 100644 --- a/thor/orbit.py +++ b/thor/orbit.py @@ -18,7 +18,8 @@ ) from adam_core.observers import Observers from adam_core.orbits import Ephemeris, Orbits -from adam_core.propagator import PYOORB, Propagator +from adam_core.propagator import Propagator +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.ray_cluster import initialize_use_ray from adam_core.time import Timestamp @@ -231,7 +232,6 @@ def generate_ephemeris( observers, max_processes=max_processes, chunk_size=1, - parallel_backend="ray", ) def generate_ephemeris_from_observations( diff --git a/thor/orbit_selection.py b/thor/orbit_selection.py index 7752144a..22bb324d 100644 --- a/thor/orbit_selection.py +++ b/thor/orbit_selection.py @@ -13,7 +13,8 @@ from adam_core.coordinates import KeplerianCoordinates from adam_core.observers import Observers from adam_core.orbits import Ephemeris, Orbits -from adam_core.propagator import PYOORB, Propagator +from adam_core.propagator import Propagator +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.propagator.utils import _iterate_chunks from adam_core.ray_cluster import initialize_use_ray from adam_core.time import Timestamp diff --git a/thor/orbits/attribution.py b/thor/orbits/attribution.py index 87b5a937..b947fe39 100644 --- a/thor/orbits/attribution.py +++ b/thor/orbits/attribution.py @@ -11,7 +11,8 @@ import ray from adam_core.coordinates.residuals import Residuals from adam_core.orbits import Orbits -from adam_core.propagator import PYOORB, Propagator +from adam_core.propagator import Propagator +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.propagator.utils import _iterate_chunk_indices, _iterate_chunks from adam_core.ray_cluster import initialize_use_ray from sklearn.neighbors import BallTree diff --git a/thor/orbits/iod.py b/thor/orbits/iod.py index 9d19efef..581c0c3b 100644 --- a/thor/orbits/iod.py +++ b/thor/orbits/iod.py @@ -12,7 +12,8 @@ import ray from adam_core.coordinates.residuals import Residuals from adam_core.orbit_determination import OrbitDeterminationObservations -from adam_core.propagator import PYOORB, Propagator +from adam_core.propagator import Propagator +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.propagator.utils import _iterate_chunk_indices, _iterate_chunks from adam_core.ray_cluster import initialize_use_ray diff --git a/thor/orbits/od.py b/thor/orbits/od.py index 19991834..4d0d1459 100644 --- a/thor/orbits/od.py +++ b/thor/orbits/od.py @@ -12,7 +12,8 @@ from adam_core.coordinates.residuals import Residuals from adam_core.orbit_determination import OrbitDeterminationObservations from adam_core.orbits import Orbits -from adam_core.propagator import PYOORB, Propagator, _iterate_chunks +from adam_core.propagator import Propagator, _iterate_chunks +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.propagator.utils import _iterate_chunk_indices from adam_core.ray_cluster import initialize_use_ray from scipy.linalg import solve diff --git a/thor/orbits/state_transition.py b/thor/orbits/state_transition.py index d4df5e20..e83dea4e 100644 --- a/thor/orbits/state_transition.py +++ b/thor/orbits/state_transition.py @@ -1,6 +1,9 @@ import numpy as np -from adam_core import dynamics from adam_core.constants import Constants as c +from adam_core.dynamics.lagrange import ( + apply_lagrange_coefficients, + calc_lagrange_coefficients, +) __all__ = ["calcMMatrix", "calcStateTransitionMatrix"] @@ -152,11 +155,11 @@ def calcStateTransitionMatrix( # Here alpha is defined as 1 / a where a is the semi-major axis of the orbit alpha = -(v0_mag**2) / mu + 2 / r0_mag - lagrange_coeffs, stumpff_coeffs, chi = dynamics.calc_lagrange_coefficients( + lagrange_coeffs, stumpff_coeffs, chi = calc_lagrange_coefficients( r0, v0, dt, mu=mu, max_iter=max_iter, tol=tol ) f, g, f_dot, g_dot = lagrange_coeffs - r1, v1 = dynamics.apply_lagrange_coefficients(r0, v0, *lagrange_coeffs) + r1, v1 = apply_lagrange_coefficients(r0, v0, *lagrange_coeffs) M = calcMMatrix(r0, r1, lagrange_coeffs, stumpff_coeffs, chi, alpha, mu=mu) # Construct the 3 x 2 state matrices with the position vector diff --git a/thor/range_and_transform.py b/thor/range_and_transform.py index 903fdc31..d82bf557 100644 --- a/thor/range_and_transform.py +++ b/thor/range_and_transform.py @@ -10,7 +10,8 @@ OriginCodes, transform_coordinates, ) -from adam_core.propagator import PYOORB, Propagator +from adam_core.propagator import Propagator +from adam_core.propagator.adam_pyoorb import PYOORBPropagator as PYOORB from adam_core.ray_cluster import initialize_use_ray from .observations.observations import Observations diff --git a/thor/tests/memory/test_memory.py b/thor/tests/memory/test_memory.py index c9b58d49..d7713132 100644 --- a/thor/tests/memory/test_memory.py +++ b/thor/tests/memory/test_memory.py @@ -15,6 +15,7 @@ open .cache.bench/memory/[session_name]/[test_name].png """ + import os import subprocess import threading