-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMultiAsteroids2.py
More file actions
70 lines (52 loc) · 1.91 KB
/
MultiAsteroids2.py
File metadata and controls
70 lines (52 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import numpy as np
from astropy import units as u
from astropy import time
import datetime
from poliastro.bodies import Earth, Sun
from poliastro.twobody import Orbit
f=open("roid_info.txt")
read_lines=f.readlines()
from matplotlib import pylab as plt
import argparse
#then plot
from poliastro.plotting import OrbitPlotter
parser = argparse.ArgumentParser()
parser.add_argument("--asteroids", "-n", help="changes the number of asteroids")
args=parser.parse_args()
print(type(args.asteroids))
if not args.asteroids:
asteroids=75
else:
asteroids=int(args.asteroids)
tempo=datetime.datetime(2000,1,1,0,0,0)
#help(Orbit.from_classical)
offset=float(0)
for frame in range(60*60):
offset=offset+1
astratempo = time.Time(tempo, scale='utc')#, value=J2000.000)
print("Rendering frame "+str(frame)+" for "+str(astratempo)+"...")
#plot Icaurs and Mars
op = OrbitPlotter(bgcolor=(0,0,0), linewidth=0.01, markersize=3, audivision=12)
roid_orbits = []
for i in range(asteroids):
line = read_lines[i]
# pull out the e, i, arg_p
line_e = float(line[71:79]) * u.one
line_inc= float(line[60:68]) * u.deg
line_pera= float(line[38:46]) * u.deg
line_semax = float(line[93:103]) * u.AU
line_name=line[167:194]
line_raan= float(line[49:57]) * u.deg
line_ma= (float(line[27:35])+offset) * u.deg
#x = Orbit.from_classical(Sun, line_semax, line_e, line_inc, line_raan, line_pera, line_ma, epoch=astratempo)
x = Orbit.from_classical(Sun, line_semax, line_e, line_inc, line_raan, line_pera, line_ma)#, astratempo)
roid_orbits.append(x)
for i in range(75):
orb = roid_orbits[i]
op.plot(orb)
# Data for Mars at J2000 from JPL HORIZONS
#op.plot(mars)
#op.plot(icarus,label="Icarus")
plt.savefig('Frames/asteroids'+str(frame)+'.png')
plt.close()
tempo=tempo+datetime.timedelta(days=150)