Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:49:16

0001 #!/usr/bin/env python
0002 #
0003 # Copyright (c) 2019 Opticks Team. All Rights Reserved.
0004 #
0005 # This file is part of Opticks
0006 # (see https://bitbucket.org/simoncblyth/opticks).
0007 #
0008 # Licensed under the Apache License, Version 2.0 (the "License"); 
0009 # you may not use this file except in compliance with the License.  
0010 # You may obtain a copy of the License at
0011 #
0012 #   http://www.apache.org/licenses/LICENSE-2.0
0013 #
0014 # Unless required by applicable law or agreed to in writing, software 
0015 # distributed under the License is distributed on an "AS IS" BASIS, 
0016 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0017 # See the License for the specific language governing permissions and 
0018 # limitations under the License.
0019 #
0020 
0021 """
0022 
0023 Mesh Structural Comparisons
0024 =============================
0025 
0026 
0027 ::
0028 
0029     In [4]: run mesh.py
0030     INFO:__main__:base /usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.96ff965744a2f6b78c24e33c80d3a4cd.dae/GMergedMesh/1 
0031     [[ 720  362 3199 3155]
0032      [ 672  338 3200 3199]
0033      [ 960  482 3201 3200]
0034      [ 480  242 3202 3200]
0035      [  96   50 3203 3200]]
0036     INFO:__main__:base /tmp/GMergedMesh/baseGeometry 
0037     [[ 720  362 3199 3155]
0038      [ 672  338 3200 3199]
0039      [ 960  482 3201 3200]
0040      [ 480  242 3202 3200]
0041      [  96   50 3203 3200]]
0042     WARNING:__main__:NO PATH /tmp/GMergedMesh/modifyGeometry/iidentity.npy 
0043     INFO:__main__:base /tmp/GMergedMesh/modifyGeometry 
0044     [[       720        362       3199       3155]
0045      [       672        338       3200       3199]
0046      [       960        482       3201       3200]
0047      [       480        242       3202       3200]
0048      [        96         50       3203       3200]
0049      [        12         24          0 4294967295]]
0050     WARNING:__main__:NO PATH /usr/local/env/geant4/geometry/export/dpib/cfg4.f7ba6061a8e024189e641c86eb847ee4.dae/GMergedMesh/0/aiidentity.npy 
0051     WARNING:__main__:NO PATH /usr/local/env/geant4/geometry/export/dpib/cfg4.f7ba6061a8e024189e641c86eb847ee4.dae/GMergedMesh/0/iidentity.npy 
0052     WARNING:__main__:NO PATH /usr/local/env/geant4/geometry/export/dpib/cfg4.f7ba6061a8e024189e641c86eb847ee4.dae/GMergedMesh/0/itransforms.npy 
0053     INFO:__main__:base /usr/local/env/geant4/geometry/export/dpib/cfg4.f7ba6061a8e024189e641c86eb847ee4.dae/GMergedMesh/0 
0054     [[         0          0          0 4294967295]
0055      [       720        362          1          0]
0056      [       720        362          2          1]
0057      [       960        482          3          2]
0058      [       576        288          4          2]
0059      [         0          0          5          2]]
0060 
0061 
0062 """
0063 
0064 import os, logging
0065 import numpy as np
0066 
0067 from opticks.ana.base import opticks_environment
0068 from opticks.ana.mergedmesh import MergedMesh
0069 import matplotlib.pyplot as plt
0070 
0071 log = logging.getLogger(__name__)
0072 
0073 if __name__ == '__main__':
0074 
0075     logging.basicConfig(level=logging.INFO)
0076     opticks_environment()
0077 
0078     DPIB_ALL = os.path.expandvars("$IDPATH_DPIB_ALL");
0079     DPIB_PMT = os.path.expandvars("$IDPATH_DPIB_PMT");
0080 
0081     bases = ["$IDPATH/GMergedMesh/1",
0082              "/tmp/GMergedMesh/baseGeometry",
0083              "/tmp/GMergedMesh/modifyGeometry",
0084              os.path.join(DPIB_ALL,"GMergedMesh/0"),
0085              os.path.join(DPIB_PMT,"GMergedMesh/0"),
0086            ]
0087 
0088     for base in bases:
0089         base = os.path.expandvars(base) 
0090         if not os.path.exists(base):continue
0091 
0092         mm = MergedMesh(base=base)
0093         if base.find(DPIB_ALL)>-1 or base.find(DPIB_PMT)>0:
0094             mm.node_offset = 1
0095         else:
0096             mm.node_offset = 0
0097         pass
0098         log.info("base %s " % base)
0099         print  "nodeinfo\n", mm.nodeinfo.view(np.int32)
0100         nv = mm.nodeinfo[:,1].sum()
0101         print  "nvert %5d v.shape %s " % (nv, repr(mm.vertices.shape))
0102         #print  "ce\n", mm.center_extent
0103 
0104         print "itransforms\n",mm.itransforms
0105         print "iidentity\n",mm.iidentity
0106         print "aiidentity\n", mm.aiidentity
0107 
0108 
0109         
0110 
0111         
0112 
0113 
0114 
0115