Skip to content

Commit

Permalink
Ensure some time scales and coordinate origins are correct
Browse files Browse the repository at this point in the history
  • Loading branch information
akoumjian committed Dec 10, 2024
1 parent 3d2a90d commit 234f063
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/adam_core/dynamics/propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def propagate_2body(
else:
cartesian_covariances = None

origin_code = np.empty(n_orbits * n_times, dtype="object")
origin_code.fill("SUN")
origin_code = np.repeat(
orbits.coordinates.origin.code.to_numpy(zero_copy_only=False), n_times
)

# Convert from the jax array to a numpy array
orbits_propagated = np.asarray(orbits_propagated)
Expand Down
10 changes: 8 additions & 2 deletions src/adam_core/propagator/propagator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from abc import ABC, abstractmethod
from typing import List, Literal, Optional, Type, Union
from typing import List, Literal, Optional, Tuple, Type, Union

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -103,7 +103,7 @@ def _add_light_time(
observers,
lt_tol: float = 1e-12,
max_iter: int = 10,
):
) -> Tuple[Orbits, np.ndarray]:
orbits_aberrated = Orbits.empty()
lts = np.zeros(len(orbits))
for i, (orbit, observer) in enumerate(zip(orbits, observers)):
Expand Down Expand Up @@ -574,6 +574,12 @@ def propagate_orbits(
if propagated_variants is not None:
propagated = propagated_variants.collapse(propagated)

# Preserve the time scale of the requested times
propagated = propagated.set_column(
"coordinates.time",
propagated.coordinates.time.rescale(times.scale),
)

# Return the results with the original origin and frame
# Preserve the original output origin for the input orbits
# by orbit id
Expand Down

0 comments on commit 234f063

Please sign in to comment.