aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hoffmann <volker@cheleb.net>2016-05-15 08:12:15 +0200
committerVolker Hoffmann <volker@cheleb.net>2016-05-15 17:48:13 +0200
commitfe227c402ce7f91d86fbf52b11517bbe2e004e23 (patch)
tree55c2f13350b102ea8aab973163f5a6eda8ad252c
parentdd5d567f3a1d75757a7faaa54da6e81f480b64e6 (diff)
fix: update string formatter for planet ICs
-rw-r--r--Helpers/ic_helpers.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Helpers/ic_helpers.py b/Helpers/ic_helpers.py
index 517d839..fdeb6db 100644
--- a/Helpers/ic_helpers.py
+++ b/Helpers/ic_helpers.py
@@ -58,7 +58,13 @@ def Solar2(epoch='2014-01-01'):
# Fix velocity units.
# Fix format for time, particle ID.
for iplanet, planet in enumerate(plist):
+ # Extract Mass, Radius, State Vector
line = planet.strip().split()
+ mass = float(line[2])
+ radius = float(line[3])
+ x = float(line[4])
+ y = float(line[5])
+ z = float(line[6])
vx = float(line[7])
vy = float(line[8])
vz = float(line[9])
@@ -69,8 +75,8 @@ def Solar2(epoch='2014-01-01'):
vz *= 365.25/C.twopi
# t i m r x y z vx vy vz Sx Sy Sz
# 0 1 2 3 4 5 6 7 8 9 10 11 12
- line_new = "0.0 %06d %s %s " % (int(line[1]), line[2], line[3])
- line_new += "%s %s %s " % (line[4], line[5], line[6])
+ line_new = "0.0 %06d %.16e %.16e " % (int(line[1]), mass, radius)
+ line_new += "%+.16e %+.16e %+.16e " % (x, y, z)
line_new += "%+.16e %+.16e %+.16e " % (vx, vy, vz)
line_new += "0.0 0.0 0.0"
# Reinsert