Beispiel #1
0
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
from pandas_util import load_json_dataframe, by_altitude
import sys

gps_data = load_json_dataframe('c1_gps.txt')
logger_data = load_json_dataframe('c1_data.txt')


max_altitude_time = gps_data['hgt'].idxmax()
max_altitude = gps_data['hgt'].max()
print "Max altitude", max_altitude, " at ", max_altitude_time

field = sys.argv[1]

# Set ascendeing and descending each to a Series of the specified field vs. time
try:
    ascending = logger_data.ix[logger_data.time <= max_altitude_time, field]
    descending = logger_data.ix[logger_data.time >= max_altitude_time, field]
except:
    ascending = gps_data.ix[gps_data.time <= max_altitude_time , field]
    descending = gps_data.ix[gps_data.time >= max_altitude_time, field]

y_label = sys.argv[len(sys.argv)-1]

# Plot specified field vs time
p = DataFrame({'Ascending': ascending, 'Descending': descending}).plot()
p.set_ylabel(y_label)
p.set_xlabel("Time")
Beispiel #2
0
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
from pandas_util import load_json_dataframe, by_altitude
from datetime import timedelta
import sys

gps_data = load_json_dataframe("c1_gps.txt")

hgt = gps_data["hgt"]
# Delete the samples when the balloon was on the ground
hgt = hgt[4 : hgt.size - 15]

max_altitude_time = hgt.idxmax()
max_altitude = hgt.max()

# delta is the height difference between samples shifted by 2 minutes
delta = hgt.shift(-1, "min") - hgt.shift(1, "min")

miles = delta / 5280.0
mph = miles * 30  # delta shift is 30 periods per hour

offset = timedelta(minutes=1)
ascending = mph.ix[mph.index < max_altitude_time - offset]
descending = mph.ix[mph.index > max_altitude_time - offset]

# Plot vertical speed vs time
p = DataFrame({"Ascending": ascending, "Descending": descending}).plot()
p.set_ylabel("Vertical Speed (MPH)")
p.set_xlabel("Time")