File indexing completed on 2026-04-09 07:49:06
0001
0002
0003 import os, numpy as np
0004 from opticks.ana.fold import Fold
0005
0006 MODE=int(os.environ.get("MODE","0"))
0007 print("A.MODE:%d" % MODE )
0008
0009 if MODE in [2,3]:
0010 from opticks.ana.pvplt import *
0011 import matplotlib.pyplot as mp
0012 pass
0013 print("B.MODE:%d" % MODE )
0014
0015 SIZE = np.array([1280, 720])
0016
0017 CHECK = os.environ.get("CHECK", "SmearNormal_SigmaAlpha")
0018
0019 if __name__ == '__main__':
0020 f = Fold.Load(symbol="f")
0021 print(repr(f))
0022
0023 a = getattr(f, CHECK)
0024 n = getattr(f, "%s_names" % CHECK )
0025 m = getattr(f, "%s_meta" % CHECK )
0026
0027 nj = a.shape[1]
0028 assert nj == 3
0029
0030 value = m.value[0] if hasattr(m,'value') else None
0031 valuename = m.valuename[0] if hasattr(m,'valuename') else None
0032
0033 label = "QSim_MockTest.sh : CHECK %s " % CHECK
0034 label += " white:%s %s:%s " % ( n[0], valuename, value )
0035
0036
0037 if MODE == 3:
0038 pl = pvplt_plotter(label=label)
0039 pvplt_viewpoint( pl )
0040
0041 pos = np.array( [[0,0,0]] )
0042 vec = np.array( [[0,0,1]] )
0043 pvplt_lines( pl, pos, vec )
0044
0045 pl.add_points( a , color="white" )
0046
0047 cpos = pl.show()
0048
0049 elif MODE == 2:
0050
0051 fig, ax = mp.subplots(figsize=SIZE/100.)
0052 fig.suptitle(label)
0053 ax.set_aspect("equal")
0054
0055 ax.scatter( a[:,0], a[:,1], s=0.1, c="b" )
0056 fig.show()
0057
0058 elif MODE == 1:
0059
0060 nrm = np.array( [0,0,1], dtype=np.float32 )
0061
0062
0063
0064 angle = np.arccos(np.dot( a, nrm ))
0065
0066 bins = np.linspace(0,0.4,100)
0067 h_angle = np.histogram(angle, bins=bins )[0]
0068
0069 fig, ax = mp.subplots(figsize=SIZE/100.)
0070 fig.suptitle(label)
0071
0072 if not h_angle is None:ax.plot( bins[:-1], h_angle, drawstyle="steps-post", label="h_angle" )
0073 ax.legend()
0074
0075 fig.show()
0076 pass
0077 pass
0078
0079