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 optickscore-/tests/IndexerTest 
0023 ================================
0024 
0025 GPU and CPU indices mismatch
0026 -----------------------------
0027 
0028 Maybe a stable sort type of issue.
0029 
0030 In any case discrepancies are all in the low frequency of occurence tail, 
0031 so probably acceptable.
0032 
0033 ::
0034 
0035     seqhis
0036     [[ 28  29]
0037      [ 22  23]
0038      [ 23  22]
0039      [ 32 255]
0040      [ 23  22]
0041      [ 28  29]
0042      [255  32]
0043      [ 31  30]
0044      [ 22  23]
0045      [ 23  22]
0046      [ 31  30]
0047      [ 23  22]
0048      [ 23  22]
0049      [ 22  23]
0050      [ 22  23]
0051      [ 31  30]
0052      [ 29  31]
0053      [ 23  22]
0054      [ 32 255]
0055      [ 22  23]
0056      [255  32]
0057      [ 22  23]
0058      [ 28  29]
0059      [ 22  23]
0060      [ 23  22]
0061      [ 29  31]
0062      [ 30  28]
0063      [ 30  28]
0064      [ 30  28]
0065      [ 29  31]]
0066 
0067 """
0068 import os, logging, numpy as np
0069 log = logging.getLogger(__name__)
0070 
0071 from opticks.ana.ana import Evt
0072 
0073 def compare(a, b):
0074     return np.vstack([a,b]).T[a != b]
0075 
0076 
0077 if __name__ == '__main__':
0078 
0079     typ = "torch" 
0080     tag = "4" 
0081     det = "dayabay" 
0082     cat = "PmtInBox"  
0083 
0084     evt = Evt(tag=tag, src=typ, det=cat)
0085     print evt
0086     ps = np.load("/tmp/phosel.npy")
0087 
0088     print "seqhis\n", compare(evt.ps[:,0,0], ps[:,0,0])
0089     print "seqmat\n", compare(evt.ps[:,0,1], ps[:,0,1])
0090 
0091     
0092 
0093