Multiprocessing Example

In this example we will use Python Multiprocessing to perform several propagations in parallel.

First perform all necessary imports:

In [1]:
%matplotlib inline
from godot.core import tempo, util
from godot.model import common, geometry
from godot import cosmos
import numpy as np
import multiprocessing as mp
from dataclasses import dataclass

# avoid verbose output
util.suppressLogger()

Now we will prepare a function to be called in several processess.

First define a special output dataclass for this function:

In [2]:
@dataclass
class PropagationCase:
    id: str
    epoch0:tempo.Epoch
    state0: np.ndarray
    area: float
    mass: float
    cd: float
    epoch1:tempo.Epoch
    state1: np.ndarray

Our function takes the universe configuration as input and constructs a new universe for each process.

Then it constructs a Ballistic Propagator and adds an interrupt event in case the spacecraft altitude drops below a certain value.

Note that in the universe file we created several constants sc_mass, sc_area and sc_cd with nominally zero values. These values are overwritten in each local process with values passed as arguments.

In [3]:
def prop(uni_cfg, max_duration, dyn, case):

    print(f"Performing Propagation {case.id}")

    # ccreate universe
    uni = cosmos.Universe(uni_cfg)

    # reset values of sc parameters
    uni.evaluables.get('sc_area').set(case.area)
    uni.evaluables.get('sc_mass').set(case.mass)
    uni.evaluables.get('sc_cd').set(case.cd)

    # reference date for propagation
    ref = tempo.Epoch('2020-01-01T00:00:00 TDB')

    # construct propagator
    pro = cosmos.BallisticPropagator(
        uni,
        'sc',
        dyn,
        ref,
        "Earth",
        1e-9
    )

    # add event for atmosphere entry at 6538 km radius (~160 km radius)
    pro.addEvent(
        common.InterruptEvent(
            common.ValueTrigger(
                geometry.Range(uni.frames, 'Earth', 'sc'),
                common.ConstantScalarTimeEvaluable(6538))))
    # perform propagation
    pro.compute(
        case.state0,
        case.epoch0 - ref,
        case.epoch0 + max_duration)
    # return final epoch and state in icrf and itrf with input values
    case.epoch1 = pro.range().end()
    case.state1 = uni.frames.vector6('Earth', 'sc', 'ICRF', pro.range().end())
    return case

We read the universe file, set the dynamics to use and then define the data for a number of cases to propagate:

In [4]:
# read universe file
config_uni = cosmos.util.load_yaml('universe.yml')

# define dynamics to use
dyn = 'dynamics'

# define some cases to propagate

e0 = tempo.Epoch('2020-01-12T00:00:00.00 TDB')
x0 = np.array([7200.0, 200.0, 35.0, 0.0, 2.0, 7.8])
cd0 = 1.5
mass0 = 10.0
area0 = 1.0

cases = []
for i in range(200):
    x = x0
    x[:3] += np.random.normal(0.0, 1e-1, (3))
    x[3:] += np.random.normal(0.0, 1e-4, (3))
    cd = np.maximum(1.0, cd0 + np.random.normal(0.0, 1.0))
    mass = np.maximum(1.0, mass0 + np.random.normal(0.0, 5.0))
    area = np.maximum(0.1, area0 + np.random.normal(0.0, 0.5))
    cases.append(
        PropagationCase(
            i, e0, x, area, mass, cd, None, None
        )
    )

# set the maximum duration to 4 days
max_duration = 4*tempo.SecondsInDay

Now we use the Python multiprocessing package to propagate the cases 4 at a time (assuming you have the resouces available):

In [5]:
npool = 4
pool = mp.Pool(processes=npool)
output = [
    pool.apply_async(
        prop,
        args=(config_uni, max_duration, dyn, case)
        )
    for case in cases
]
Performing Propagation 1Performing Propagation 2
Performing Propagation 3Performing Propagation 0

Finally we can print out the results

