Back to home page

EIC code displayed by LXR

 
 

    


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

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 tevt.py : Loads a single event
0023 ===================================================
0024 
0025 Expected output below shows the dimensions of the constitent numpy arrays that comprise the event::
0026 
0027     Evt(-4,"torch","PmtInBox","PmtInBox/torch/-4 : ", seqs="[]")
0028      fdom :            (3, 1, 4) : (metadata) 3*float4 domains of position, time, wavelength (used for compression) 
0029      idom :            (1, 1, 4) : (metadata) int domain 
0030        ox :       (100000, 4, 4) : (photons) final photon step 
0031        wl :            (100000,) : (photons) wavelength 
0032      post :          (100000, 4) : (photons) final photon step: position, time 
0033      dirw :          (100000, 4) : (photons) final photon step: direction, weight  
0034      polw :          (100000, 4) : (photons) final photon step: polarization, wavelength  
0035     flags :            (100000,) : (photons) final photon step: flags  
0036        c4 :            (100000,) : (photons) final photon step: dtype split uint8 view of ox flags 
0037     rx_raw :   (100000, 10, 2, 4) : (records) photon step records RAW:before reshaping 
0038        rx :   (100000, 10, 2, 4) : (records) photon step records 
0039        ph :       (100000, 1, 2) : (records) photon history flag/material sequence 
0040        ps :       (100000, 1, 4) : (photons) phosel sequence frequency index lookups (uniques 30) 
0041        rs :   (100000, 10, 1, 4) : (records) RAW recsel sequence frequency index lookups (uniques 30) 
0042       rsr :   (100000, 10, 1, 4) : (records) RESHAPED recsel sequence frequency index lookups (uniques 30) 
0043 
0044 
0045 """
0046 import os, sys, logging, numpy as np
0047 log = logging.getLogger(__name__)
0048 
0049 from opticks.ana.base import opticks_main
0050 from opticks.ana.evt import Evt
0051 
0052 if __name__ == '__main__':
0053     args = opticks_main(tag="10",src="torch", det="PmtInBox", doc=__doc__)
0054     np.set_printoptions(suppress=True, precision=3)
0055 
0056     for utag in args.utags:
0057         try:
0058             evt = Evt(tag=utag, src=args.src, det=args.det, seqs=[], args=args)
0059         except IOError as err:
0060             log.fatal(err)
0061             sys.exit(args.mrc)
0062 
0063         log.debug("evt") 
0064         print evt
0065         log.debug("evt.history_table") 
0066         evt.history_table(slice(0,20))
0067         log.debug("evt.history_table DONE") 
0068        
0069