Compare commits

..

2 commits

Author SHA1 Message Date
a3166caa12 removed test code and added comments 2026-03-24 10:37:36 +01:00
15d0c41fdb removed empty script 2026-03-24 10:37:02 +01:00
2 changed files with 3 additions and 26 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,36 +31,21 @@ 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 STRATO4)
#print(t, data)
#Data preparation: cut-off everything before long time differences (before initialization of STRATO3/4) and remove lines with Invalid entries
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
@ -86,6 +71,7 @@ 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
@ -98,8 +84,6 @@ 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
@ -132,17 +116,12 @@ 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)
@ -158,7 +137,6 @@ 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)

View file

@ -1 +0,0 @@
#test