File indexing completed on 2026-04-09 07:48:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 """
0022 tgltf.py : Shakedown analytic geometry
0023 ==========================================================
0024
0025 Loads test events from Opticks
0026
0027 Create the events by running tgltf-transitional
0028
0029 Huh, top of cyl-z should not be there::
0030
0031 In [8]: lpos[lpos[:,2] > 1500 ][:100]
0032 Out[8]:
0033 A()sliced
0034 A([[ -367.125 , 236.7812, 1535. , 1. ],
0035 [ 337. , -1032. , 1535. , 1. ],
0036 [ 568.8125, -1328.9688, 1535. , 1. ],
0037 [ 1212.875 , -858.375 , 1535. , 1. ],
0038 [ 137.0625, -371.6875, 1535. , 1. ],
0039 [ 849.6875, 997.6562, 1545.9814, 1. ],
0040 [ -936.5625, 868.7812, 1547.71 , 1. ],
0041 [ 196.3125, 411.9688, 1535. , 1. ],
0042 [ -55.625 , -304.75 , 1535. , 1. ],
0043 [ -144.5 , -538.3125, 1535. , 1. ],
0044 [ 1299.0625, -612.9375, 1535. , 1. ],
0045 [ -407.5 , 13.3438, 1535. , 1. ],
0046 [ 865.375 , 370.4062, 1535. , 1. ],
0047 [ 416.75 , 478.5938, 1535. , 1. ],
0048 [ 431.75 , 800.6875, 1535. , 1. ],
0049 [ -8.5625, 1549.9375, 1526.9644, 1. ],
0050 [ 948.25 , -512.3438, 1535. , 1. ],
0051 [ 229. , -32.5625, 1535. , 1. ],
0052 [-1007.125 , -461.25 , 1535. , 1. ],
0053 [ -74.6875, -607.125 , 1535. , 1. ],
0054 [ 503.625 , -807.9062, 1535. , 1. ],
0055 [ 160.125 , -1057.0625, 1535. , 1. ],
0056 [ -798.3125, 67.3125, 1535. , 1. ],
0057 [-1278.25 , 865.4062, 1535. , 1. ],
0058 [ -509.625 , 477.1562, 1535. , 1. ],
0059 [ -141.875 , 1289.5 , 1535. , 1. ],
0060
0061
0062
0063
0064 """
0065 import os, sys, logging, argparse, numpy as np
0066 import numpy.linalg as la
0067
0068 log = logging.getLogger(__name__)
0069
0070 from opticks.ana.base import opticks_main
0071 from opticks.ana.nbase import vnorm
0072 from opticks.ana.evt import Evt
0073
0074 from opticks.analytic.sc import gdml2gltf_main
0075
0076
0077 if __name__ == '__main__':
0078 np.set_printoptions(precision=4, linewidth=200)
0079
0080 os.environ['OPTICKS_QUERY']="range:3159:3160"
0081
0082 args = opticks_main(doc=__doc__, tag="1", src="torch", det="gltf" )
0083
0084 sc = gdml2gltf_main(args)
0085 tx = sc.get_transform(3159)
0086 print tx
0087
0088 itx = la.inv(tx)
0089 print itx
0090
0091
0092 log.info("tag %s src %s det %s " % (args.utag,args.src,args.det))
0093
0094
0095 seqs=[]
0096
0097 try:
0098 a = Evt(tag="%s" % args.utag, src=args.src, det=args.det, seqs=seqs, args=args)
0099 except IOError as err:
0100 log.fatal(err)
0101
0102 sys.exit(0)
0103
0104
0105 log.info( " a : %s " % a.brief)
0106
0107 print a.seqhis_ana.table
0108
0109 a.sel = "TO SA"
0110 ox = a.ox
0111
0112
0113 print ox.shape
0114
0115 pos = ox[:,0,:4]
0116 pos[:,3] = 1.
0117
0118 lpos = np.dot( pos, itx )
0119
0120
0121
0122
0123