Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Phobos and Deimos mass is reported in a very strange way in JPL Horiz…
Browse files Browse the repository at this point in the history
…ons output. I added a new set of parsing instructions for this style of output.
  • Loading branch information
daminton committed Feb 25, 2024
1 parent 6a45db8 commit 86122b1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions swiftest/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ def get_Gmass(raw_response):
and 'GMT' not in s
and 'ANGMOM' not in s]
if len(GM) == 0:
# Try an alternative name for the Mass found in some satellite queries
M = [s for s in raw_response.split('\n') if 'Mass' in s]
if len(M) > 0:
M = M[0].split('Mass')[-1].strip()
if 'kg' in M:
unit_conv_str = M.split('kg')[0].strip()
unit_conv_str = unit_conv_str.split('^')[1].strip()
unit_conv = 10**int(unit_conv_str)
mult = M.split('=')[1].strip().split(' ')[1].strip('()')
mult = 10**int(mult.split('^')[1].strip())
M = M.split('=')[1].strip().split(' ')[0].strip()
M = float(M) * mult * unit_conv
try:
return M * swiftest.GC
except:
return None
return None
GM = GM[0]
if len(GM) > 1:
Expand Down

0 comments on commit 86122b1

Please sign in to comment.