mirror of
https://github.com/FAUSheppy/ths-datenlogger
synced 2025-12-09 21:28:31 +01:00
Combination of datapoints implemented
This commit is contained in:
committed by
atlantispc_sheppy
parent
ab24cb843f
commit
77bc8f6ef5
@@ -27,11 +27,33 @@ class Data:
|
|||||||
i = 0
|
i = 0
|
||||||
if(len(self.times) != len(self.data)):
|
if(len(self.times) != len(self.data)):
|
||||||
raise RuntimeError("len(timestamps) != len(data), cannot continue, this should never happen")
|
raise RuntimeError("len(timestamps) != len(data), cannot continue, this should never happen")
|
||||||
while(i<len(self.times)):
|
if(len(self.times) <= 2):
|
||||||
if callback(self.times[i],date1,date2):
|
print("WARNING: No Data for %s!"%self.name)
|
||||||
out_x += [ self.times[i] ]
|
return (None,None)
|
||||||
out_y += [ self.data[i] ]
|
############ AVERAGE OUT DATA #############
|
||||||
i += 1
|
if(CFG("combine_data_points") >= (self.times[1] - self.times[0]).total_seconds()):
|
||||||
|
x_dp = 5
|
||||||
|
m_t = 3
|
||||||
|
while(i+x_dp<len(self.times)):
|
||||||
|
# check middle time #
|
||||||
|
if callback(self.times[i+m_t],date1,date2):
|
||||||
|
subset=0
|
||||||
|
subset_data=0.0
|
||||||
|
subset_time=timedelta(0)
|
||||||
|
while subset < x_dp:
|
||||||
|
subset_data += self.data [i+subset]
|
||||||
|
subset_time += self.times[i+subset]-datetime(2000,1,1)
|
||||||
|
subset += 1
|
||||||
|
out_x += [ subset_time/x_dp + datetime(2000,1,1) ]
|
||||||
|
out_y += [ subset_data/x_dp ]
|
||||||
|
i += x_dp
|
||||||
|
############ AVERAGE OUT DATA ###########
|
||||||
|
else:
|
||||||
|
while(i<len(self.times)):
|
||||||
|
if callback(self.times[i],date1,date2):
|
||||||
|
out_x += [ self.times[i] ]
|
||||||
|
out_y += [ self.data[i] ]
|
||||||
|
i += 1
|
||||||
return (out_x,out_y)
|
return (out_x,out_y)
|
||||||
|
|
||||||
## no idea on what kind of drugs I was when i wrote this function (it is somewhat ingenious though) ##
|
## no idea on what kind of drugs I was when i wrote this function (it is somewhat ingenious though) ##
|
||||||
@@ -144,7 +166,6 @@ def csvread_txt(path,datapoints,pt,ph,pd):
|
|||||||
row_arg = list(map(lambda s:s.replace(" ","").replace(",","."),l.split("\t")))
|
row_arg = list(map(lambda s:s.replace(" ","").replace(",","."),l.split("\t")))
|
||||||
row = {"temp":None,"hum":None,"taupunkt":None,"datetime":None}
|
row = {"temp":None,"hum":None,"taupunkt":None,"datetime":None}
|
||||||
row["datetime"] = "%s-%s-%s_%s:%s"%(row_arg[0],row_arg[1],row_arg[2],row_arg[3],row_arg[4])
|
row["datetime"] = "%s-%s-%s_%s:%s"%(row_arg[0],row_arg[1],row_arg[2],row_arg[3],row_arg[4])
|
||||||
print(row["datetime"])
|
|
||||||
row["temp"] = float(row_arg[6])
|
row["temp"] = float(row_arg[6])
|
||||||
row["hum"] = float(row_arg[7])
|
row["hum"] = float(row_arg[7])
|
||||||
row["taupunkt"] = 0.0
|
row["taupunkt"] = 0.0
|
||||||
|
|||||||
@@ -117,3 +117,5 @@ use_gui_backend = Agg
|
|||||||
enable_multicore_support = False
|
enable_multicore_support = False
|
||||||
raster_alligment_auto = True
|
raster_alligment_auto = True
|
||||||
outfile_resolution_in_dpi = 250
|
outfile_resolution_in_dpi = 250
|
||||||
|
# <= what stepsize should datapoints be combined (s)
|
||||||
|
combine_data_points = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user