add doc strings to SeaGraph.w_* methods
This commit is contained in:
17
seaweb.py
17
seaweb.py
@ -509,6 +509,11 @@ class SeaGraph:
|
|||||||
self.lastvalues[var] = (endtime, lastx)
|
self.lastvalues[var] = (endtime, lastx)
|
||||||
|
|
||||||
def w_graph(self, variables, time="-1800,0"):
|
def w_graph(self, variables, time="-1800,0"):
|
||||||
|
"""get given curves
|
||||||
|
|
||||||
|
variables: comma separated list of variables to get
|
||||||
|
time: comma separated time range (beg,end) values < 1 year are treated as relative to the current time
|
||||||
|
"""
|
||||||
time = [float(t) for t in time.split(',')]
|
time = [float(t) for t in time.split(',')]
|
||||||
self.last_t = 0
|
self.last_t = 0
|
||||||
start, end, now = seagraph.get_abs_time(time + [0])
|
start, end, now = seagraph.get_abs_time(time + [0])
|
||||||
@ -521,19 +526,24 @@ class SeaGraph:
|
|||||||
#self.time[0] = self.time[1]
|
#self.time[0] = self.time[1]
|
||||||
result = self.scanner.get_message(self.variables, self.time, show_empty=True)
|
result = self.scanner.get_message(self.variables, self.time, show_empty=True)
|
||||||
self.strip_future(result)
|
self.strip_future(result)
|
||||||
for var in ('treg.set.reg', 'mf'):
|
#for var in ('treg.set.reg', 'mf'):
|
||||||
curve = result.get(var,[(0,0)])
|
# curve = result.get(var,[(0,0)])
|
||||||
print(var, curve[0][0] - now, curve[-1][0] - now, curve)
|
# print(var, curve[0][0] - now, curve[-1][0] - now, curve)
|
||||||
self.complete_to_end(result, end)
|
self.complete_to_end(result, end)
|
||||||
self.time[0] = self.time[1]
|
self.time[0] = self.time[1]
|
||||||
# reduction not yet implemented
|
# reduction not yet implemented
|
||||||
return dict(type='graph-draw', reduced=False, graph=result)
|
return dict(type='graph-draw', reduced=False, graph=result)
|
||||||
|
|
||||||
def w_gettime(self, time):
|
def w_gettime(self, time):
|
||||||
|
"""parse time (using server time)
|
||||||
|
time: comma separated time range (beg,end) values < 1 year are treated as relative to the current time
|
||||||
|
"""
|
||||||
time = [float(t) for t in time.split(',')]
|
time = [float(t) for t in time.split(',')]
|
||||||
return dict(type='time', time= seagraph.get_abs_time(time))
|
return dict(type='time', time= seagraph.get_abs_time(time))
|
||||||
|
|
||||||
def w_getvars(self, time):
|
def w_getvars(self, time):
|
||||||
|
"""get the curves available at given time (unix timestamp as string)
|
||||||
|
"""
|
||||||
time = [float(t) for t in time.split(',')]
|
time = [float(t) for t in time.split(',')]
|
||||||
scanner = seagraph.VarsScanner(instrument.logger_dir, instrument.test_day)
|
scanner = seagraph.VarsScanner(instrument.logger_dir, instrument.test_day)
|
||||||
result = dict(type='var_list')
|
result = dict(type='var_list')
|
||||||
@ -541,6 +551,7 @@ class SeaGraph:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def w_updategraph(self):
|
def w_updategraph(self):
|
||||||
|
"""update live values""
|
||||||
logging.info("UPD GRAPH %d", self.livemode)
|
logging.info("UPD GRAPH %d", self.livemode)
|
||||||
if self.livemode == self.HISTORICAL:
|
if self.livemode == self.HISTORICAL:
|
||||||
return dict(type='accept-graph', live=False)
|
return dict(type='accept-graph', live=False)
|
||||||
|
Reference in New Issue
Block a user