From 86122b1fc23ca173153ceaa7af50eba76b6199ac Mon Sep 17 00:00:00 2001 From: David Minton Date: Sun, 25 Feb 2024 11:07:22 -0500 Subject: [PATCH] Phobos and Deimos mass is reported in a very strange way in JPL Horizons output. I added a new set of parsing instructions for this style of output. --- swiftest/init_cond.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/swiftest/init_cond.py b/swiftest/init_cond.py index ef19dbfde..72d33d3ab 100644 --- a/swiftest/init_cond.py +++ b/swiftest/init_cond.py @@ -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: