Compare commits

..

No commits in common. "a3166caa121f1e58e3535582554000aa52889a6a" and "e966a2ae59a60c9472392bf18a82e4d6b7cd44e0" have entirely different histories.

2 changed files with 26 additions and 3 deletions

View file

@ -13,7 +13,7 @@ def layout(fig):
fig.legend()
plt.grid()
#Reads Time and Altitude columns from log files from Strato3 (.LOG) and Strato4 (.csv) files. Returns List of numpy arrays for time and List of lists of single numpy arrays for altitude
def read_data(files, uptime):
t = []
data = []
@ -31,21 +31,36 @@ def time_to_seconds(time_str):
return hh * 3600 + mm * 60 + ss
def clear_data(t, data, uptime):
#Data preparation: cut-off everything before long time differences (before initialization of STRATO3/4) and remove lines with Invalid entries
#Data preparation: cut-off everything before long time differences (before initialization of STRATO4)
#print(t, data)
for i in range(len(t)):
#print(t[i])
for j in range(len(t[i])):
try:
#time = datetime.datetime.strptime(t[i][j], "%H:%M:%S")
#t[i][j] = int(time.hour * 3600 + time.minute * 60 + time.second)
t[i][j] = time_to_seconds(t[i][j])
except:
t[i][j] = float(t[i][j])
#for string in data[i]:
# if string == "Inval.":
# t[i] = t[i][1:]
# for j in range(len(data[i])):
# data[i] = data[i][1:]
#data[i] = data[i][1:]
k = 0
while k < len(data[i]):
#for k in range(len(data[i][j]))
if data[i][k] == "Err" or data[i][k] == 'NA' or data[i][k] == "Inval.":
#print(data[i][j][k])
data[i] = np.delete(data[i], k)
t[i] = np.delete(t[i], k)
else:
k+=1
data[i] = data[i].astype(float)
#print(data[i][j])
#else:
# altitude_float.append(float(string))
t[i] = t[i].astype(float)
return t, data
@ -71,7 +86,6 @@ def f(x,a,b):
return a*x+b
#function to correct time to set release time to 0s
def onset_correction(t, data, thresh):
for i in range(len(t)):
start=0
@ -84,6 +98,8 @@ def onset_correction(t, data, thresh):
start+=1
end = np.argmax(data[i])
end = min(start+500,end)
#end = data[i].index(endval)
#print(start, end)
popt,pcov=opt.curve_fit(f,t[i][start:end],data[i][start:end])
#print(popt)
a,b=popt
@ -116,12 +132,17 @@ def mean(data, t):
def main():
#t, altitude = np.loadtxt("STRATO4/9_csv_data.csv", usecols=(2,7),unpack=True,skiprows=7,dtype='str',delimiter=';')
parser = argparse.ArgumentParser(description="Plot Data from STRATO4-Datalogger")
parser.add_argument("files", nargs="+", help="Dateipfade, die eingelesen werden sollen")
args = parser.parse_args()
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, True)
@ -137,6 +158,7 @@ def main():
mean_data = mean(data, t)
min_idx = min(enumerate(t), key=lambda x: len(x[1]))[0]
plot_mean(t[2], mean_data, ax)
#plt.gcf().autofmt_xdate()
layout(fig)

1
Skripte/testskript.py Normal file
View file

@ -0,0 +1 @@
#test