示例#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 = "{0};{1};{t}.hour"
    a = gr.getXY(L,'',expr)
    #a = gr.getPredict(L,'x.month == 7',expr,'SVM',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
文件: views.py 项目: QuicNYC/rscript
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