Back to home page

EIC code displayed by LXR

 
 

    


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

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 Comparison of the old standard export with dpib shows the sagging vacuum
0023 very clearly:: 
0024 
0025     In [4]: run vacuum_offset.py
0026     /usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.dae
0027     /usr/local/env/geant4/geometry/export/dpib/cfg4.dae
0028     -46.992 128.0
0029     -20.9888 128.0
0030 
0031 
0032 """
0033 import os, sys, logging
0034 import numpy as np
0035 from opticks.ana.dae import DAE
0036 import matplotlib.pyplot as plt
0037  
0038 log = logging.getLogger(__name__)
0039 
0040 
0041 def zr_plot(ax, a):
0042     r = np.linalg.norm(a[:,:2], 2, 1) * np.sign(a[:,0] )
0043     z = a[:,2]
0044     zhead = z[z>z.min()]
0045     print zhead.min(), zhead.max()
0046     ax.plot(z, r, "o")
0047 
0048 
0049 if __name__ == '__main__':
0050 
0051     plt.close()
0052     plt.ion()
0053 
0054     path_0 = DAE.standardpath()
0055     path_1 = DAE.path("dpib", "cfg4.dae")
0056 
0057     print path_0
0058     print path_1
0059 
0060     dae_0 = DAE(path_0)
0061     a = dae_0.float_array("pmt-hemi-vac0xc21e248-Pos-array")
0062 
0063     dae_1 = DAE(path_1)
0064     b = dae_1.float_array("union-ab-i-6-fc-7-lc-110x7fd599d5e4b0-Pos-array")
0065 
0066     fig = plt.figure()
0067 
0068     ax = fig.add_subplot(1,1,1, aspect='equal')
0069     zr_plot(ax, a )
0070 
0071     #ax = fig.add_subplot(2,1,2, aspect='equal')
0072     zr_plot(ax, b )
0073 
0074 
0075