Exemplo n.º 1
0
def testgb():
    g = Graph()
    name1='JJCEX.ACS.PH.03.OAT'
    env = Graphenv()
    env.init()   
    L =[(name1,env.getSensorId(name1))]
    expr = '{0} + 1'      
    a = g.getRegular(L,'',expr)
    cs = "select(floor =6)"
    b = g.getRequest(cs,dtfilter='x.weekday in [1,2,3,4]')
    a.extend(b)
    print a
Exemplo n.º 2
0
def testgb():
    g = Graph()
    name1='JJCEX.ACS.PH.03.OAT'
    env = Graphenv()
    env.init()   
    L =[(name1,env.getSensorId(name1))]
    expr = '{0} + 1'      
    a = g.getRegular(L,'',expr)
    cs = "select(subtype = ['RM STPT DIAL','ROOM TEMP'], floor = 6, nexp = '47*',pattern ='({i} - {i+1})',cond='cmax(x,4)',maxn = 20)"
    b = g.getRequest(cs,dtfilter='x.weekday in [1,2,3,4]')
    a.extend(b)
    print a
Exemplo n.º 3
0
def graph(type,h,dtfilter,req,expression,mtype,maw,pct,mname,learn):
    keys= [(n,int(x)) for n,x in h]
    g = Graph()
    j0=g.getRequest(req,dtfilter)
    if type =='Moving Std':
        print "type",type
        j = g.getMSTF(keys,dtfilter,expression)
        ctype='StockChart'
    elif type =='Time Series':
        print type,keys
        j = g.getRegular(keys,dtfilter,expression,False)
        ctype='StockChart'
    elif type =='XY':
        print type,keys
        j = g.getXY(keys,dtfilter,expression)
        ctype='scatter'
    elif type =='Correl':
        print type,keys
        j = g.getCorrelations(keys,dtfilter,expression)
        ctype='StockChart'
    elif type =='Frequencies':
        print type,keys
        j = g.getFreq(keys,dtfilter,expression)
        ctype='Histogram'
    elif type =='Learn':
        print type,keys,mtype,maw
        j = g.getPredict(keys,dtfilter,expression,mtype,maw,float(pct),mname,learn)
        ctype='StockChart'
    elif type =='Table':
        print type,keys
        j = g.getRegular(keys,dtfilter,expression,False)
        ctype='Table'        
    else:
        return {}
    if not isinstance(j, str):
        j.extend(j0)
    return json.dumps(j),ctype