-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_sat.py
More file actions
44 lines (37 loc) · 1.28 KB
/
Copy pathplot_sat.py
File metadata and controls
44 lines (37 loc) · 1.28 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
import argparse
import os
import matplotlib.pyplot as plt
import pandas
# Argument Parser
parser = argparse.ArgumentParser()
parser.add_argument('--log_file', type=str, default='NA', help='Directory containing log files to plot')
parser.add_argument('--plot_peri', action='store_true', help='Plots the spacecraft motion in the Perifocal Frame')
args = parser.parse_args()
# Get a list of the log files
if args.log_file != 'NA':
log_files = [args.log_file]
else:
log_files = os.listdir(os.getcwd() + '/Log_data')
# Create Figure for 3D Plot
if args.plot_peri:
ax = plt.axes()
else:
ax = plt.axes(projection='3d')
# Read in the data from all of the log files
for log_file in log_files:
# Create a Pandas Data Frame
df = pandas.read_csv(os.getcwd() + '/Log_data/%s' % log_file)
# Plot the Satellite Motion in the Perifocal Frame
if args.plot_peri:
ax.plot(df['periPosP'], df['periPosQ'])
ax.set_xlabel('P (m)')
ax.set_ylabel('Q (m)')
ax.set_title('Position w.r.t. Perifocal Frame')
# Plot the Satellite Motion in the Inertial Frame
else:
ax.plot3D(df['eciPosX'], df['eciPosY'], df['eciPosZ'])
ax.set_xlabel('X (m)')
ax.set_ylabel('Y (m)')
ax.set_zlabel('Z (m)')
ax.set_title('Position w.r.t. Inertial Frame')
plt.show()