added power plot

This commit is contained in:
ken
2023-07-09 09:32:10 -07:00
parent 7ddfa4e13c
commit d7b4ed1016
3 changed files with 45 additions and 15 deletions
+17 -13
View File
@@ -292,6 +292,7 @@ def plot_OIL(df):
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): def plot_BAT(df):
# VBAT, IBAT # VBAT, IBAT
fig, ax = plt.subplots() fig, ax = plt.subplots()
@@ -403,22 +404,25 @@ def plot_FUEL(df):
def plot_PWR(df): def plot_PWR(df):
# see plot_BAT...
# MP, RPM # MP, RPM
fig, ax = plt.subplots() fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True)
df.plot(ax=ax, y="MP", xlim=(sv+50,len(df)), color='b') df.plot(ax=axs[0], y="MP", xlim=(sv+50,len(df)), color='b')
ax.set_ylabel('PSI') axs[0].set_ylabel('PSI')
ax.legend(loc='lower center') #axs[0].legend(loc='lower center')
ax2=ax.twinx() #ax2=axs.twinx()
df.plot(ax=ax2, y="RPM", xlim=(sv+50,len(df)), color='g') df.plot(ax=axs[1], y="RPM", xlim=(sv+50,len(df)), color='g')
ax2.set_ylabel("rpm") axs[1].set_ylabel("rpm")
ax2.legend(loc='lower right') #axs[1].legend(loc='lower right')
ax=plt.gca() ax=plt.gca()
tick_labels=ax.xaxis.major.formatter.seq ax.xaxis.set_major_formatter(x_format(df))
ax.xaxis.major.formatter.seq = [label.split()[-1] if label else "" for label in tick_labels]
plt.xticks(rotation=30) plt.xticks(rotation=30)
plt.xlabel("Time (MM:SS)") if df.index[-1] > pd.Timedelta("01:00:00"):
plt.title(FLIGHTDATE) plt.xlabel("Elapsed Time (HH:MM:SS)")
else:
plt.xlabel("Elapsed Time (MM:SS)")
axs[0].set_title(FLIGHTDATE)
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png") if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png")
+20 -1
View File
@@ -26,6 +26,16 @@
"sys.path.append('../../../programs')" "sys.path.append('../../../programs')"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# import importlib\n",
"# importlib.reload(ems_plot_util_nb)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -278,6 +288,15 @@
"plt.grid()" "plt.grid()"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_PWR(d)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -346,7 +365,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.10" "version": "3.10.11"
} }
}, },
"nbformat": 4, "nbformat": 4,
+8 -1
View File
@@ -6,7 +6,7 @@
# extension: .py # extension: .py
# format_name: light # format_name: light
# format_version: '1.5' # format_version: '1.5'
# jupytext_version: 1.14.1 # jupytext_version: 1.14.6
# kernelspec: # kernelspec:
# display_name: Python 3 (ipykernel) # display_name: Python 3 (ipykernel)
# language: python # language: python
@@ -22,6 +22,11 @@
import sys import sys
sys.path.append('../../../programs') sys.path.append('../../../programs')
# +
# import importlib
# importlib.reload(ems_plot_util_nb)
# -
from pathlib import Path from pathlib import Path
# + # +
@@ -102,6 +107,8 @@ plt.grid()
emsU.plot_CHTdt(d) emsU.plot_CHTdt(d)
plt.grid() plt.grid()
emsU.plot_PWR(d)
print("flight time") print("flight time")
print(d.index[-1]) print(d.index[-1])