Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:17

0001 #!/usr/bin/env python
0002 """
0003 SEventTest.py
0004 =================
0005 
0006 ::
0007 
0008     ~/o/sysrap/tests/SEventTest.sh pdb 
0009 
0010 """
0011 
0012 import os, numpy as np
0013 from opticks.ana.fold import Fold
0014 
0015 try:
0016     import pyvista as pv
0017 except ImportError:
0018     pv = None
0019 pass
0020 
0021 
0022 
0023 def test_transform():
0024     dtype = np.float32
0025     p0 = np.array([1,2,3,1], dtype)
0026     p1 = np.zeros( (len(cegs), 4), dtype ) 
0027     p1x = cegs[:,1]
0028 
0029     # transform p0 by each of the genstep transforms 
0030     for i in range(len(cegs)): p1[i] = np.dot( p0, cegs[i,2:] )
0031     pos = p1[:,:3]   
0032     return pos 
0033 
0034 def test_ppa(t):
0035     pos = t.ppa[:,0,:3]
0036     dir = t.ppa[:,1,:3]
0037     #pv = None
0038 
0039     if not pv is None:
0040         size = np.array([1280, 720])
0041         pl = pv.Plotter(window_size=size*2 ) 
0042         pl.add_points( pos, color='#FF0000', point_size=10.0 ) 
0043         pl.add_arrows( pos, dir, mag=50, color='#00FF00', point_size=1.0 ) 
0044         pl.show_grid()
0045         cp = pl.show()    
0046     pass
0047 
0048 
0049 
0050 if __name__ == '__main__':
0051     TEST = os.environ["TEST"]
0052     print("TEST:%s" % TEST) 
0053     t = Fold.Load("$FOLD", symbol="t")
0054     print(t)
0055 
0056     if TEST == "MakeTorchGenstep":
0057         a = t.torch
0058         print("a = t.torch\n",a)
0059         print("a.shape\n", a.shape) 
0060         e = "a[:,0].view(np.int32)"
0061         print(e,"\n",eval(e))
0062     pass
0063    
0064 
0065  
0066 
0067