A BOA is a Binary Object Archive. It contains all data needed to perform a given analysis. In the example below, we show how to create a BOA containing the planetary ephemeris DE430 (available in the built-in datasets) and use it to perform a simple trajectory query.
"""simple_boa.py
Create a BOA and make a simple trajectory query.
(C) 2019 Nabla Zero Labs
License: CC BY-NC 3.0 US
"""
# Python Standard Library
from __future__ import print_function
# Monte Library
import Monte
import mpy.io.data
from mpy.units import * # safe to perform global import
# Populate the BOA with a standard dataset.
boa = mpy.io.data.load(["ephem/planet/de430"])
# TrajQuery needs a BOA from which to extract the ephemerides information.
tq = Monte.TrajQuery(boa, "Earth", "Sun", "EME2000")
# A handy way to create a range of epochs
tbeg = Monte.Epoch("01-Jan-2019 ET")
tend = Monte.Epoch("01-Jan-2020 ET")
step = 1 * day
epochs = Monte.Epoch.range(tbeg, tend, step) # tend non-inclusive
# Query the trajectory at every epoch
for epoch in epochs:
state = tq.state(epoch)
print(state)
We run this code as follows:
[nablazerolabs] $ mpython_qx simple_boa.py
State (km, km/sec)
'Sun' -> 'Earth' in 'EME2000' at '01-JAN-2019 00:00:00.0000 ET'
Pos: -2.554468314682186e+07 1.329150198916907e+08 5.761816982461654e+07
Vel: -2.982969883066936e+01 -4.841115434019356e+00 -2.098250491119448e+00
State (km, km/sec)
'Sun' -> 'Earth' in 'EME2000' at '02-JAN-2019 00:00:00.0000 ET'
Pos: -2.811794338204937e+07 1.324760011986878e+08 5.742789894254433e+07
Vel: -2.973488093351498e+01 -5.321148010513205e+00 -2.306083417088784e+00
# ... several lines ommitted ...
State (km, km/sec)
'Sun' -> 'Earth' in 'EME2000' at '31-DEC-2019 00:00:00.0000 ET'
Pos: -2.230217984516285e+07 1.334059875501698e+08 5.783176887231200e+07
Vel: -2.993634926967126e+01 -4.256061003468907e+00 -1.844219374879210e+00