Skip to content

Commit

Permalink
Make orbit IDs default as UUIDs (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
moeyensj authored Aug 10, 2023
1 parent 2ee365b commit e04b7bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 5 additions & 4 deletions adam_core/orbits/orbits.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import logging
import uuid
from typing import Literal

import pandas as pd
from quivr import StringColumn, Table
import quivr as qv

from ..coordinates.cartesian import CartesianCoordinates

logger = logging.getLogger(__name__)


class Orbits(Table):
class Orbits(qv.Table):

orbit_id = StringColumn(nullable=True)
object_id = StringColumn(nullable=True)
orbit_id = qv.StringColumn(default=lambda: uuid.uuid4().hex)
object_id = qv.StringColumn(nullable=True)
coordinates = CartesianCoordinates.as_column()

def to_dataframe(self, sigmas: bool = False, covariances: bool = True):
Expand Down
4 changes: 1 addition & 3 deletions adam_core/propagator/tests/test_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ def _propagate_orbits(self, orbits: Orbits, times: Time) -> Orbits:
all_times = []
for t in times:
repeated_time = Time([t] * len(orbits))
orbits.coordinates.time = coordinates.Times.from_astropy(
repeated_time
)
orbits.coordinates.time = coordinates.Times.from_astropy(repeated_time)
all_times.append(orbits)

return quivr.concatenate(all_times)
Expand Down

0 comments on commit e04b7bd

Please sign in to comment.