Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:53

0001 #!/usr/bin/env python
0002 
0003 import sys, numpy as np
0004 
0005 class CSGSolid(object):
0006     def __init__(self, i, item):
0007         self.i = i 
0008         self.label = item[:4].tobytes().decode("utf-8")   
0009         ## smth funny about label, needs truncation at \0 perhaps ?
0010 
0011         self.numPrim = item[4]
0012         self.primOffset = item[5]
0013         self.type = item[6]
0014         self.padding = item[7]
0015 
0016         self.cx = item[8].view(np.float32)
0017         self.cy = item[9].view(np.float32)
0018         self.cz = item[10].view(np.float32)
0019         self.ex = item[11].view(np.float32)
0020 
0021     def __repr__(self):
0022         fmt = "CSGSolid(%d) numPrim:%3d primOffset:%4d center:(%10.4f,%10.4f,%10.4f) extent:%10.4f  label [%-20s] "
0023         return fmt % ( self.i, self.numPrim, self.primOffset, self.cx, self.cy, self.cz, self.ex, self.label )
0024 
0025 
0026 if __name__ == '__main__':
0027 
0028     path = sys.argv[1]
0029     a = np.load(path)
0030 
0031     print(path)
0032     print(a.shape)
0033 
0034     for i in range(len(a)):
0035         so = CSGSolid(i, a[i])
0036         print(so)
0037     pass
0038 
0039