remove Single type, rework get stream

This commit is contained in:
l_samenv
2025-03-03 08:34:13 +01:00
parent a7797cbe6c
commit 31377dc933
3 changed files with 82 additions and 56 deletions

9
t.py
View File

@@ -1,7 +1,7 @@
import time
import math
import numpy as np
from sehistory.seinflux import SEHistory
from sehistory.seinflux import SEHistory, fmtime
from influx import RegExp
DAY = 24 * 3600
@@ -16,7 +16,6 @@ crv([start], [stop], [mod.par], ['float'], [interval=...,] [add_prev=False,] [ad
""")
now = int(time.time())
offset = (now // 3600) * 3600
result = {}
maxcurves = 7
maxpoints = 7
@@ -38,7 +37,7 @@ def prt():
print('...')
else:
for row in crv:
print(round(row[0] - offset, db.timedig), row[1:])
print(fmtime(row[0]), row[1:])
def qry(*args, **kwds):
@@ -97,9 +96,9 @@ def sry(prectime=False):
for end, start, _, device, stream, pset in sorted(summary):
if prectime:
res = db.query(start, end, device=device, stream=stream, single=-1)
first = int(min(t[0] for t in res.values()))
first = int(min(t[0][0] for t in res.values()))
res = db.query(start, end, device=device, stream=stream, single=1)
last = math.ceil(max(t[0] for t in res.values()))
last = math.ceil(max(t[0][0] for t in res.values()))
tm1 = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(first))
tm2 = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(last))
else: