aboutsummaryrefslogtreecommitdiffstats
path: root/ReduceH5
diff options
context:
space:
mode:
authorVolker Hoffmann <volker@cheleb.net>2014-11-26 19:08:39 +0100
committerVolker Hoffmann <volker@cheleb.net>2014-11-26 19:08:39 +0100
commit945c36b3e2c7cb5cc61a0900ce06208b78756718 (patch)
tree7979f52fe6fa7bec2a18f6246be86fb23e62433d /ReduceH5
parentb477f8642b68a1f129d055c720148cf1455bf970 (diff)
option to use barycentric coordinates in reduction
Diffstat (limited to 'ReduceH5')
-rw-r--r--ReduceH5/reduce_genga.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/ReduceH5/reduce_genga.py b/ReduceH5/reduce_genga.py
index 22e7df0..d62c62f 100644
--- a/ReduceH5/reduce_genga.py
+++ b/ReduceH5/reduce_genga.py
@@ -20,11 +20,22 @@ group1.add_argument('--all', action='store_true', \
help="Reduce Full Set of Snapshots.")
group1.add_argument('--custom', type=int, nargs='+', \
help="Plot Custom Snapshot.")
+group2 = parser.add_mutually_exclusive_group(required=True)
+group2.add_argument('--heliocentric', action='store_true', \
+ help="Heliocentric Coordinates.")
+group2.add_argument('--barycentric', action='store_true', \
+ help="Barycentric Coordinates.")
args = parser.parse_args()
# Output Simulation Name
print "// Run Name: %s" % args.run_name
+# Coordinates Info
+if args.heliocentric:
+ print "// Using Heliocentric Coordinates"
+if args.barycentric:
+ print "// Using Barycentric Coordinates"
+
# Ellipse Warning
if args.ellipses:
print ""
@@ -75,6 +86,11 @@ for istep, nstep in enumerate(nsteps):
vy = genga[:,8].astype("float64")
vz = genga[:,9].astype("float64")
+ if args.barycentric:
+ x, vx = kh.helio2bary(x, vx, m)
+ y, vy = kh.helio2bary(y, vy, m)
+ z, vz = kh.helio2bary(z, vz, m)
+
# Compute Keplerian Elements
a, e, i, Omega, omega, M0 = \
kh.cart2kepX(x, y, z, vx, vy, vz, m, central_mass=1.0)
@@ -105,6 +121,10 @@ for istep, nstep in enumerate(nsteps):
f5.attrs["tout"] = tout[0]
f5.attrs["tout_units"] = "yr"
f5.attrs["run_name"] = args.run_name
+ if args.heliocentric:
+ f5.attrs["coordinate_frame"] = "heliocentric"
+ if args.barycentric:
+ f5.attrs["coordinate_frame"] = "barycentric"
# Compute Ellipses?
# @todo - Write vectorized version?