File indexing completed on 2026-04-10 07:49:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
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
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
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