File indexing completed on 2026-04-09 07:48:47
0001
0002 import os, subprocess, lxml.etree as ET, numpy as np
0003 parse_ = lambda _:ET.parse(os.path.expandvars(_)).getroot()
0004 rc, gdmlpath = subprocess.getstatusoutput("bash -lc \"opticksaux-;opticksaux-dx1\"" )
0005 gdml = parse_(gdmlpath)
0006
0007
0008 effs = gdml.xpath("//matrix[starts-with(@name,'EFFICIENCY')]")
0009
0010 nn = []
0011 aa = []
0012
0013 for eff in effs:
0014
0015 name = eff.attrib['name']
0016 vals = eff.attrib['values']
0017 a = np.fromstring(vals, sep=' ').reshape(-1,2)
0018
0019 if True:
0020 nn.append(name)
0021 aa.append(a)
0022 pass
0023 pass
0024 print("matrix with max value greater than zero %d " % len(nn))
0025
0026 assert len(set(nn)) == len(nn), "looks like a non-unique efficiency name"
0027
0028 n = nn[0]
0029 a = aa[0]
0030
0031 print(n)
0032 print(a)
0033 print(" max %s " % a[:,1].max() )
0034
0035