File indexing completed on 2026-04-09 07:49:03
0001
0002 """
0003 G4CXRenderTest.py
0004 ===================
0005
0006
0007 : t.isect : (1080, 1920, 4) : 0:00:34.591314
0008 : t.photon : (1080, 1920, 4, 4) : 0:00:33.933167
0009
0010
0011 isect::
0012
0013 In [9]: np.unique( t.isect[:,:,3].view(np.int32), return_counts=True )
0014 Out[9]: (array([ 65536, 131072], dtype=int32), array([1993260, 80340]))
0015
0016 In [10]: 0xffff
0017 Out[10]: 65535
0018
0019 In [11]: "%x" % 131072
0020 Out[11]: '20000'
0021
0022
0023 The "frame photons" are unfilled::
0024
0025 In [13]: t.photon[0,0]
0026 Out[13]:
0027 array([[0., 0., 0., 0.],
0028 [0., 0., 0., 0.],
0029 [0., 0., 0., 0.],
0030 [0., 0., 0., 0.]], dtype=float32)
0031
0032 In [14]: np.all( t.photon == 0. )
0033 Out[14]: True
0034
0035 In [15]: t.photon.shape
0036 Out[15]: (1080, 1920, 4, 4)
0037
0038
0039 """
0040 import os, numpy as np
0041 from opticks.ana.fold import Fold
0042 from opticks.ana.pvplt import *
0043
0044
0045 if __name__ == '__main__':
0046 t = Fold.Load(symbol="t")
0047 print(t)
0048
0049 pxpos = t.isect[:,:,:3]
0050 pxidd = t.isect.view(np.uint32)[:,:,3] >> 16
0051
0052 pos = pxpos.reshape(-1,3)
0053 idd = pxidd.ravel()
0054
0055 pl = pvplt_plotter()
0056
0057
0058
0059
0060 pc = pv.PolyData(pos, eye_dome_lighting=True)
0061 pc["idd"] = idd
0062
0063 pl.add_mesh(pc, render_points_as_spheres=True )
0064
0065
0066 pl.show()
0067
0068
0069