In [ ]:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from numpy import trapz
import plotly.express as px
import plotly
plotly.offline.init_notebook_mode()
In [ ]:
df = pd.read_csv("logs/razor_crest_1.csv")
states = {
    3: "LAUNCH",
    4: "DESCENT",
}
df["state"] = df["state"].map(states)
df["timestamp"] = df["timestamp"] - df.loc[0, "timestamp"]
df["accelZ"] = -df["accelZ"]
df = df[df["timestamp"] < 9000]
df
Out[ ]:
timestamp state pressure altitude altitudeFromGround temperature accelX accelY accelZ
0 0 LAUNCH 99942.27 115.76 1.02 7.15 0.31 -0.90 10.94
1 12 LAUNCH 99934.95 116.38 1.64 7.15 0.78 -1.26 7.73
2 24 LAUNCH 99928.30 116.94 2.20 7.15 -0.04 -2.16 15.57
3 36 LAUNCH 99922.30 117.44 2.70 7.15 2.39 -1.84 19.93
4 48 LAUNCH 99917.64 117.84 3.09 7.15 3.18 -0.43 18.87
... ... ... ... ... ... ... ... ... ...
745 8940 LAUNCH 100029.94 108.38 -6.36 6.49 -8.67 -5.57 -1.88
746 8952 LAUNCH 100029.94 108.38 -6.36 6.49 -8.63 -5.57 -1.84
747 8964 LAUNCH 100030.02 108.38 -6.36 6.50 -8.63 -5.65 -1.88
748 8976 LAUNCH 100030.02 108.38 -6.36 6.50 -8.67 -5.65 -1.88
749 8988 LAUNCH 100029.34 108.43 -6.31 6.50 -8.75 -5.69 -1.88

750 rows × 9 columns

In [ ]:
px.line(df, x="timestamp", y="altitudeFromGround")
In [ ]:
px.line(df, x="timestamp", y="accelZ")
In [ ]:
launch = df[df["timestamp"] < 2100]
area = trapz(launch["accelZ"], launch["timestamp"] / 1000)
area * 3.6
Out[ ]:
170.463744
In [ ]:
px.line(df, x="timestamp", y=["accelX", "accelY", "accelZ"])