-
Notifications
You must be signed in to change notification settings - Fork 5
/
result_vizualization.py
122 lines (92 loc) · 3.85 KB
/
result_vizualization.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 10:46:18 2019
@author: lbrevaul
"""
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
def plots_output(P_out):
Nb_final = np.int(P_out['Nb_pt_ascent'])
f, axs = plt.subplots(3,2,figsize=(15,15))
plt.subplot(421)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['alt_ascent'][0:Nb_final]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Altitude (km)')
plt.subplot(422)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['V_ascent'][0:Nb_final]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Velocity (km/s)')
plt.subplot(423)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['m_ascent'][0:Nb_final]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Mass (t)')
plt.subplot(424)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['gamma_ascent'][0:Nb_final])
plt.xlabel('Time (s)')
plt.ylabel('Flight path angle (deg)')
plt.subplot(425)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['theta_ascent'][0:Nb_final])
plt.xlabel('Time (s)')
plt.ylabel('Pitch angle (deg)')
plt.subplot(426)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['nx_ascent'][0:Nb_final])
plt.xlabel('Time (s)')
plt.ylabel('Load factor')
plt.subplot(427)
plt.plot(P_out['T_ascent'][0:Nb_final],P_out['pdyn_ascent'][0:Nb_final]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Dynamic Pressure (kPa)')
plt.subplot(428)
plt.plot(P_out['longi_ascent'][0:Nb_final],P_out['lat_ascent'][0:Nb_final])
plt.xlabel('Longitude (deg)')
plt.ylabel('Latitude (deg)')
plt.show()
# Fallout
if P_out['is_fallout'] == 1.:
print('Plot of fallout phase')
Nb_final_fallout = np.int(P_out['Nb_pt_fallout'])
f, axs = plt.subplots(3,2,figsize=(15,15))
plt.subplot(421)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['alt_fallout'][0:Nb_final_fallout]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Altitude (km)')
plt.subplot(422)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['V_fallout'][0:Nb_final_fallout]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Velocity (km/s)')
plt.subplot(423)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['m_fallout'][0:Nb_final_fallout]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Mass (t)')
plt.subplot(424)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['gamma_fallout'][0:Nb_final_fallout])
plt.xlabel('Time (s)')
plt.ylabel('Flight path angle (deg)')
plt.subplot(425)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['theta_fallout'][0:Nb_final_fallout])
plt.xlabel('Time (s)')
plt.ylabel('Pitch angle (deg)')
plt.subplot(426)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['nx_fallout'][0:Nb_final_fallout])
plt.xlabel('Time (s)')
plt.ylabel('Load factor')
plt.subplot(427)
plt.plot(P_out['T_fallout'][0:Nb_final_fallout],P_out['pdyn_fallout'][0:Nb_final_fallout]/1e3)
plt.xlabel('Time (s)')
plt.ylabel('Dynamic Pressure (kPa)')
plt.subplot(428)
plt.plot(P_out['longi_fallout'][0:Nb_final_fallout],P_out['lat_fallout'][0:Nb_final_fallout])
plt.xlabel('Longitude (deg)')
plt.ylabel('Latitude (deg)')
plt.show()
def result_table(P_out):
data = [[P_out['GLOW'][0]/1e3,
P_out['Dry_mass_stage_1'][0]/1e3,
P_out['Dry_mass_stage_2'][0]/1e3,
P_out['Prop_mass_stage_1'][0]/1e3,
P_out['Prop_mass_stage_2'][0]/1e3]]
df = pd.DataFrame(data, columns=["GLOW (t)", "Dry_mass_stage_1 (t)",
"Dry_mass_stage_2 (t)", "Prop_mass_stage_1 (t)",
"Prop_mass_stage_2 (t)"])
return [data, df]