From 965ca493e9d3ace4ab13c59301b53330aaeac27f Mon Sep 17 00:00:00 2001 From: Tristan Date: Sun, 5 Nov 2023 22:43:45 +0100 Subject: [PATCH] MPC + SBDB, small fixes --- tudatpy/data/mpc.py | 15 ++++++++++----- tudatpy/data/sbdb.py | 7 ++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tudatpy/data/mpc.py b/tudatpy/data/mpc.py index 7be611b7..ef70e8ca 100644 --- a/tudatpy/data/mpc.py +++ b/tudatpy/data/mpc.py @@ -46,8 +46,7 @@ class BatchMPC: """ def __init__(self) -> None: - """Create an empty MPC batch. - """ + """Create an empty MPC batch.""" self._table: pd.DataFrame = pd.DataFrame() self._observatories: List[str] = [] self._space_telescopes: List[str] = [] @@ -504,7 +503,7 @@ def to_tudat( + "set the station_body paramater to the new name." ) raise e - + # Add positions of the observatories self._add_observatory_positions(bodies, station_body) @@ -823,7 +822,8 @@ def summary(self): def observatories_table( self, only_in_batch: bool = True, - only_space_telescopes=False, + only_space_telescopes: bool = False, + exclude_space_telescopes: bool = False, include_positions: bool = False, ) -> pd.DataFrame: """Returns a pandas DataFrame with information about all MPC observatories, @@ -835,8 +835,11 @@ def observatories_table( Filter out observatories that are not in the batch, by default True only_space_telescopes : bool, optional Filter out all observatories except space telescopes, by default False + only_space_telescopes : bool, optional + Filter out all space telescopes, by default False include_positions : bool, optional - Include cartesian positions of the terrestrial telescopes, by default False + Include cartesian positions of the terrestrial telescopes only available + after running to_tudat(), by default False Returns ------- @@ -865,6 +868,8 @@ def observatories_table( temp = temp.query("Code == @self.observatories") if only_space_telescopes: temp = temp.query("Code == @self._MPC_space_telescopes") + if exclude_space_telescopes: + temp = temp.query("Code != @self._MPC_space_telescopes") if not include_positions: temp = temp.loc[:, ["Code", "Name", "count"]] return temp diff --git a/tudatpy/data/sbdb.py b/tudatpy/data/sbdb.py index 3edb610b..a54c2eff 100644 --- a/tudatpy/data/sbdb.py +++ b/tudatpy/data/sbdb.py @@ -36,7 +36,12 @@ def spkid(self): @property def codes_300_spkid(self): - """Returns spice kernel number for the codes_300ast_20100725.bsp spice kernel""" + """Returns spice kernel number for the codes_300ast_20100725.bsp spice kernel. + + Some Objects may return a name instead of a number. + These are objects specifically specified by name in the codes_300ast_20100725.bsp kernel. + + See https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/asteroids/aa_summaries.txt for a list of exceptions""" spkid = self.spkid[0] + self.spkid[2:] if spkid == "2000001": return "Ceres"