In [6]:
results = [p.get() for p in output]
for res in results:
    print(f"{res.id} {res.epoch1} {res.state1[:3]}")
0 2020-01-12T22:36:45.116389 TDB [2503.98660434 1598.02181712 5824.24427349]
1 2020-01-12T12:15:28.075973 TDB [6109.69817757  803.47729658 2184.36636417]
2 2020-01-14T14:04:29.358398 TDB [-1254.59364678 -1619.07394056 -6208.8677194 ]
3 2020-01-14T14:27:03.805468 TDB [ 5582.67157903  -945.83021166 -3268.73480897]
4 2020-01-12T08:23:04.755364 TDB [4670.21433745 1366.42508655 4366.62621775]
5 2020-01-14T07:48:18.220783 TDB [-4987.36179285 -1032.97740081 -4099.34434232]
6 2020-01-12T04:30:46.666398 TDB [2190.41775005 1678.55648746 5927.05341623]
7 2020-01-12T08:32:42.658868 TDB [1852.83325145 1681.6100526  6040.25169783]
8 2020-01-12T18:30:05.145780 TDB [3806.54245221 1461.9436648  5110.61633077]
9 2020-01-13T22:22:21.123110 TDB [ 6440.70957033  -284.75953453 -1087.02171746]
10 2020-01-13T11:16:42.649241 TDB [-6137.73092672   522.05973617  2191.15419428]
11 2020-01-13T00:19:50.690369 TDB [6199.79045633  655.97155497 1969.19872451]
12 2020-01-12T02:44:14.915745 TDB [-2625.60383256  1431.10606323  5814.08496242]
13 2020-01-12T04:06:57.579848 TDB [6526.66409366  331.38349539 -195.66498808]
14 2020-01-12T09:03:34.638584 TDB [-6448.55233215    23.38062801  1077.52965882]
15 2020-01-13T06:31:31.028422 TDB [5231.28661084 1079.75362152 3770.04197752]
16 2020-01-12T14:27:31.786003 TDB [4082.32769505 1441.1771447  4899.29107402]
17 2020-01-14T06:05:18.757237 TDB [ 1411.25827664 -1630.41005459 -6172.15984329]
18 2020-01-12T17:29:23.611046 TDB [-2855.77676722 -1566.81891872 -5668.77954516]
19 2020-01-13T11:55:19.149551 TDB [ 1895.3975207  -1579.42520271 -6054.61214839]
20 2020-01-12T15:10:11.571332 TDB [-6528.18665076  -269.17028875  -236.15759248]
21 2020-01-13T20:46:42.785269 TDB [3450.97245515 1425.5700536  5366.93423992]
22 2020-01-16T00:00:00.000000 TDB [ 5731.43341853 -1331.90036879 -4224.61545043]
23 2020-01-13T14:33:36.079346 TDB [5666.67095898  874.43820572 3141.59864834]
24 2020-01-14T00:09:49.531544 TDB [ 4332.08572656 -1259.79863355 -4731.95357766]
25 2020-01-13T10:31:46.914782 TDB [5645.6324618   904.84556454 3170.7306115 ]
26 2020-01-12T20:34:31.969503 TDB [2831.13326659 1574.25037175 5679.07247658]
27 2020-01-12T15:29:04.979099 TDB [-2631.11876378 -1594.42690883 -5768.92198622]
28 2020-01-13T05:26:22.696046 TDB [-5794.40815374  -849.01384817 -2906.79439132]
29 2020-01-13T02:17:33.181743 TDB [6453.465991    386.07857772  974.250499  ]
30 2020-01-12T11:31:43.469645 TDB [ -987.94144263 -1679.55112015 -6240.87523836]
31 2020-01-16T00:00:00.000000 TDB [7186.35138767 -303.60991141  -95.26742091]
32 2020-01-12T17:12:34.350877 TDB [-6482.08341065  -388.38740909  -759.7327706 ]
33 2020-01-12T12:50:58.142010 TDB [-3744.20116276  1275.45372377  5205.72948311]
34 2020-01-12T07:38:34.241478 TDB [ 1942.17396118 -1494.08722804 -6061.44435427]
35 2020-01-12T05:26:47.686183 TDB [-1869.9961773  -1658.84974924 -6041.2561447 ]
36 2020-01-14T13:24:19.603269 TDB [-4144.99800902  1356.29326317  4870.82170582]
37 2020-01-12T12:34:48.783890 TDB [1715.46854083 1681.22893872 6080.79607793]
38 2020-01-12T21:05:48.820307 TDB [-6095.78104786   470.02148993  2316.45790284]
39 2020-01-12T17:57:41.060949 TDB [ 5584.00285417  -718.31769451 -3323.90971812]
40 2020-01-14T15:40:03.328407 TDB [-6511.73139486   238.25467008   534.82048832]
41 2020-01-12T10:24:01.663385 TDB [4594.52262055 1367.68805084 4445.81098171]
42 2020-01-12T08:51:31.845532 TDB [-4485.55728503  1070.41071365  4634.59175625]
43 2020-01-15T02:10:51.250078 TDB [-1249.15115634 -1601.44376888 -6214.53483732]
44 2020-01-12T12:45:43.512852 TDB [-2061.82477911  1557.63168331  6005.67282821]
45 2020-01-12T20:14:14.234237 TDB [6437.65183989  448.49603061 1049.25406624]
46 2020-01-13T03:58:03.674872 TDB [ 4491.04539225 -1146.33484608 -4611.0597161 ]
47 2020-01-15T20:15:52.826004 TDB [-3968.07355141 -1174.34541085 -5061.69429604]
48 2020-01-13T10:51:53.197966 TDB [ 602.1771421  1679.66071504 6289.79861141]
49 2020-01-12T09:36:59.833930 TDB [ 1177.13771089 -1579.09556364 -6234.28007159]
50 2020-01-13T08:19:29.482976 TDB [6531.5549424   151.6656661   247.45013539]
51 2020-01-13T06:41:45.471907 TDB [2841.83678371 1549.5505454  5680.51941301]
52 2020-01-12T05:38:59.266211 TDB [ 2189.59941088 -1465.29497464 -5983.6451313 ]
53 2020-01-13T05:15:02.713176 TDB [-6429.14141949   205.77846398  1170.1452183 ]
54 2020-01-12T12:38:08.488510 TDB [ 587.10035266 1701.8103634  6285.26838433]
55 2020-01-12T21:29:37.271277 TDB [-3438.19637232 -1482.83513721 -5359.61282758]
56 2020-01-13T10:19:02.204946 TDB [ 6.53222638e+03 -1.21687339e+00 -2.74701711e+02]
57 2020-01-13T02:22:18.609149 TDB [6090.49131881  718.8885725  2265.95646822]
58 2020-01-13T20:47:36.813765 TDB [3208.06940612 1461.35297452 5506.19489024]
59 2020-01-16T00:00:00.000000 TDB [3812.14194684 1569.30336836 6660.45959233]
60 2020-01-16T00:00:00.000000 TDB [-8282.20684114  1373.44049102  4029.23786953]
61 2020-01-16T00:00:00.000000 TDB [5145.46186845 1110.0739928  5174.67902915]
62 2020-01-12T16:18:31.473335 TDB [5904.93338841  886.87407446 2662.82933259]
63 2020-01-16T00:00:00.000000 TDB [-5556.67894326  1879.10294618  6325.88728473]
64 2020-01-12T01:20:01.344597 TDB [-5511.80730854 -1320.02957693 -3259.28613499]
65 2020-01-12T10:18:14.493003 TDB [5687.71609988 1036.58608256 3053.00161495]
66 2020-01-12T13:51:30.259056 TDB [ 4764.47058322  -996.71595922 -4364.83921337]
67 2020-01-12T06:03:29.161062 TDB [6483.7205978    93.77174682 -835.47475616]
68 2020-01-13T02:13:00.034487 TDB [6530.30124338   44.48021028 -314.05601672]
69 2020-01-12T06:27:27.960509 TDB [3355.32263879 1590.15761849 5381.32444091]
70 2020-01-13T08:09:08.617474 TDB [ 5942.24939883  -627.18684813 -2653.63010598]
71 2020-01-12T22:16:49.730326 TDB [6345.30682622  544.40716873 1478.56217846]
72 2020-01-12T20:16:06.135732 TDB [6319.75967353  581.69007822 1570.89729828]
73 2020-01-14T05:09:40.174506 TDB [-1679.98796214  1642.03138191  6101.37831875]
74 2020-01-14T05:37:07.011708 TDB [-6454.42708253  -229.02401497 -1016.54465521]
75 2020-01-12T20:16:29.616761 TDB [6289.3326948   609.03704729 1678.93184172]
76 2020-01-12T04:30:14.154745 TDB [2386.30315057 1669.95781042 5853.39578238]
77 2020-01-13T12:14:56.847569 TDB [ 6272.21607337  -420.56348406 -1796.62903134]
78 2020-01-12T06:36:30.072339 TDB [ 227.66119476 1700.4132617  6308.89920033]
79 2020-01-12T01:25:14.580364 TDB [-3994.35352365 -1629.85944534 -4912.65123091]
80 2020-01-12T02:08:46.022735 TDB [ 6372.70024623   161.89366044 -1451.86983384]
81 2020-01-12T06:14:53.895892 TDB [6047.42147634  910.60480612 2311.91184408]
82 2020-01-12T17:07:05.107016 TDB [-6421.36579467   137.34043772  1221.73767033]
83 2020-01-13T19:44:40.881477 TDB [-3256.26199779 -1446.00789445 -5481.90322528]
84 2020-01-12T16:11:44.401590 TDB [6472.49952822  419.97959407  822.07724558]
85 2020-01-16T00:00:00.000000 TDB [ 2634.03404944 -1875.17267372 -6827.40018767]
86 2020-01-13T08:30:32.497079 TDB [5634.30797578  919.85599795 3186.51574244]
87 2020-01-12T10:41:15.971472 TDB [-839.00162239 1663.7590047  6266.85138263]
88 2020-01-12T12:27:13.704723 TDB [3982.22496424 1471.31001595 4972.18012254]
89 2020-01-12T10:33:45.868552 TDB [1783.86337773 1681.88805962 6060.90158346]
90 2020-01-12T15:14:53.464123 TDB [-6194.40581371  -707.36147698 -1968.35473332]
91 2020-01-12T17:52:22.780158 TDB [ 4531.40288963 -1083.09134425 -4586.80117204]
92 2020-01-16T00:00:00.000000 TDB [-205.21961878 2108.65994163 8135.6705019 ]
93 2020-01-16T00:00:00.000000 TDB [-2932.69145412 -1883.4209702  -7737.75093018]
94 2020-01-12T20:48:19.067800 TDB [-1674.11915225  1603.77777607  6113.15515175]
95 2020-01-12T12:56:30.249948 TDB [-5166.1004621    878.43750603  3909.62882684]
96 2020-01-12T16:06:56.723500 TDB [6515.58973208   58.91911895 -537.64578086]
97 2020-01-12T11:59:35.426751 TDB [ 6158.42183521  -356.31864593 -2166.17670598]
98 2020-01-13T08:04:58.957216 TDB [ 5287.71068158  -920.29069665 -3733.44676965]
99 2020-01-12T13:18:30.388913 TDB [-5382.14917383 -1099.2882356  -3545.3461955 ]
100 2020-01-13T17:39:05.317278 TDB [-4664.28662247 -1177.94461348 -4427.45082308]
101 2020-01-12T12:22:46.003515 TDB [5006.32019756 1250.74571095 4014.7026348 ]
102 2020-01-13T05:19:56.927080 TDB [-6505.55537787  -263.24636213  -594.89039186]
103 2020-01-12T02:08:24.741877 TDB [ 6349.34844143   135.17138936 -1553.36636532]
104 2020-01-12T12:43:57.472785 TDB [-1451.15502758  1621.07204548  6165.3644263 ]
105 2020-01-13T04:55:15.333875 TDB [-2059.08680298  1578.60081192  6001.13531041]
106 2020-01-12T22:33:06.780758 TDB [3543.37821563 1483.17837877 5290.56676719]
107 2020-01-12T13:45:50.095198 TDB [ 3334.79046256 -1330.87069109 -5463.82647732]
108 2020-01-12T06:36:07.980968 TDB [ 362.57679078 1701.92230025 6302.1776042 ]
109 2020-01-13T14:30:51.053558 TDB [6028.3352136   690.1009381  2434.82632798]
110 2020-01-12T13:57:58.274992 TDB [ 5887.63280328  -545.66831567 -2789.88710585]
111 2020-01-12T17:55:59.473934 TDB [ 5289.76005898  -839.56658604 -3749.53469993]
112 2020-01-12T06:16:10.710468 TDB [5888.52545569  993.43995577 2661.53884289]
113 2020-01-14T20:32:04.853680 TDB [ 5926.86595968  -810.72112765 -2638.26366181]
114 2020-01-12T20:33:46.522458 TDB [3050.68279137 1551.14368131 5570.70298856]
115 2020-01-12T10:33:28.518246 TDB [1880.32657889 1678.28626555 6032.67529109]
116 2020-01-12T21:46:48.919681 TDB [ 2417.06529122 -1503.2523874  -5885.87050809]
117 2020-01-13T00:20:53.490821 TDB [6095.75374696  726.87137522 2249.19724798]
118 2020-01-12T13:42:14.643300 TDB [ 2251.21604462 -1495.78019985 -5953.15982605]
119 2020-01-12T18:47:30.216801 TDB [-1736.33324189  1594.3120686   6098.25875979]
120 2020-01-13T05:04:18.320087 TDB [-4708.76856008  1102.16597328  4399.79236046]
121 2020-01-12T16:40:17.360169 TDB [ 419.03184858 1701.90026204 6298.68175159]
122 2020-01-12T04:24:26.057397 TDB [4290.20339879 1488.64090688 4703.56748092]
123 2020-01-12T12:12:48.263962 TDB [6340.74040958  623.15698272 1467.01412168]
124 2020-01-12T12:17:28.239894 TDB [5876.44571643  933.32870208 2709.56219262]
125 2020-01-13T07:46:33.397183 TDB [ -131.15879754 -1663.31470214 -6321.52082744]
126 2020-01-12T05:49:21.900843 TDB [ 4823.6768804   -912.54180247 -4317.96859791]
127 2020-01-12T14:23:31.981466 TDB [4982.60648982 1242.55115191 4046.62120819]
128 2020-01-14T13:54:38.225242 TDB [-4507.92072756 -1144.95911187 -4594.9062391 ]
129 2020-01-12T18:46:51.956529 TDB [-1522.78450572  1614.81982415  6149.70960981]
130 2020-01-12T10:46:38.533781 TDB [-2708.63645803  1462.67770884  5767.95513665]
131 2020-01-16T00:00:00.000000 TDB [-6933.4788441   1378.24420474  4050.62603065]
132 2020-01-12T20:12:58.664660 TDB [6491.57333028  355.86227532  691.57915531]
133 2020-01-12T10:24:43.372447 TDB [4431.57055373 1402.20912176 4597.87298718]
134 2020-01-12T06:19:19.452877 TDB [5389.55794951 1191.18734312 3504.166352  ]
135 2020-01-12T08:13:25.980329 TDB [6208.29108138  777.88558746 1896.69709277]
136 2020-01-12T05:51:51.511488 TDB [ 5284.86531599  -742.76076931 -3776.76436009]
137 2020-01-12T07:02:30.148728 TDB [-6435.65544919    16.2221975   1152.18044569]
138 2020-01-16T00:00:00.000000 TDB [-7381.49760506  1665.85514073  5304.29123253]
139 2020-01-12T14:31:32.459417 TDB [2985.40350696 1588.91059397 5595.37067805]
140 2020-01-12T11:54:59.285687 TDB [ 5573.71380942  -689.46442743 -3347.20736948]
141 2020-01-14T04:36:11.418981 TDB [6316.85768446  399.93480788 1637.92723436]
142 2020-01-12T04:22:10.074312 TDB [4891.16171782 1366.98817801 4117.44148359]
143 2020-01-16T00:00:00.000000 TDB [-1257.59969981 -1801.50943252 -7141.34746234]
144 2020-01-13T08:56:35.129187 TDB [-1402.83686757  1638.75197682  6171.87043621]
145 2020-01-12T12:07:10.502939 TDB [6533.88994188  213.59933772  -90.00861242]
146 2020-01-12T15:05:10.681277 TDB [-6346.69579719   213.91218728  1555.35784759]
147 2020-01-13T12:58:23.225962 TDB [-1199.73570962  1655.66925452  6210.05938354]
148 2020-01-12T01:38:02.702378 TDB [  -14.60600237 -1617.62686921 -6334.70709477]
149 2020-01-12T10:16:05.761287 TDB [5975.35849222  900.60967978 2495.88403061]
150 2020-01-12T04:22:13.561987 TDB [4876.99367461 1370.39415604 4133.08559733]
151 2020-01-12T18:58:01.438054 TDB [-4843.27763851  1017.94845207  4272.22268445]
152 2020-01-16T00:00:00.000000 TDB [ 5192.11972637 -1483.82950425 -4900.04744937]
153 2020-01-12T14:35:52.772595 TDB [1628.49691055 1680.57828762 6104.84221185]
154 2020-01-16T00:00:00.000000 TDB [4728.94008236 1340.57334783 5913.0830555 ]
155 2020-01-15T09:48:57.895112 TDB [-6186.56259434   719.58498533  1988.48804754]
156 2020-01-12T20:13:46.444014 TDB [6459.91198452  414.67480379  918.16445113]
157 2020-01-12T20:29:27.511846 TDB [4193.0134788  1386.91261297 4820.84591858]
158 2020-01-14T05:05:14.052584 TDB [-243.04011251 1681.10921905 6313.49723193]
159 2020-01-12T16:35:41.469798 TDB [1940.60940151 1660.49326589 6018.49161045]
160 2020-01-12T05:34:28.370645 TDB [  746.5476521  -1585.98618719 -6298.63147179]
161 2020-01-13T00:40:05.566511 TDB [1884.56541468 1638.83589358 6042.19116809]
162 2020-01-14T00:10:26.394917 TDB [ 4482.79637543 -1224.72038773 -4598.91733224]
163 2020-01-12T16:30:39.088347 TDB [3446.31070947 1524.38500348 5342.71811488]
164 2020-01-13T19:47:13.852481 TDB [-2411.08686904 -1548.36429674 -5876.62080748]
165 2020-01-12T09:03:46.963102 TDB [-6.46027916e+03  3.31165132e+00  1.00510011e+03]
166 2020-01-16T00:00:00.000000 TDB [-7980.57944224    75.71816469 -1153.18231789]
167 2020-01-13T04:32:36.794293 TDB [4708.12248305 1239.68839989 4363.73685686]
168 2020-01-12T15:47:11.539708 TDB [ 3442.75337668 -1320.30465626 -5399.04517502]
169 2020-01-12T10:40:46.878751 TDB [-666.0476063  1672.79132307 6285.18844393]
170 2020-01-16T00:00:00.000000 TDB [-5166.39055731 -1610.48934231 -7006.2946981 ]
171 2020-01-12T22:36:59.325736 TDB [2432.34981072 1604.18632421 5852.83731495]
172 2020-01-12T03:28:55.266717 TDB [-1321.23129142 -1649.61834675 -6186.96623432]
173 2020-01-12T09:55:28.975627 TDB [ 5752.51730272  -586.03931004 -3051.31883111]
174 2020-01-12T15:54:09.450447 TDB [ 5122.17243677  -891.11539216 -3964.17795841]
175 2020-01-13T08:18:02.448572 TDB [6535.85464287   41.68846103 -162.20406739]
176 2020-01-14T09:05:28.464837 TDB [ 880.10646926 1652.9814427  6264.06489054]
177 2020-01-12T20:50:11.825302 TDB [-2291.07261262  1534.9163117   5927.93911912]
178 2020-01-12T22:19:03.046022 TDB [6156.67798118  698.29997625 2086.41735498]
179 2020-01-12T10:22:09.790939 TDB [4998.2216307  1268.54289102 4019.20682031]
180 2020-01-12T10:16:59.698512 TDB [5862.37801574  958.20253014 2731.26635668]
181 2020-01-12T07:32:44.061499 TDB [   12.35542879 -1643.08179225 -6328.15720156]
182 2020-01-14T10:42:25.390900 TDB [6235.44156318  439.98147537 1916.01903102]
183 2020-01-12T10:11:52.197561 TDB [6364.96740529  617.85468859 1360.47400314]
184 2020-01-12T20:30:07.896822 TDB [4028.07756164 1416.33976021 4951.16318059]
185 2020-01-14T04:30:18.934712 TDB [6537.791783    -44.17546547  -27.7692346 ]
186 2020-01-12T20:48:33.884642 TDB [-1756.02007113  1595.64386576  6092.270362  ]
187 2020-01-14T07:12:25.424901 TDB [-1929.42645221  1628.55669303  6030.80099686]
188 2020-01-12T10:04:09.694507 TDB [6493.15773964   50.85102047 -762.73241623]
189 2020-01-12T07:10:26.460872 TDB [-6245.79999186  -737.35408618 -1786.54286624]
190 2020-01-12T14:25:11.239432 TDB [4634.78175886 1330.09787018 4415.32351061]
191 2020-01-12T19:14:30.927115 TDB [-6425.97372999  -463.34477121 -1112.4824696 ]
192 2020-01-13T17:06:34.944077 TDB [-3280.6744928   1446.41387575  5467.22102832]
193 2020-01-12T07:53:17.145759 TDB [ 5503.72146634  -680.3835277  -3462.88496434]
194 2020-01-12T12:59:35.191268 TDB [-5756.91309801   621.74917238  3035.92219079]
195 2020-01-12T09:53:01.505168 TDB [ 5372.97965844  -757.64146552 -3647.2610271 ]
196 2020-01-13T10:19:29.067699 TDB [6536.26639711   33.11782383 -146.8631712 ]
197 2020-01-12T12:20:27.838480 TDB [5430.54532064 1118.15178605 3464.73059617]
198 2020-01-13T15:17:14.209345 TDB [-5932.01445563   673.63512504  2665.11992532]
199 2020-01-12T11:52:19.282996 TDB [ 5109.23506042  -873.75709397 -3984.68438377]

Plot a histogram of orbital lifetime for the cases.

In [7]:
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams.update({'figure.figsize':(7,5), 'figure.dpi':100})

# Plot Histogram on x
x = [(res.epoch1 - res.epoch0)/tempo.SecondsInDay for res in results]
plt.hist(x, bins=50)
plt.xlabel('Days')
plt.gca().set(title='Orbital Lifetime', ylabel='Frequency');
Out[7]:
[Text(0.5, 1.0, 'Orbital Lifetime'), Text(0, 0.5, 'Frequency')]