added analysis and tools

This commit is contained in:
ken
2022-11-26 22:52:19 -08:00
parent 7b3b988f01
commit e9c9c7b65e
8 changed files with 946 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
# $1 is param 1 $2 is param 2
PLANE="N72KH"
mkdir $1
mkdir $1/${PLANE}_GPS_$1
mkdir $1/${PLANE}_EFIS_$1
mkdir $1/${PLANE}_EMS_$1
mkdir $1/${PLANE}_combined_$1
DATE=$(./dMoYr_yyyymmdd.py $1)
cp template_efis.ipynb $1/${DATE}_efis.ipynb
cp template_ems.ipynb $1/${DATE}_ems.ipynb
pushd notebooks
ln -s ../${1}/${DATE}_efis.ipynb .
ln -s ../${1}/${DATE}_ems.ipynb .
popd
open $1
+329
View File
@@ -0,0 +1,329 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EFIS Processing"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# comment whole cell by selecting all lines, then CTRL+/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#%matplotlib inline \n",
"%matplotlib widget\n",
"#%matplotlib notebook\n",
"# did pip install ipympl..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append('../../../programs')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# # debug paths\n",
"# import os\n",
"# os.getcwd()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import subprocess"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import efis_plot_util_nb as efisU"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notebook name starts with YYYYMMDD_ so sort by name is in date order\\\n",
"Data is unpacked in a directory named DDmonYYYY/ "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# fname_date=\"20200207\"\n",
"# import datetime\n",
"# dt=datetime.datetime.strptime(fname_date,\"%Y%m%d\")\n",
"# date=dt.strftime(\"%-d%b%Y\")\n",
"# print(date)\n",
"# efisU.FLIGHTDATE=date"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#get the date from the directory\n",
"import os\n",
"efisU.FLIGHTDATE=os.getcwd().split('/')[-1]\n",
"efisU.PATH=os.fspath(Path(*Path(os.getcwd()).parts[:-1]))\n",
"print(efisU.PATH)\n",
"print(efisU.FLIGHTDATE)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sp=efisU.PATH+\"/%s/N72KH_combined_%s/\" %(efisU.FLIGHTDATE,efisU.FLIGHTDATE)\n",
"cmd=\"ls -skS '%s' | grep N.TXT\" % (sp)\n",
"logs=subprocess.check_output(cmd, shell=True)\n",
"print(logs.decode('utf8'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"LOGCOUNT=int(len(logs.split())/2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**The default is the most recent log** \n",
"**edit the LOG number here to use a different log**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"LOGNUM=LOGCOUNT-1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d=efisU.get_df(\"../%s/N72KH_EFIS_%s/LOG000%sN_F.csv\" % (efisU.FLIGHTDATE,efisU.FLIGHTDATE,LOGNUM))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.rcParams[\"figure.figsize\"]= (30,10)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"efisU.pd.Timestamp(efisU.FLIGHTDATE)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"wrapped,index = efisU.check_newday(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if wrapped:\n",
" print(\"day wrapped at %d\" % index)\n",
" d=efisU.fix_newday(d,index)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d=efisU.add_elapsed(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#d.head(efisU.sv+2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"efisU.plot_ALTI(d)\n",
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"efisU.plot_AIRSP(d)\n",
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"flight time\")\n",
"print(d.index[-1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"efisU.sv"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d.info()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"lines_to_next_cell": 0
},
"outputs": [],
"source": [
"#t=emsU.pd.Series([val.time() for val in d['TIME']])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"lines_to_next_cell": 2
},
"outputs": [],
"source": []
}
],
"metadata": {
"jupytext": {
"formats": "ipynb,py:light"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
+112
View File
@@ -0,0 +1,112 @@
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.1
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# ## EFIS Processing
# +
# comment whole cell by selecting all lines, then CTRL+/
# -
# #%matplotlib inline
# %matplotlib widget
# #%matplotlib notebook
# did pip install ipympl...
import sys
sys.path.append('../../../programs')
from pathlib import Path
# +
# # debug paths
# import os
# os.getcwd()
# -
import subprocess
import matplotlib.pyplot as plt
import efis_plot_util_nb as efisU
# Notebook name starts with YYYYMMDD_ so sort by name is in date order\
# Data is unpacked in a directory named DDmonYYYY/
# +
# fname_date="20200207"
# import datetime
# dt=datetime.datetime.strptime(fname_date,"%Y%m%d")
# date=dt.strftime("%-d%b%Y")
# print(date)
# efisU.FLIGHTDATE=date
# -
#get the date from the directory
import os
efisU.FLIGHTDATE=os.getcwd().split('/')[-1]
efisU.PATH=os.fspath(Path(*Path(os.getcwd()).parts[:-1]))
print(efisU.PATH)
print(efisU.FLIGHTDATE)
sp=efisU.PATH+"/%s/N72KH_combined_%s/" %(efisU.FLIGHTDATE,efisU.FLIGHTDATE)
cmd="ls -skS '%s' | grep N.TXT" % (sp)
logs=subprocess.check_output(cmd, shell=True)
print(logs.decode('utf8'))
LOGCOUNT=int(len(logs.split())/2)
# **The default is the most recent log**
# **edit the LOG number here to use a different log**
LOGNUM=LOGCOUNT-1
d=efisU.get_df("../%s/N72KH_EFIS_%s/LOG000%sN_F.csv" % (efisU.FLIGHTDATE,efisU.FLIGHTDATE,LOGNUM))
# %matplotlib inline
plt.rcParams["figure.figsize"]= (30,10)
efisU.pd.Timestamp(efisU.FLIGHTDATE)
wrapped,index = efisU.check_newday(d)
if wrapped:
print("day wrapped at %d" % index)
d=efisU.fix_newday(d,index)
d=efisU.add_elapsed(d)
# +
#d.head(efisU.sv+2)
# -
efisU.plot_ALTI(d)
plt.grid()
efisU.plot_AIRSP(d)
plt.grid()
print("flight time")
print(d.index[-1])
efisU.sv
d.info()
# +
#t=emsU.pd.Series([val.time() for val in d['TIME']])
# -
+354
View File
@@ -0,0 +1,354 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EMS Processing"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# comment whole cell by selecting all lines, then CTRL+/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append('../../../programs')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# # debug paths\n",
"# import os\n",
"# os.getcwd()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import subprocess"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import datetime"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ems_plot_util_nb as emsU"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notebook name starts with YYYYMMDD_ so sort by name is in date order\\\n",
"Data is unpacked in a directory named DDmonYYYY/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# fname_date=\"20200207\"\n",
"# dt=datetime.datetime.strptime(fname_date,\"%Y%m%d\")\n",
"# date=dt.strftime(\"%-d%b%Y\")\n",
"# print(date)\n",
"# emsU.FLIGHTDATE=date"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#get the date from the directory\n",
"import os\n",
"emsU.FLIGHTDATE=os.getcwd().split('/')[-1]\n",
"emsU.PATH=os.fspath(Path(*Path(os.getcwd()).parts[:-1]))\n",
"print(emsU.PATH)\n",
"print(emsU.FLIGHTDATE)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sp=emsU.PATH+\"/%s/N72KH_combined_%s/\" %(emsU.FLIGHTDATE,emsU.FLIGHTDATE)\n",
"cmd=\"ls -skS '%s' | grep N.TXT\" % (sp)\n",
"logs=subprocess.check_output(cmd, shell=True)\n",
"print(logs.decode('utf8'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"LOGCOUNT=int(len(logs.split())/2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**The default is the most recent log** \n",
"**edit the LOG number here to use a different log**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"LOGNUM=LOGCOUNT-1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d=emsU.get_df(emsU.PATH+\"/%s/N72KH_EMS_%s/LOG000%sN_E.csv\" % (emsU.FLIGHTDATE,emsU.FLIGHTDATE,LOGNUM))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.rcParams[\"figure.figsize\"]= (30,10)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.pd.Timestamp(emsU.FLIGHTDATE)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"wrapped,index = emsU.check_newday(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if wrapped:\n",
" print(\"day wrapped at %d\" % index)\n",
" d=emsU.fix_newday(d,index)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d=emsU.add_elapsed(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#d.head(emsU.sv+2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_FUEL(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_RPM(d)\n",
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_EGTdt(d)\n",
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_EGT(d)\n",
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_CHTdt(d)\n",
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"flight time\")\n",
"print(d.index[-1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.sv"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d.info()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"lines_to_next_cell": 0
},
"outputs": [],
"source": [
"#t=emsU.pd.Series([val.time() for val in d['TIME']])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"lines_to_next_cell": 2
},
"outputs": [],
"source": []
}
],
"metadata": {
"jupytext": {
"formats": "ipynb,py:light"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
+116
View File
@@ -0,0 +1,116 @@
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.1
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# ## EMS Processing
# +
# comment whole cell by selecting all lines, then CTRL+/
# -
import sys
sys.path.append('../../../programs')
from pathlib import Path
# +
# # debug paths
# import os
# os.getcwd()
# -
import subprocess
import datetime
import matplotlib.pyplot as plt
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/
# +
# fname_date="20200207"
# dt=datetime.datetime.strptime(fname_date,"%Y%m%d")
# date=dt.strftime("%-d%b%Y")
# print(date)
# emsU.FLIGHTDATE=date
# -
#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)
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'))
LOGCOUNT=int(len(logs.split())/2)
# **The default is the most recent log**
# **edit the LOG number here to use a different log**
LOGNUM=LOGCOUNT-1
d=emsU.get_df(emsU.PATH+"/%s/N72KH_EMS_%s/LOG000%sN_E.csv" % (emsU.FLIGHTDATE,emsU.FLIGHTDATE,LOGNUM))
# %matplotlib inline
plt.rcParams["figure.figsize"]= (30,10)
emsU.pd.Timestamp(emsU.FLIGHTDATE)
wrapped,index = emsU.check_newday(d)
if wrapped:
print("day wrapped at %d" % index)
d=emsU.fix_newday(d,index)
d=emsU.add_elapsed(d)
# +
#d.head(emsU.sv+2)
# -
emsU.plot_FUEL(d)
emsU.plot_RPM(d)
plt.grid()
emsU.plot_EGTdt(d)
plt.grid()
emsU.plot_EGT(d)
plt.grid()
emsU.plot_CHTdt(d)
plt.grid()
print("flight time")
print(d.index[-1])
emsU.sv
d.info()
# +
#t=emsU.pd.Series([val.time() for val in d['TIME']])
# -
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# run: . walk_logs.sh ddmmmyyyy
#cd ../../programs/
pushd ../../programs/
python walk_logs.py $1
popd
# TODO: make this scriptable!
# jupyter nbconvert --to notebook --execute date_efis.ipynb
# jupyter nbconvert --to notebook --execute date_ems.ipynb