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