
'''
import sip
sip.setapi(u'QDate', 2)
sip.setapi(u'QDateTime', 2)
sip.setapi(u'QTime', 2)
sip.setapi(u'QUrl', 2)
sip.setapi(u'QVariant', 2)
sip.setapi(u'QString', 2)
sip.setapi(u'QTextStream', 2)
from mayavi import mlab
'''


import redis
import jsonArray
#import threading
import time
import numpy as np
#import matplotlib.pyplot as plt
#from mantid.simpleapi import *
#from matplotlib import mpl
#import canvas
#import matplotlib.pyplot as plt
import time
#from PyQt4 import QtCore, QtGui
#from PyQt4 import Qt
import sys


if __name__ == '__main__':
    #myapp=QtGui.QApplication(sys.argv)
    # ======Try to connect NEON server
    ip="10.1.33.141"
    port=9000

    r=redis.Redis(host=ip, port=port)
    #_neon=neonIO.connectNeon(ip, port, 10.0)
    
    value=[]
    json1=r.get("/GPPD/workspace/MantidData/instrument/x")
    json2=r.get("/GPPD/workspace/MantidData/instrument/y")
    json3=r.get("/GPPD/workspace/MantidData/instrument/z")
    json4=r.get("/GPPD/workspace/MantidData/instrument/value")
    x=jsonArray.jsonDecoder(json1)
    y=jsonArray.jsonDecoder(json2)
    z=jsonArray.jsonDecoder(json3)
    v=jsonArray.jsonDecoder(json4)
    print "2222"
    print np.array(x)
    print np.array(y)
    print np.array(z)
    print np.array(v)
    print type(y)
    print type(z)
    print type(v)
    print len(x), len(y), len(z), len(v)
    #print np.array(x), np.array(y), np.array(z), np.array(v)
    
    #print np.array(x), np.array(y), np.array(z), np.array(v)
    #for()

    #mlab.points3d(x, y, z, v, mode='point', scale_factor=0.5)
    #mlab.show()


    #sys.exit(myapp.exec_())

