Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/usr/bin/env python
0002 
0003 import os, numpy as np
0004 from opticks.ana.fold import Fold
0005 import matplotlib.pyplot as mp
0006 SIZE = np.array([1280, 720])
0007 
0008 MODE = int(os.environ.get("MODE", "1"))
0009 
0010 if __name__ == '__main__':
0011     af = Fold.Load("$AFOLD", symbol="af")
0012     bf = Fold.Load("$BFOLD", symbol="bf")
0013     cf = Fold.Load("$CFOLD", symbol="cf")
0014 
0015     print(repr(af))
0016     print(repr(bf))
0017     print(repr(cf))
0018 
0019     label = "QSim_MockTest_cf_S4OpBoundaryProcessTest.sh"  
0020     a_label = af.base 
0021     b_label = bf.base
0022     c_label = cf.base
0023 
0024     a = af.q[:,:3]
0025     b = bf.q[:,:3]
0026     c = cf.q[:,:3]
0027     
0028     nrm = np.array( [0,0,1], dtype=np.float32 )  ## unsmeared normal is +Z direction  
0029     ## dot product with Z direction picks Z coordinate 
0030     ## so np.arccos should be the final alpha 
0031 
0032     a_angle = np.arccos(np.dot( a, nrm ))  
0033     b_angle = np.arccos(np.dot( b, nrm ))  
0034     c_angle = np.arccos(np.dot( c, nrm ))  
0035 
0036     bins = np.linspace(0,0.4,100)  
0037     a_angle_h= np.histogram(a_angle, bins=bins )[0] 
0038     b_angle_h= np.histogram(b_angle, bins=bins )[0] 
0039     c_angle_h= np.histogram(c_angle, bins=bins )[0] 
0040 
0041     if MODE == 1:
0042         fig, ax = mp.subplots(figsize=SIZE/100.)
0043         fig.suptitle(label)
0044         ax.plot( bins[:-1], a_angle_h,  drawstyle="steps-post", label=a_label )
0045         ax.plot( bins[:-1], b_angle_h,  drawstyle="steps-post", label=b_label )
0046         ax.plot( bins[:-1], c_angle_h,  drawstyle="steps-post", label=c_label )
0047         ax.legend() 
0048         fig.show()
0049     else:
0050         print("not impl MODE %d " % MODE )
0051     pass
0052 
0053 
0054 
0055 
0056