improved comments and plot consistency

This commit is contained in:
ken
2023-07-09 10:48:23 -07:00
parent d7b4ed1016
commit 6d974e6553
2 changed files with 22 additions and 45 deletions
+5 -9
View File
@@ -162,9 +162,8 @@ def plot_ALTSPD(df):
def plot_ALTI(df): def plot_ALTI(df):
# RPM t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
#df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b') #df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b')
ax.plot(t,df['ALTI'][sv:],'-',label="ALTI") ax.plot(t,df['ALTI'][sv:],'-',label="ALTI")
ax.xaxis.set_major_formatter(x_format(df)) ax.xaxis.set_major_formatter(x_format(df))
@@ -182,9 +181,8 @@ def plot_ALTI(df):
def plot_AIRSP(df): def plot_AIRSP(df):
# RPM t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
#df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b') #df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b')
ax.plot(t,df['AIRSP'][sv:],'-',label="AIRSP") ax.plot(t,df['AIRSP'][sv:],'-',label="AIRSP")
ax.xaxis.set_major_formatter(x_format(df)) ax.xaxis.set_major_formatter(x_format(df))
@@ -202,8 +200,8 @@ def plot_AIRSP(df):
def plot_ROLL(df): def plot_ROLL(df):
t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
ax.plot(t,df['ROLL'][sv:],'-',label="ROLL") ax.plot(t,df['ROLL'][sv:],'-',label="ROLL")
ax.xaxis.set_major_formatter(x_format(df)) ax.xaxis.set_major_formatter(x_format(df))
@@ -221,9 +219,8 @@ def plot_ROLL(df):
def plot_AOA(df): def plot_AOA(df):
# RPM t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
#df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b') #df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b')
ax.plot(t,df['AOA'][sv:],'-',label="AOA") ax.plot(t,df['AOA'][sv:],'-',label="AOA")
ax.xaxis.set_major_formatter(x_format(df)) ax.xaxis.set_major_formatter(x_format(df))
@@ -240,9 +237,8 @@ def plot_AOA(df):
def plot_PITCH(df): def plot_PITCH(df):
# RPM t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
#df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b') #df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b')
ax.plot(t,df['PITCH'][sv:],'-',label="PITCH") ax.plot(t,df['PITCH'][sv:],'-',label="PITCH")
ax.xaxis.set_major_formatter(x_format(df)) ax.xaxis.set_major_formatter(x_format(df))
+17 -36
View File
@@ -166,6 +166,7 @@ def plot_all_df(df):
def plot_EGT(df): def plot_EGT(df):
# Zulu time # Zulu time
fig, ax = plt.subplots() fig, ax = plt.subplots()
@@ -192,11 +193,12 @@ def plot_EGT(df):
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_EGT.png") if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_EGT.png")
def plot_EGTdt(df): def plot_EGTdt(df):
# Elapsed time t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
# index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
y1=df['EGT1'][sv:] y1=df['EGT1'][sv:]
y2=df['EGT2'][sv:] y2=df['EGT2'][sv:]
@@ -221,6 +223,7 @@ def plot_EGTdt(df):
def plot_CHT(df): def plot_CHT(df):
fig, ax = plt.subplots() fig, ax = plt.subplots()
ax.xaxis_date() ax.xaxis_date()
@@ -248,10 +251,9 @@ def plot_CHT(df):
def plot_CHTdt(df): def plot_CHTdt(df):
# Elapsed time t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
# index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
y1=df['CHT1'][sv:] y1=df['CHT1'][sv:]
y2=df['CHT2'][sv:] y2=df['CHT2'][sv:]
@@ -291,36 +293,11 @@ def plot_OIL(df):
axs[0].set_title(FLIGHTDATE) axs[0].set_title(FLIGHTDATE)
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_OIL.png") if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_OIL.png")
"""
COMPARE OLD 2AXIS commented out, with NEW 2AXIS below...
def plot_BAT(df):
# VBAT, IBAT
fig, ax = plt.subplots()
ax.xaxis_date()
ax.xaxis.set_major_formatter(DateFormatter('%H:%M'))
x=df['TIME'][sv:]
t=list(map(date2num, x))
df.plot(ax=ax, y="VBAT", xlim=(sv+50,len(df)), color='b')
ax.set_ylabel('Volts')
ax.legend(loc='lower center')
ax2=ax.twinx()
df.plot(ax=ax2, y="IBAT", xlim=(sv+50,len(df)), color='g')
ax2.set_ylabel("Amps")
ax2.legend(loc='lower right')
ax=plt.gca()
#tick_labels=ax.xaxis.major.formatter.seq
#ax.xaxis.major.formatter.seq = [label.split()[-1] if label else "" for label in tick_labels]
plt.xticks(rotation=30)
plt.xlabel("Time (MM:SS)")
plt.title(FLIGHTDATE)
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_BAT.png")
"""
def plot_BAT(df): def plot_BAT(df):
# VBAT, IBAT # VBAT, IBAT
t=df.index.seconds[sv:]
fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True) fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True)
#axs[1].xaxis_date() #axs[1].xaxis_date()
axs[1].xaxis.set_major_formatter(DateFormatter('%H:%M')) axs[1].xaxis.set_major_formatter(DateFormatter('%H:%M'))
@@ -347,10 +324,10 @@ def plot_BAT(df):
def plot_FUEL(df): def plot_FUEL(df):
# FL, FR # FL, FR
t=df.index.seconds[sv:] t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True) fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True)
#axs[1].xaxis_date() #axs[1].xaxis_date()
axs[1].xaxis.set_major_formatter(DateFormatter('%H:%M')) axs[1].xaxis.set_major_formatter(DateFormatter('%H:%M'))
@@ -404,8 +381,8 @@ def plot_FUEL(df):
def plot_PWR(df): def plot_PWR(df):
# see plot_BAT...
# MP, RPM # MP, RPM
fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True) fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True)
df.plot(ax=axs[0], y="MP", xlim=(sv+50,len(df)), color='b') df.plot(ax=axs[0], y="MP", xlim=(sv+50,len(df)), color='b')
@@ -426,10 +403,12 @@ def plot_PWR(df):
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png") if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png")
def plot_RPM(df): def plot_RPM(df):
# RPM # RPM
t=df.index.seconds[sv:] # Elapsed time - index set to 'ELAPSED'
fig, ax = plt.subplots() fig, ax = plt.subplots()
t=df.index.seconds[sv:]
#df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b') #df.plot(ax=ax, y="RPM", xlim=(sv+50,len(df)), color='b')
ax.plot(t,df['RPM'][sv:],'-',label="RPM") ax.plot(t,df['RPM'][sv:],'-',label="RPM")
ax.xaxis.set_major_formatter(x_format(df)) ax.xaxis.set_major_formatter(x_format(df))
@@ -446,6 +425,8 @@ def plot_RPM(df):
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png") if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png")
def plot_ALL(df): def plot_ALL(df):
plot_PWR(df) plot_PWR(df)
plot_FUEL(df) plot_FUEL(df)