File indexing completed on 2026-04-09 07:49:06
0001
0002 """
0003 QEvtTest.py
0004 =================
0005
0006 ::
0007
0008 ipython -i tests/QEvtTest.py
0009
0010 """
0011
0012 import os, numpy as np
0013
0014 try:
0015 import pyvista as pv
0016 except ImportError:
0017 pv = None
0018 pass
0019
0020
0021 class QEvtTest(object):
0022 FOLD = os.path.expandvars("/tmp/$USER/opticks/qudarap/QEvtTest")
0023 def __init__(self, fold=FOLD):
0024 names = os.listdir(fold)
0025 stems = []
0026 for name in filter(lambda n:n.endswith(".npy"), names):
0027 stem = name[:-4]
0028 path = os.path.join(fold, name)
0029 a = np.load(path)
0030 print(" %10s : %15s : %s " % (stem, str(a.shape), path ))
0031 globals()[stem] = a
0032 setattr( self, stem, a )
0033 stems.append(stem)
0034 pass
0035 self.stems = stems
0036 def dump(self):
0037 for stem in self.stems:
0038 a = getattr(self, stem)
0039 print(stem)
0040 print(a)
0041
0042 pass
0043
0044
0045 def test_transform():
0046 dtype = np.float32
0047 p0 = np.array([1,2,3,1], dtype)
0048 p1 = np.zeros( (len(cegs), 4), dtype )
0049 p1x = cegs[:,1]
0050
0051
0052 for i in range(len(cegs)): p1[i] = np.dot( p0, cegs[i,2:] )
0053 pos = p1[:,:3]
0054 return pos
0055
0056
0057
0058
0059
0060 if __name__ == '__main__':
0061 t = QEvtTest()
0062 t.dump()
0063
0064 pos = ppa[:,0,:3]
0065 dir = ppa[:,1,:3]
0066
0067
0068 if not pv is None:
0069 size = np.array([1280, 720])
0070 pl = pv.Plotter(window_size=size*2 )
0071 pl.add_points( pos, color='#FF0000', point_size=10.0 )
0072 pl.add_arrows( pos, dir, mag=50, color='#00FF00', point_size=1.0 )
0073 pl.show_grid()
0074 cp = pl.show()
0075 pass
0076
0077
0078