From ff9257bb12c0f7a81702bd1b5ea5fba012d81c5b Mon Sep 17 00:00:00 2001 From: Joachim Moeyens Date: Thu, 23 May 2024 12:24:36 -0700 Subject: [PATCH 01/10] Upgrade quivr to 0.7.3a1 --- requirements.txt | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index dba91178..7f70e338 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 +quivr == 0.7.3a1 astropy >= 5.3.1 astroquery difi diff --git a/setup.cfg b/setup.cfg index 64dab1d6..a2c9a181 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,7 +44,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 From 5f4e1f4a7f3ee51e8fb5e9e60b5d3cf1a4380f29 Mon Sep 17 00:00:00 2001 From: Joachim Moeyens Date: Thu, 23 May 2024 14:23:58 -0700 Subject: [PATCH 02/10] Upgrade adam_core --- .github/workflows/conda-build-lint-test.yml | 4 ---- setup.cfg | 3 ++- thor/main.py | 2 +- thor/orbit.py | 4 ++-- thor/orbit_selection.py | 3 ++- thor/orbits/attribution.py | 3 ++- thor/orbits/iod.py | 3 ++- thor/orbits/od.py | 3 ++- thor/orbits/state_transition.py | 9 ++++++--- thor/range_and_transform.py | 3 ++- 10 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/conda-build-lint-test.yml b/.github/workflows/conda-build-lint-test.yml index 616af9a3..fa6622cd 100644 --- a/.github/workflows/conda-build-lint-test.yml +++ b/.github/workflows/conda-build-lint-test.yml @@ -39,10 +39,6 @@ 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 - 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 - name: Build and install run: pip install . --no-deps - name: Lint diff --git a/setup.cfg b/setup.cfg index a2c9a181..fd2e35ab 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 @ git+https://github.com/B612-Asteroid-Institute/adam_core@ak/remove-pyoorb#egg=adam_core + adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main#egg=adam_core astropy >= 5.3.1 astroquery difi 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 From 577d707c02d6d68a6f7521e5341d0f2fcd17c60b Mon Sep 17 00:00:00 2001 From: Nate Tellis Date: Tue, 28 May 2024 13:05:31 -0400 Subject: [PATCH 03/10] update adam core ver --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index fd2e35ab..e5770466 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ setup_requires = wheel setuptools_scm >= 6.0 install_requires = - adam-core @ git+https://github.com/B612-Asteroid-Institute/adam_core@ak/remove-pyoorb#egg=adam_core + adam-core @ git+https://git@github.com/B612-Asteroid-Institute/adam_core@058891a2156274d971046bc337cad07c02412c5f#egg=adam_core adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main#egg=adam_core astropy >= 5.3.1 astroquery From 857b808be575323b5954f67ea304149f27b7ef2c Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Wed, 29 May 2024 15:34:49 -0400 Subject: [PATCH 04/10] point to pypi version of adam-core --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index e5770466..f3d8ca3a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ setup_requires = wheel setuptools_scm >= 6.0 install_requires = - adam-core @ git+https://git@github.com/B612-Asteroid-Institute/adam_core@058891a2156274d971046bc337cad07c02412c5f#egg=adam_core + adam-core>=0.2.0 adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main#egg=adam_core astropy >= 5.3.1 astroquery From 311f606f09dea3631dc635fb476eca68782942ec Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Thu, 30 May 2024 14:55:23 -0400 Subject: [PATCH 05/10] add matplotlib to test dependencies --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index f3d8ca3a..ad118c41 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,6 +58,7 @@ tests = pytest-memray pytest-cov pre-commit + matplotlib dev = ipython From 6a532c87368a2f3398ab3954746d9c295ff76064 Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Thu, 30 May 2024 15:12:32 -0400 Subject: [PATCH 06/10] attempt to fix conda build --- .github/workflows/conda-build-lint-test.yml | 4 ++++ requirements.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conda-build-lint-test.yml b/.github/workflows/conda-build-lint-test.yml index fa6622cd..27636ed1 100644 --- a/.github/workflows/conda-build-lint-test.yml +++ b/.github/workflows/conda-build-lint-test.yml @@ -39,6 +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 adam-pyoorb + run: | + pip install adam-core>=0.2.0 + pip install adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main - name: Build and install run: pip install . --no-deps - name: Lint diff --git a/requirements.txt b/requirements.txt index 7f70e338..ca529523 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -adam-core @ git+https://github.com/B612-Asteroid-Institute/adam_core@ef8ee48976dbf9c70580c166de4cc4fd6195fa36 +adam-core >= 0.2.0 quivr == 0.7.3a1 astropy >= 5.3.1 astroquery From 9bab21c4cebf2f4d614804c47100bc36dd08e8c6 Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Thu, 30 May 2024 15:15:21 -0400 Subject: [PATCH 07/10] fix formatting of pip install --- .github/workflows/conda-build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-build-lint-test.yml b/.github/workflows/conda-build-lint-test.yml index 27636ed1..369a5525 100644 --- a/.github/workflows/conda-build-lint-test.yml +++ b/.github/workflows/conda-build-lint-test.yml @@ -42,7 +42,7 @@ jobs: - name: Install adam_core and adam-pyoorb run: | pip install adam-core>=0.2.0 - pip install adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main + 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 From 5d877f8581869253c9024be7cc775a58cd6229d0 Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Thu, 30 May 2024 15:57:40 -0400 Subject: [PATCH 08/10] not sure why benchmark failing --- pyproject.toml | 8 ++++++++ setup.cfg | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 90ba84a4..089c1ada 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." \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index ad118c41..183a46a9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ setup_requires = setuptools_scm >= 6.0 install_requires = adam-core>=0.2.0 - adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main#egg=adam_core + adam-pyoorb @ git+https://github.com/B612-Asteroid-Institute/adam-pyoorb@main astropy >= 5.3.1 astroquery difi From 8308c3a35af62435e5449c9b049680f8b2c6690a Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Thu, 30 May 2024 16:03:15 -0400 Subject: [PATCH 09/10] formatting --- thor/config.py | 6 +++--- thor/tests/memory/test_memory.py | 1 + thor/tests/test_main.py | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/thor/config.py b/thor/config.py index f6e53fdc..3b0c1c52 100644 --- a/thor/config.py +++ b/thor/config.py @@ -27,9 +27,9 @@ class Config(BaseModel): iod_min_arc_length: float = 1.0 iod_contamination_percentage: float = 20.0 iod_rchi2_threshold: float = 100000 - iod_observation_selection_method: Literal[ - "combinations", "first+middle+last" - ] = "combinations" + iod_observation_selection_method: Literal["combinations", "first+middle+last"] = ( + "combinations" + ) iod_chunk_size: int = 10 od_min_obs: int = 6 od_min_arc_length: float = 1.0 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 diff --git a/thor/tests/test_main.py b/thor/tests/test_main.py index 33c5ade4..d6316c08 100644 --- a/thor/tests/test_main.py +++ b/thor/tests/test_main.py @@ -237,7 +237,12 @@ def run_link_test_orbit(test_orbit, observations, config): @pytest.mark.parametrize("integration_config", [1, 4], indirect=True) @pytest.mark.integration def test_link_test_orbit(object_id, orbits, observations, integration_config): - (test_orbit, observations, obs_ids_expected, integration_config,) = setup_test_data( + ( + test_orbit, + observations, + obs_ids_expected, + integration_config, + ) = setup_test_data( object_id, orbits, observations, integration_config, max_arc_length=14 ) @@ -260,7 +265,12 @@ def test_benchmark_link_test_orbit( ): object_id = "202930 Ivezic (1998 SG172)" - (test_orbit, observations, obs_ids_expected, integration_config,) = setup_test_data( + ( + test_orbit, + observations, + obs_ids_expected, + integration_config, + ) = setup_test_data( object_id, orbits, observations, integration_config, max_arc_length=14 ) From 91a5e653984fadf19cdcbdc7192fc8ff98729a3c Mon Sep 17 00:00:00 2001 From: Alec Koumjian Date: Thu, 30 May 2024 16:07:59 -0400 Subject: [PATCH 10/10] formatting again --- pyproject.toml | 2 +- thor/config.py | 6 +++--- thor/tests/test_main.py | 14 ++------------ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 089c1ada..149b7be7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,4 +12,4 @@ 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." \ No newline at end of file +memory = "Mark a test as a memory test." diff --git a/thor/config.py b/thor/config.py index 3b0c1c52..f6e53fdc 100644 --- a/thor/config.py +++ b/thor/config.py @@ -27,9 +27,9 @@ class Config(BaseModel): iod_min_arc_length: float = 1.0 iod_contamination_percentage: float = 20.0 iod_rchi2_threshold: float = 100000 - iod_observation_selection_method: Literal["combinations", "first+middle+last"] = ( - "combinations" - ) + iod_observation_selection_method: Literal[ + "combinations", "first+middle+last" + ] = "combinations" iod_chunk_size: int = 10 od_min_obs: int = 6 od_min_arc_length: float = 1.0 diff --git a/thor/tests/test_main.py b/thor/tests/test_main.py index d6316c08..33c5ade4 100644 --- a/thor/tests/test_main.py +++ b/thor/tests/test_main.py @@ -237,12 +237,7 @@ def run_link_test_orbit(test_orbit, observations, config): @pytest.mark.parametrize("integration_config", [1, 4], indirect=True) @pytest.mark.integration def test_link_test_orbit(object_id, orbits, observations, integration_config): - ( - test_orbit, - observations, - obs_ids_expected, - integration_config, - ) = setup_test_data( + (test_orbit, observations, obs_ids_expected, integration_config,) = setup_test_data( object_id, orbits, observations, integration_config, max_arc_length=14 ) @@ -265,12 +260,7 @@ def test_benchmark_link_test_orbit( ): object_id = "202930 Ivezic (1998 SG172)" - ( - test_orbit, - observations, - obs_ids_expected, - integration_config, - ) = setup_test_data( + (test_orbit, observations, obs_ids_expected, integration_config,) = setup_test_data( object_id, orbits, observations, integration_config, max_arc_length=14 )