Merge of sandbox gui into analysis. Started csv_acp_pnl.
--HG-- branch : sandbox
This commit is contained in:
@@ -114,11 +114,16 @@ def num2sod(x):
|
|||||||
frac, integ = math.modf(x)
|
frac, integ = math.modf(x)
|
||||||
return frac * 86400
|
return frac * 86400
|
||||||
|
|
||||||
class Lohi:
|
class TimedLohi:
|
||||||
"""Time series online low and high detector."""
|
"""Time series online low and high detector.
|
||||||
def __init__(self, bias):
|
|
||||||
|
Confirms low/high candidates after timeout.
|
||||||
|
Time dependent.
|
||||||
|
"""
|
||||||
|
def __init__(self, bias, timeout = ONE_MINUTE):
|
||||||
assert(bias > 0)
|
assert(bias > 0)
|
||||||
self.bias = bias
|
self.bias = bias
|
||||||
|
self.timeout = timeout
|
||||||
self.low0 = None
|
self.low0 = None
|
||||||
self.high0 = None
|
self.high0 = None
|
||||||
self.prev_lohi = NONE
|
self.prev_lohi = NONE
|
||||||
@@ -162,7 +167,7 @@ class Lohi:
|
|||||||
self.lows.append(self.low0)
|
self.lows.append(self.low0)
|
||||||
self.lohis.append(self.low0)
|
self.lohis.append(self.low0)
|
||||||
self.prev_lohi = LOW
|
self.prev_lohi = LOW
|
||||||
if self.high0[1] < cdt - ONE_MINUTE and \
|
if self.high0[1] < cdt - self.timeout and \
|
||||||
((self.prev_lohi == LOW and \
|
((self.prev_lohi == LOW and \
|
||||||
self.high0[2] > self.lows[-1][2] + self.bias) or
|
self.high0[2] > self.lows[-1][2] + self.bias) or
|
||||||
(self.prev_lohi == HIGH and \
|
(self.prev_lohi == HIGH and \
|
||||||
@@ -172,7 +177,7 @@ class Lohi:
|
|||||||
self.highs.append(self.high0)
|
self.highs.append(self.high0)
|
||||||
self.lohis.append(self.high0)
|
self.lohis.append(self.high0)
|
||||||
self.prev_lohi = HIGH
|
self.prev_lohi = HIGH
|
||||||
if self.low0[1] < cdt - ONE_MINUTE and \
|
if self.low0[1] < cdt - self.timeout and \
|
||||||
((self.prev_lohi == LOW and \
|
((self.prev_lohi == LOW and \
|
||||||
self.low0[2] < self.lows[-1][2]) or
|
self.low0[2] < self.lows[-1][2]) or
|
||||||
(self.prev_lohi == HIGH and \
|
(self.prev_lohi == HIGH and \
|
||||||
@@ -403,7 +408,7 @@ class Main:
|
|||||||
self.ss = [ 0 ] * len(self.xs)
|
self.ss = [ 0 ] * len(self.xs)
|
||||||
self.gs = [ 0 ] * len(self.xs)
|
self.gs = [ 0 ] * len(self.xs)
|
||||||
|
|
||||||
self.mmh = Lohi(5)
|
self.mmh = TimedLohi(5)
|
||||||
self.osw = SlidingWindow(5)
|
self.osw = SlidingWindow(5)
|
||||||
|
|
||||||
self.w0 = 0
|
self.w0 = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user