Пример #1
0
def test():
    env = Graphenv()
    env.init()
    name1='JJCEX.ACS.PH.03.OAT'
    name2= 'JJCEX.ACS.PH.04.OAT'
    name3 = 'JJCEX.ACS.PH.03.COOLING.VLV'
    name4 = 'JJCEX.ACS.PH.03.STEAM.VLV.2'

    L =[(name1,env.getSensorId(name1)),\
        (name2,env.getSensorId(name2))]
    gr = Graph()



    #print a[0].head()
    expr = "pdata.apply(P.test1,axis=1)"
    a = gr.getRegular(L,'',expr)
    #a = gr.getPredict(L,'x.month == 7','','Ada Boost',4,30,'ada1',True)

    #b = gr.getPredict(L,'x.month == 9','','Ada Boost',4,0,'svm1',False)

    print a

    #a = gr.getCorrelations(L,expr)

    #ex = gr.getMSTF(L,expr)
    #ex = gr.getExpression(L,expr,a,True)
    #print a
    return a
Пример #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(floor =6)"
    b = g.getRequest(cs,dtfilter='x.weekday in [1,2,3,4]')
    a.extend(b)
    print a
Пример #3
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
Пример #4
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