Files
airplane-data-logger/Analysis_Tools/template_ems.ipynb
T
2022-11-26 22:52:19 -08:00

6.4 KiB

EMS Processing

In [1]:
# comment whole cell by selecting all lines, then CTRL+/
In [ ]:
import sys
sys.path.append('../../../programs')
In [ ]:
from pathlib import Path
In [ ]:
# # debug paths
# import os
# os.getcwd()
In [ ]:
import subprocess
In [3]:
import datetime
In [ ]:
import matplotlib.pyplot as plt
In [ ]:
import ems_plot_util_nb as emsU

Notebook name starts with YYYYMMDD_ so sort by name is in date order
Data is unpacked in a directory named DDmonYYYY/

In [ ]:
# fname_date="20200207"
# dt=datetime.datetime.strptime(fname_date,"%Y%m%d")
# date=dt.strftime("%-d%b%Y")
# print(date)
# emsU.FLIGHTDATE=date
In [ ]:
#get the date from the directory
import os
emsU.FLIGHTDATE=os.getcwd().split('/')[-1]
emsU.PATH=os.fspath(Path(*Path(os.getcwd()).parts[:-1]))
print(emsU.PATH)
print(emsU.FLIGHTDATE)
In [ ]:
sp=emsU.PATH+"/%s/N72KH_combined_%s/" %(emsU.FLIGHTDATE,emsU.FLIGHTDATE)
cmd="ls -skS '%s' | grep N.TXT" % (sp)
logs=subprocess.check_output(cmd, shell=True)
print(logs.decode('utf8'))
In [ ]:
LOGCOUNT=int(len(logs.split())/2)

The default is the most recent log
edit the LOG number here to use a different log

In [ ]:
LOGNUM=LOGCOUNT-1
In [ ]:
d=emsU.get_df(emsU.PATH+"/%s/N72KH_EMS_%s/LOG000%sN_E.csv" % (emsU.FLIGHTDATE,emsU.FLIGHTDATE,LOGNUM))
In [ ]:
%matplotlib inline
In [ ]:
plt.rcParams["figure.figsize"]= (30,10)
In [ ]:
emsU.pd.Timestamp(emsU.FLIGHTDATE)
In [ ]:
wrapped,index = emsU.check_newday(d)
In [ ]:
if wrapped:
    print("day wrapped at %d" % index)
    d=emsU.fix_newday(d,index)
In [ ]:
d=emsU.add_elapsed(d)
In [ ]:
#d.head(emsU.sv+2)
In [ ]:
emsU.plot_FUEL(d)
In [ ]:
emsU.plot_RPM(d)
plt.grid()
In [ ]:
emsU.plot_EGTdt(d)
plt.grid()
In [ ]:
emsU.plot_EGT(d)
plt.grid()
In [ ]:
emsU.plot_CHTdt(d)
plt.grid()
In [ ]:
print("flight time")
print(d.index[-1])
In [ ]:
emsU.sv
In [ ]:
d.info()
In [ ]:
#t=emsU.pd.Series([val.time() for val in d['TIME']])
In [ ]: