Compare commits
2 commits
8ed574bf02
...
d5d73b376d
| Author | SHA1 | Date | |
|---|---|---|---|
| d5d73b376d | |||
| a1dcb7362c |
1 changed files with 7 additions and 12 deletions
|
|
@ -77,7 +77,7 @@ def plot_data(t, data, altitude, speed, temperature, ax):
|
|||
#ax2 = ax.twinx()
|
||||
|
||||
def plot_mean(t, mean, ax):
|
||||
print(type(t))
|
||||
#print(type(t))
|
||||
idx0 = np.argmax(t > 0)
|
||||
ax.plot(t[idx0:len(mean)+idx0],mean, '--', color='red',label="Mean ")
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ def onset_correction(t, data, thresh):
|
|||
for i in range(len(t)):
|
||||
start=0
|
||||
start_found = False
|
||||
print(data[i])
|
||||
#print(data[i])
|
||||
while not start_found:
|
||||
if data[i][start] > thresh:
|
||||
start_found = True
|
||||
|
|
@ -99,14 +99,14 @@ def onset_correction(t, data, thresh):
|
|||
end = np.argmax(data[i])
|
||||
end = min(start+500,end)
|
||||
#end = data[i].index(endval)
|
||||
print(start, end)
|
||||
#print(start, end)
|
||||
popt,pcov=opt.curve_fit(f,t[i][start:end],data[i][start:end])
|
||||
#print(popt)
|
||||
a,b=popt
|
||||
t0 = -b/a
|
||||
for j in range(len(t[i])):
|
||||
t[i][j]-=t0
|
||||
print(t[i])
|
||||
#print(t[i])
|
||||
|
||||
def index_of_first_positive(lst):
|
||||
return next((i for i, x in enumerate(lst) if x > 0), -1)
|
||||
|
|
@ -137,20 +137,15 @@ def main():
|
|||
|
||||
parser = argparse.ArgumentParser(description="Plot Data from STRATO4-Datalogger")
|
||||
parser.add_argument("files", nargs="+", help="Dateipfade, die eingelesen werden sollen")
|
||||
parser.add_argument("-uptime", action="store_true")
|
||||
parser.add_argument("-altitude", action="store_true")
|
||||
parser.add_argument("-speed", action="store_true")
|
||||
parser.add_argument("-temperature", action="store_true")
|
||||
parser.add_argument("-onset", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
t, altitude = read_data(args.files, args.uptime)
|
||||
t, altitude = read_data(args.files, True)
|
||||
|
||||
#ndtype = args.altitude + args.speed + args.temperature
|
||||
#print(ndtype)
|
||||
|
||||
#Data_preparation for altitude plot
|
||||
t, data = clear_data(t, altitude, args.uptime)
|
||||
t, data = clear_data(t, altitude, True)
|
||||
#if args.onset:
|
||||
onset_correction(t, data, 300)
|
||||
|
||||
|
|
@ -159,7 +154,7 @@ def main():
|
|||
ax = fig.add_subplot(111)
|
||||
ax.set_xlabel("Time/s")
|
||||
ax.set_ylabel("Altitude/m")
|
||||
plot_data(t, data, args.altitude, args.speed, args.temperature, ax)
|
||||
plot_data(t, data, True, False, False, ax)
|
||||
mean_data = mean(data, t)
|
||||
min_idx = min(enumerate(t), key=lambda x: len(x[1]))[0]
|
||||
plot_mean(t[2], mean_data, ax)
|
||||
Loading…
Add table
Add a link
Reference in a new issue