File indexing completed on 2026-04-09 07:49:07
0001
0002 """
0003 random_direction_marsaglia.py
0004 ==========================================
0005 ::
0006
0007 EYE=-1,-1,1 LOOK=0,0,0.5 PARA=1 ./QSimTest.sh ana
0008
0009
0010 """
0011 import os, numpy as np
0012 from opticks.ana.fold import Fold
0013 MODE = int(os.environ.get("MODE","0"))
0014
0015 if MODE in [2,3]:
0016 from opticks.ana.pvplt import *
0017 import pyvista as pv
0018 pass
0019
0020
0021 TEST = os.environ["TEST"]
0022 GUI = not "NOGUI" in os.environ
0023
0024
0025 if __name__ == '__main__':
0026 t = Fold.Load(symbol="t")
0027 print(repr(t))
0028
0029 q = t.q
0030
0031 lim = slice(0,10000)
0032
0033 print( " TEST : %s " % TEST)
0034 print( "q.shape %s " % str(q.shape) )
0035
0036
0037 if MODE == 3:
0038 print(" using lim for plotting %s " % lim )
0039 label = TEST
0040 pl = pvplt_plotter(label=label)
0041
0042
0043 pvplt_viewpoint( pl )
0044 pl.add_points( q[:,:3][lim] )
0045
0046
0047 outpath = os.path.expandvars("$FOLD/figs/%s.png" % label )
0048 outdir = os.path.dirname(outpath)
0049 if not os.path.isdir(outdir):
0050 os.makedirs(outdir)
0051 pass
0052
0053 print(" outpath: %s " % outpath )
0054 cp = pl.show(screenshot=outpath) if GUI else None
0055 pass
0056 pass