Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:50

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 so.py: Load CPU emitsource "input photons"
0023 ================================================
0024 
0025 ::
0026 
0027     so.py --det PmtInBox --tag 10 --src torch 
0028     so.py --det dayabay  --tag 1  --src torch 
0029     so.py --det tboolean-torus  --tag 1  --src torch 
0030 
0031 Jump into interactive::
0032 
0033     ipython -i $(which so.py) -- --det tboolean-sphere --tag 1 --src torch 
0034 
0035 """
0036 import logging, sys
0037 log = logging.getLogger(__name__)
0038 
0039 from opticks.ana.base import opticks_main
0040 from opticks.ana.nload import A
0041 from opticks.ana.nbase import vnorm
0042 
0043 
0044 if __name__ == '__main__':
0045      args = opticks_main(src="torch", tag="1", det="tboolean-sphere")
0046 
0047      try:
0048          so = A.load_("so",args.src,args.tag,args.det)
0049      except IOError as err:
0050          log.fatal(err) 
0051          sys.exit(args.mrc)
0052 
0053      log.info("loaded so %s %s shape %s " %  (so.path, so.stamp, repr(so.shape)))
0054 
0055      print so
0056 
0057      v = so[:,0,:3]
0058 
0059      print "v",v
0060      print "vnorm(v)", vnorm(v)
0061 
0062