Skip to content

Commit

Permalink
Change to FittedOrbits and FittedOrbitMembers to match adam_core's cl…
Browse files Browse the repository at this point in the history
…ass definitions
  • Loading branch information
moeyensj committed Jan 30, 2024
1 parent 5a12825 commit b5ee5be
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion thor/orbit_determination/fitted_orbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def drop_duplicate_orbits(
return filtered, filtered_orbit_members


# FittedOrbits and FittedOrbit members currently match
# the schema of adam_core.orbit_determination's FittedOrbits and FittedOrbitMembers
class FittedOrbits(qv.Table):

orbit_id = qv.LargeStringColumn(default=lambda: uuid.uuid4().hex)
Expand All @@ -143,7 +145,9 @@ class FittedOrbits(qv.Table):
num_obs = qv.Int64Column()
chi2 = qv.Float64Column()
reduced_chi2 = qv.Float64Column()
improved = qv.BooleanColumn(nullable=True)
iterations = qv.Int64Column(nullable=True)
success = qv.BooleanColumn(nullable=True)
status_code = qv.Int64Column(nullable=True)

def to_orbits(self) -> Orbits:
"""
Expand Down
4 changes: 3 additions & 1 deletion thor/orbit_determination/tests/test_fitted_orbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def simple_orbits():
num_obs=[10, 20, 15, 25, 5], # Specific values
chi2=np.random.rand(5),
reduced_chi2=[0.5, 0.4, 0.3, 0.2, 0.1], # Specific values
improved=pa.repeat(False, 5),
iterations=[100, 200, 300, 400, 500], # Specific values
success=[True, True, True, True, True], # Specific values
status_code=[1, 1, 1, 1, 1], # Specific values
)


Expand Down
2 changes: 1 addition & 1 deletion thor/orbits/attribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def merge_and_extend_orbits(
# Remove the orbits that were not improved from the pool of available orbits. Orbits that were not improved
# are orbits that have already iterated to their best-fit solution given the observations available. These orbits
# are unlikely to recover more observations in subsequent iterations and so can be saved for output.
not_improved_mask = pc.equal(orbits.improved, False)
not_improved_mask = pc.equal(orbits.success, False)
orbits_out = orbits.apply_mask(not_improved_mask)
orbit_members_out = orbit_members.apply_mask(
pc.is_in(orbit_members.orbit_id, orbits_out.orbit_id)
Expand Down
9 changes: 4 additions & 5 deletions thor/orbits/od.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from ..orbit_determination.outliers import calculate_max_outliers

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

__all__ = ["differential_correction"]

Expand Down Expand Up @@ -558,13 +559,11 @@ def od(
num_obs=[num_obs],
chi2=[chi2_total_prev],
reduced_chi2=[rchi2_prev],
improved=[improved],
iterations=[iterations],
success=[improved],
status_code=[0],
)

# od_orbit["num_params"] = num_params
# od_orbit["num_iterations"] = iterations
# od_orbit["improved"] = improved

od_orbit_members = FittedOrbitMembers.from_kwargs(
orbit_id=np.full(
len(obs_ids_all), orbit_prev.orbit_id[0].as_py(), dtype="object"
Expand Down

0 comments on commit b5ee5be

Please sign in to comment.