Back to home page

EIC code displayed by LXR

 
 

    


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

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 tconcentric_distrib.py 
0023 =============================================
0024 
0025 ::
0026 
0027     tconcentric-d --noplot --sel 0:20   
0028     tconcentric-d --noplot --sel 0:40
0029     tconcentric-d --noplot --sel 0:100
0030 
0031     # make rst chi2 table for all records of first many seq lines, 
0032     #  (142 recline for 0:20, 295 for 0:40, 897 for 0:100)
0033     #
0034     # skipping the plotting makes this fast, allowing 
0035     # chi2 distrib comparisons to be made for many thousands
0036     # of distribs in seconds 897*8 = 7176 
0037 
0038 
0039 Issue with hexchar irec, fail to write into a,b,c...::
0040 
0041     tconcentric-d --noplot --sel 11:12
0042 
0043     delta:ana blyth$ ll /tmp/blyth/opticks/CFH/concentric/1/TO_BT_BT_BT_BT_DR_BT_BT_BT_BT_BT_BT_BT_BT_SA/
0044     total 0
0045     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 9
0046     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 8
0047     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 7
0048     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 6
0049     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 5
0050     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 4
0051     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 3
0052     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 2
0053     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 1
0054     drwxr-xr-x  10 blyth  wheel  340 Nov 14 18:03 0
0055 
0056 
0057 
0058 """
0059 import os, sys, logging, numpy as np
0060 log = logging.getLogger(__name__)
0061 
0062 try:
0063     import matplotlib.pyplot as plt
0064     plt.rcParams['figure.figsize'] = 18,10.2   # plt.gcf().get_size_inches()   after maximize
0065     import matplotlib.gridspec as gridspec
0066 except ImportError:
0067     print "matplotlib missing : you need this to make plots"
0068     plt = None 
0069 
0070 from opticks.ana.base import opticks_main
0071 from opticks.ana.nbase import vnorm
0072 from opticks.ana.evt  import Evt
0073 from opticks.ana.ab import AB 
0074 from opticks.ana.cfplot import cfplot, qwns_plot, multiplot
0075 
0076 
0077 if __name__ == '__main__':
0078     ok = opticks_main(sel="0:5")
0079     log.info(" ok %s " % repr(ok.brief))
0080 
0081     plt.ion()
0082     plt.close()
0083 
0084     try:
0085         ab = AB(ok)
0086     except IOError as err:
0087         log.fatal(err)
0088         sys.exit(ok.mrc)
0089     
0090     print ab
0091 
0092     log.info(" sel %r qwn %s qwns %s " % (ok.sel, ok.qwn, ok.qwns )) 
0093 
0094     st = ab.stats( ok.sel.start, ok.sel.stop, ok.qwn, rehist=ok.rehist )
0095     
0096     #print st 
0097     print st[st.chi2sel()]
0098 
0099     if ok.plot:
0100         multiplot(ok, ab, ok.sel.start, ok.sel.stop, ok.qwn )
0101     else:
0102         log.info("plotting skipped by --noplot option")
0103     pass
0104 
0105