Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/usr/bin/env python
0002 """
0003 bboxplt.py
0004 ============
0005 
0006 This uses the 3d capabilities of matplotlib.
0007 For better performance try: vtkbboxplt.py
0008 
0009 The slowness of this visualization even with a small number
0010 (few hundred) of global volumes prompted me to try installing mayavi
0011 and dependencies via miniconda3 with python37.
0012 Mayavi did not work (giving blank OpenGL windows) 
0013 but in the process I got vtk and pyvista working 
0014 which provides fast and convenient 3d viz.
0015 
0016 
0017 """
0018 import numpy as np, os
0019 import matplotlib.pyplot as plt 
0020 
0021 from opticks.ana.plt3d import polyplot
0022 from opticks.ana.cube import make_cube
0023 from opticks.ana.ggeo import GGeo
0024 
0025 if __name__ == '__main__':
0026 
0027     plt.ion()
0028 
0029     fig = plt.figure()
0030     ax = fig.add_subplot(111, projection='3d')
0031     ax.set_xlabel("x")
0032     ax.set_ylabel("y")
0033     ax.set_zlabel("z")
0034 
0035     gc = GGeo()
0036     bbox = gc.bbox
0037     identity = gc.identity
0038 
0039     #s_bbox = bbox[identity[:,1] == 16]
0040     s_bbox = bbox[:197]
0041 
0042 
0043     for i in range(len(s_bbox)):
0044         bb = s_bbox[i]
0045         v,f,i = make_cube(bb)
0046         polyplot(ax, v, f)
0047     pass
0048     plt.show()
0049   
0050