Ejemplo n.º 1
0
def test_range():
    #q = "index:3159,depth:1"
    q = "range:3158:3160"
    if q is not None:
        os.environ['OPTICKS_QUERY'] = q
    pass

    args = opticks_main()
    sc = gdml2gltf_main(args)

    nd = sc.get_node(3159)
    tx = sc.get_transform(3159)

    print nd.mesh.csg.txt
    print to_pyline(nd.gtr_mdot_r, "gtr")

    print tx


::

   ipython -i  OInterpolationTest_identity.py

"""

import os, numpy as np
from opticks.ana.base import opticks_main
from opticks.ana.proplib import PropLib

if __name__ == '__main__':

    args = opticks_main()


    base = "$TMP/interpolationTest"
    blib = PropLib.load_GBndLib(base)
    names = blib.names

    t = blib.data # boundary texture data

    ext, nl = "identity", 39

    #oname = "OInterpolationTest_%s.npy" % ext
    oname = "interpolationTest_%s.npy" % ext
    cname = "CInterpolationTest_%s.npy" % ext

    o = np.load(os.path.expandvars(os.path.join(base,oname))).reshape(-1,4,2,nl,4) 
Ejemplo n.º 3
0
#

"""
tdefault.py 
=============================================

Loads test events from Opticks and Geant4 and 
created by OKG4Test and 
compares their bounce histories.

"""
import os, sys, logging, argparse, numpy as np
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.nbase import vnorm
from opticks.ana.evt  import Evt
from opticks.ana.cf   import CF


if __name__ == '__main__':
    np.set_printoptions(precision=4, linewidth=200)

    args = opticks_main(doc=__doc__, tag="1", src="torch", det="default", c2max=2.0, tagoffset=0,  dbgseqhis=0)
    log.info("tag %s src %s det %s c2max %s  " % (args.utag,args.src,args.det, args.c2max))

    cf = CF(tag=args.tag, src=args.src, det=args.det)



Ejemplo n.º 4
0
        else:
            dirpol(ab, fr, fr + 1)
            poldot(ab, fr)
        pass
    elif len(pfxseqmat) > 0:
        log.info(" pfxseqmat [%s] " % (pfxseqmat))
        ab.flv = "seqmat"
        ab.sel = pfxseqmat
    else:
        pass


if __name__ == '__main__':
    ok = opticks_main(doc=__doc__,
                      tag="1",
                      src="torch",
                      det="concentric",
                      smry=True)

    print "ok.smry %d " % ok.smry
    log.info(ok.brief)

    ab = AB(ok)
    print ab

    if not ok.ipython:
        log.info("early exit as non-interactive")
        sys.exit(0)

    debug_plotting(ok, ab)
Ejemplo n.º 5
0
::

    ox.py --det PmtInBox --tag 10 --src torch 
    ox.py --det dayabay  --tag 1  --src torch 
    ox.py --det tboolean-torus  --tag 1  --src torch 

Jump into interactive::

    ipython -i $(which ox.py) -- --det PmtInBox --tag 10 --src torch 

"""
import logging, sys
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.nload import A

if __name__ == '__main__':
    args = opticks_main(src="torch", tag="10", det="PmtInBox")

    try:
        ox = A.load_("ox", args.src, args.tag, args.det)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info("loaded ox %s %s shape %s " % (ox.path, ox.stamp, repr(ox.shape)))

    print ox
Ejemplo n.º 6
0
        R = self.rval(U)

        X = R*np.cos(V)
        Y = R*np.sin(V)
        Z = U

        ax.plot_surface(X, Y, Z, alpha=0.3, color='red', rstride=6, cstride=12)





if __name__ == '__main__':

    args = opticks_main(csgpath="$TMP/cubic_py")

    CSG.boundary = args.testobject
    CSG.kwa = dict(poly="IM", resolution="50")

    container = CSG("box", param=[0,0,0,200], boundary=args.container, poly="MC", nx="20" )

    cubic = Cubic(A=1, B=10, C=100, D=400, z1=-10, z2=10) 
    log.info("cubic:%r " % cubic )
    a = cubic.as_csg()   

    #zrrs = [[-100,30],[-50,80],[50,30],[100,100]]
    #a = CSG.MakeCubicBezier(zrrs)

    CSG.Serialize([container, a], args.csgpath )
Ejemplo n.º 7
0
"""
import os, logging
import numpy as np
import matplotlib.pyplot as plt

from opticks.ana.base import opticks_main
from opticks.ana.nload import A, I, II, path_

log = logging.getLogger(__name__)

X, Y, Z, W, T = 0, 1, 2, 3, 3

if __name__ == '__main__':

    args = opticks_main(det="juno", src="cerenkov", tag="1")

    try:
        a = A.load_("gensteps", args.src, args.tag, args.det)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info("loaded gensteps %s %s %s " % (a.path, a.stamp, repr(a.shape)))

    #path = os.path.expandvars("$LOCAL_BASE/opticks/opticksdata/gensteps/dayabay/cerenkov/1.npy")
    #path = os.path.expandvars("$LOCAL_BASE/opticks/opticksdata/gensteps/juno/cerenkov/1.npy")
    #a = np.load(path)

    xyzt = a[:, 1]
    #print xyzt
Ejemplo n.º 8
0
        a = np.load(self.xpath)
        self.buf = a.view(Buf)

        for att in self.atts:
            path = self.txtpath(att)
            if os.path.exists(path):
                setattr(self.buf, att, splitlines_(path))
            else:
                log.warning("no such path %s " % path)

        path = self.gcsgpath()
        if os.path.exists(path):
            self.gcsgbuf = np.load(path)
        else:
            log.warning("no such path %s " % path)

    def dump(self):
        print "buf %s " % repr(self.buf.shape)
        print "gcsgbuf %s " % repr(self.gcsgbuf.shape)
        for att in self.atts:
            tls = getattr(self.buf, att)
            print att, len(tls), " ".join(tls)


if __name__ == '__main__':
    args = opticks_main(apmtpath="$TMP/GPmt/0/GPmt.npy")

    p = GPmt(args.apmtpath)
    p.load()
    p.dump()
Ejemplo n.º 9
0
    In [14]: evt.rpost_(slice(0,5)).shape
    Out[14]: (500000, 5, 4)


"""
import os, sys, logging, numpy as np
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.evt import Evt

if __name__ == '__main__':

    args = opticks_main(tag="1",
                        src="natural",
                        det="g4live",
                        pfx="OKG4Test",
                        doc=__doc__)
    np.set_printoptions(suppress=True, precision=3)

    print("pfx:%s" % args.pfx)

    a = Evt(tag=args.tag,
            src=args.src,
            det=args.det,
            pfx=args.pfx,
            seqs=[],
            args=args)
    print("a")
    print(a)
Ejemplo n.º 10
0
    def scattering_length(self, wavelength):
        return self.lookup(PropLib.M_SCATTERING_LENGTH, wavelength)

    def reemission_prob(self, wavelength):
        return self.lookup(PropLib.M_REEMISSION_PROB, wavelength)


if __name__ == '__main__':

    logging.basicConfig(level=logging.INFO)

    #dmat = "GdDopedLS"
    dmat = "Water"

    args = opticks_main(mat=dmat)

    log.info("mat %s " % args.mat)

    import matplotlib.pyplot as plt

    plt.ion()

    mat = Material(args.mat)

    #wl = np.linspace(100.,730.,10)
    wl = np.linspace(300., 600., 31)

    ri = mat.refractive_index(wl)

    al = mat.absorption_length(wl)
Ejemplo n.º 11
0
                   _save : 3.9000002288958058e-05 
       configureStepping : 4.7999998059822246e-05 
               propagate : 4.2877840000001015 
              _propagate : 4.6000001020729542e-05 
              initialize : 0.008572999999159947 
        configurePhysics : 0.072821000001567882 
          postinitialize : 0.00013499999840860255 
       configureDetector : 0.3900549999998475 



"""
import os, logging, numpy as np
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.nload import tagdir_ 
from opticks.ana.metadata import Metadata

if __name__ == '__main__':
    args = opticks_main(tag="10",src="torch", det="PmtInBox", doc=__doc__)
    np.set_printoptions(suppress=True, precision=3)

    mdir = tagdir_(args.det, args.src, args.tag)
    md = Metadata(mdir)
    log.info("loaded metadata from %s : %s " % (mdir, repr(md)))
    md.dump()

  

Ejemplo n.º 12
0
     127     3322311323443231            60            0            60.00        0.000 +- 0.000        0.000 +- 0.000  [16] Gd Ac LS Ac MO MO Ac LS Ac Gd Gd Ac LS LS Ac Ac
     129     3332332332332231            56            4            45.07       14.000 +- 1.871        0.071 +- 0.036  [16] Gd Ac LS LS Ac Ac LS Ac Ac LS Ac Ac LS Ac Ac Ac
     135     2231111323443231            51            6            35.53        8.500 +- 1.190        0.118 +- 0.048  [16] Gd Ac LS Ac MO MO Ac LS Ac Gd Gd Gd Gd Ac LS LS
    .                               1000000      1000000      2325.00/233 =  9.98 


"""
import os, sys, logging, numpy as np
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.evt import Evt
from opticks.ana.nbase import count_unique_sorted

if __name__ == '__main__':
    ok = opticks_main(det="concentric", src="torch", tag="1")

    #seq = "Gd Ac LS Ac MO MO MO"
    #seq = "TO BT BT BT BT DR AB"
    #seq = "TO BT BT BT BT SC AB"
    #seq = "Gd Ac LS Ac MO MO Ac LS Ac Gd Ac LS Ac MO MO MO"
    seq = "Gd Gd Gd Ac LS Ac MO MO Ac LS Ac Gd Ac LS Ac Ac"

    a = Evt(tag="%s" % ok.utag, src=ok.src, det=ok.det, args=ok, seqs=[seq])
    b = Evt(tag="-%s" % ok.utag, src=ok.src, det=ok.det, args=ok, seqs=[seq])

    a.history_table(slice(0, 20))
    b.history_table(slice(0, 20))

    acu = count_unique_sorted(a.seqhis[a.psel])
    bcu = count_unique_sorted(b.seqhis[b.psel])
Ejemplo n.º 13
0
    rp.plot(ax, log_=False)
    ax = fig.add_subplot(122)
    rp.plot(ax, log_=True)
    fig.show()


def attic():
    transform = "0.500,0.866,0.000,0.000,-0.866,0.500,0.000,0.000,0.000,0.000,1.000,0.000,-86.603,0.000,0.000,1.000"
    tx = np.fromstring(transform, sep=",").reshape(4, 4)
    focus = np.dot([0, 0, 0, 1], tx)[:3]
    normal = np.dot([0, 1, 0, 0], tx)[:3]


if __name__ == '__main__':

    args = opticks_main(det="reflect", stag="1", ptag="2")

    try:
        es = Evt(tag=args.stag, label="S", det=args.det, args=args)
        ep = Evt(tag=args.ptag, label="P", det=args.det, args=args)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info(" es : %s " % es.brief)
    log.info(" ep : %s " % ep.brief)

    if not (es.valid and ep.valid):
        log.fatal("both es and ep must be valid")
        sys.exit(1)
    pass
Ejemplo n.º 14
0
if np == None:
    print("no numpy early abort : so this does not cause SSysTest to fail ")
    sys.exit(0)
pass

from opticks.ana.base import opticks_main
from opticks.ana.nbase import vnorm
from opticks.ana.evt import Evt

if __name__ == '__main__':

    np.set_printoptions(precision=4, linewidth=200)

    args = opticks_main(doc=__doc__,
                        tag="10",
                        src="torch",
                        det="PmtInBox",
                        c2max=2.0,
                        tagoffset=0)

    log.info("tag %s src %s det %s c2max %s  " %
             (args.utag, args.src, args.det, args.c2max))

    #seqs = ["TO BT BR BT BT BT BT SA"]
    #seqs = ["TO BT BR BR BT SA"]
    seqs = []

    try:
        a = Evt(tag="%s" % args.utag,
                src=args.src,
                det=args.det,
                seqs=seqs,
Ejemplo n.º 15
0
        In [57]: n[d>60].min()
        Out[57]: 1.6774575260175819

        In [58]: n[d>60].max()
        Out[58]: 1.6846611499786377

    """
    plt.hist(d, bins=100)




if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    args = opticks_main(det="newton", tag="1", src="torch")

    plt.ion()

    try:
        sel = Evt(tag=args.tag, det=args.det, src=args.src, seqs=["TO BT BT SA"], args=args)  # newton, uses single incident angle
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info("loaded %s " % repr(sel))

    boundary = Boundary("Vacuum///GlassSchottF2")

    prism = Prism("60.,300,300,0", boundary)
Ejemplo n.º 16
0
        a, b = c[0], c[1]

        c2, c2n, c2nn = chi2(a, b, cut=30)
        c2p = c2.sum() / c2n

        plt.plot(bns[:-1], c2, drawstyle='steps', label="chi2/ndf %4.2f" % c2p)
        ax.set_xlim(xlim)
        ax.legend()

        ax.set_ylim(ylim2)

        droplet.bow_angle_rectangles()


if __name__ == '__main__':
    args = opticks_main(tag="5", src="torch", det="rainbow", doc=__doc__)

    boundary = Boundary("Vacuum///MainH2OHale")
    droplet = Droplet(boundary)

    plt.ion()
    plt.close()

    tag = args.tag
    src = args.src
    det = args.det
    rec = True
    log_ = True
    not_ = False

    if det == "rainbow":
Ejemplo n.º 17
0
    so.py --det tboolean-torus  --tag 1  --src torch 

Jump into interactive::

    ipython -i $(which so.py) -- --det tboolean-sphere --tag 1 --src torch 

"""
import logging, sys
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.nload import A
from opticks.ana.nbase import vnorm

if __name__ == '__main__':
    args = opticks_main(src="torch", tag="1", det="tboolean-sphere")

    try:
        so = A.load_("so", args.src, args.tag, args.det)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info("loaded so %s %s shape %s " % (so.path, so.stamp, repr(so.shape)))

    print so

    v = so[:, 0, :3]

    print "v", v
    print "vnorm(v)", vnorm(v)
Ejemplo n.º 18
0
"""
import logging, numpy as np
log = logging.getLogger(__name__)

from opticks.ana.base import opticks_main
from opticks.ana.nload import A
from opticks.ana.nbase import count_unique_sorted

cusfmt_ = lambda cus: "\n".join(["%16x  %8d " % (q, n) for q, n in cus])
msk_ = lambda n: (1 << 4 *
                  (n + 1)) - 1  # msk_(0)=0xf msk_(1)=0xff msk_(2)=0xfff

if __name__ == '__main__':
    args = opticks_main(doc=__doc__,
                        tag="1",
                        src="torch",
                        det="laser",
                        c2max=2.0,
                        tagoffset=0)
    np.set_printoptions(precision=4, linewidth=200, formatter={'int': hex})

    log.info("tag %s src %s det %s c2max %s  " %
             (args.utag, args.src, args.det, args.c2max))

    dbg = False
    ph = A.load_("ph", args.src, args.utag, args.det, dbg, optional=True)

    seqhis = ph[:, 0, 0]

    for i in range(10):
        msk = msk_(i)
        sqh = seqhis & msk
Ejemplo n.º 19
0
        ap = a.rpost_(i)
        ar = vnorm(ap[:, :2])
        if len(ar) > 0:
            print " ".join(map(lambda _: "%6.3f" % _, (ar.min(), ar.max())))

        bp = b.rpost_(0)
        br = vnorm(bp[:, :2])
        if len(br) > 0:
            print " ".join(map(lambda _: "%6.3f" % _, (br.min(), br.max())))

    def dump(self):
        self.dump_ranges(0)
        self.dump_histories()


if __name__ == '__main__':
    np.set_printoptions(precision=4, linewidth=200)

    args = opticks_main(tag="1", src="torch", det="default")
    log.info(" args %s " % repr(args))

    seqhis_select = slice(1, 2)
    #seqhis_select = slice(0,8)
    try:
        cf = CF(tag=args.tag, src=args.src, det=args.det, select=seqhis_select)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    cf.dump()
Ejemplo n.º 20
0
    ierr |= ERROR_LHS_END_NONEMPTY if LHS_curr != -1 else 0
    ierr |= ERROR_RHS_END_EMPTY if RHS_curr != 0 else 0

    assert RHS_curr == 0 and ierr == 0
    assert RHS_curr == 0, RHS_curr

    ret = csg_[RHS].data[0]
    assert ret.shape == (4, 4)
    ret[0, W] = abs(ret[0, W])
    return ret


if __name__ == '__main__':
    #if 0:
    args = opticks_main(doc=__doc__)

    from nodeRenderer import Renderer
    import matplotlib.pyplot as plt

    plt.rcParams['figure.figsize'] = 18, 10.2
    plt.ion()
    plt.close("all")

    #roots = [lrsph_d1, lrsph_u]
    #roots = [lrsph_u]
    #roots = [lrsph_d1]
    roots = trees
    #roots = [root3]
    #roots = ["$TMP/tboolean-csg-two-box-minus-sphere-interlocked"]
    #roots = ["$TMP/tboolean-csg-four-box-minus-sphere"]
Ejemplo n.º 21
0
    plt.rcParams[
        'figure.figsize'] = 18, 10.2  # plt.gcf().get_size_inches()   after maximize
    import matplotlib.gridspec as gridspec
except ImportError:
    print "matplotlib missing : you need this to make plots"
    plt = None

from opticks.ana.base import opticks_main
from opticks.ana.nbase import vnorm
from opticks.ana.evt import Evt
from opticks.ana.cf import CF
from opticks.ana.cfplot import cfplot, qwns_plot, qwn_plot, multiplot

if __name__ == '__main__':
    np.set_printoptions(precision=4, linewidth=200)
    args = opticks_main(tag="1", src="torch", det="laser")
    log.info(" args %s " % repr(args))
    log.info("tag %s src %s det %s c2max %s  " %
             (args.utag, args.src, args.det, args.c2max))

    plt.ion()
    plt.close()

    select = slice(1, 2)
    #select = slice(0,8)

    try:
        cf = CF(tag=args.tag, src=args.src, det=args.det, select=select)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)
Ejemplo n.º 22
0
def check_dbgseed(a,g):
    """
    The seeds should be genstep_id from 0:num_genstep-1 
    """
    aa = count_unique(a[:,0,0].view(np.int32))
    assert np.all(aa[:,0] == np.arange(0,len(aa)))

    xx = g[:,0,3].view(np.int32)   ## photons per genstep

    assert len(aa) == len(xx)
    assert np.all(aa[:,1] == xx)


if __name__ == '__main__':
    args = opticks_main(src="torch", tag="1", det="dayabay")

    np.set_printoptions(suppress=True, precision=3)

    cpath = x_("$TMP/dbgseed_compute.npy")
    ipath = x_("$TMP/dbgseed_interop.npy")

    log.info("cpath : %s " % cpath) 
    log.info("ipath : %s " % ipath) 

    if not(os.path.exists(cpath) and os.path.exists(ipath)):
        log.warning("SKIP due to missing path")
        sys.exit(0)  ## very particular test, not a standardized test yet so dont treat as a fail 

    c = np.load(cpath)
    i = np.load(ipath)
Ejemplo n.º 23
0
    x = pc.p3[:, 0]
    y = pc.p3[:, 1]
    z = pc.p3[:, 2]

    #assert np.all(x == 1200.)
    #off = x != 1200.
    #print pc.p3[off]

    from matplotlib.colors import LogNorm

    ax.hist2d(w, y, bins=100, norm=LogNorm())


if __name__ == '__main__':

    args = opticks_main(tag="1", det="prism")

    plt.ion()

    #wl = np.arange(10, dtype=np.float32)*70. + 100.
    # low range is off edge of the refractive index values

    seqs = ["TO BT BT SA"]

    try:
        sel = Evt(tag=args.tag, det=args.det, seqs=seqs, args=args)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info("sel %s " % sel.brief)
Ejemplo n.º 24
0
    ax.set_yscale('log')

    ax = fig.add_subplot(222)
    ax.hist(y[s], bins=100)
    ax.set_yscale('log')

    ax = fig.add_subplot(223)
    ax.hist(z[s], bins=100)
    ax.set_yscale('log')

    ax = fig.add_subplot(224)
    ax.hist(t[s], bins=100)
    ax.set_yscale('log')
    fig.show()


if __name__ == '__main__':

    ok = opticks_main(src="G4Gun", det="G4Gun", tag="-1")

    try:
        evt = Evt(tag=ok.tag, src=ok.src, det=ok.det, args=ok)
    except IOError as err:
        log.fatal(err)
        sys.exit(ok.mrc)
    pass

    print evt

    red_gensteps_everywhere_issue(evt.gs)
Ejemplo n.º 25
0
"""

import os, sys, logging, numpy as np
log = logging.getLogger(__name__)

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

from opticks.ana.base import opticks_main
from opticks.ana.evt import Evt
from opticks.ana.planck import planck

if __name__ == '__main__':
    plt.ion()
    args = opticks_main(tag="1", det="white", src="torch")

    ## tag = "1"   ## dont have any tag 1 anymore
    ## tag = "15"     ## so added tag 15,16 to ggv-rainbow with wavelength=0 which is default black body

    try:
        evt = Evt(tag=args.tag, det=args.det, src=args.src, args=args)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    if not evt.valid:
        log.fatal("failed to load evt %s " % repr(args))
        sys.exit(1)

    wl = evt.wl
Ejemplo n.º 26
0
            x1, y1, bins=nb
        )  # xy: not symmetric, seems -Y tangentials favored over +Y tangentials
        ax.set_xlabel("x1 y1")

        ax = fig.add_subplot(nr, nc, 5)
        plt.hist2d(x1, z1, bins=nb)  # xz: only 0:-100 as only half illuminated
        ax.set_xlabel("x1 z1")

        ax = fig.add_subplot(nr, nc, 6)
        plt.hist2d(y1, z1, bins=nb)  # yz: looks symmetric
        ax.set_xlabel("y1 z1")


if __name__ == '__main__':

    args = opticks_main(tag="-5", det="rainbow", src="torch")

    plt.ion()
    plt.close()

    boundary = Boundary("Vacuum///MainH2OHale")

    seqs = ["TO BR SA"]

    #evt = Evt(tag="-6", det="rainbow", seqs=seqs, label="P G4")

    tag = args.tag
    if tag == "-6":
        label = "P G4"
    elif tag == "-5":
        label = "S G4"
Ejemplo n.º 27
0
    pass


def one_plot(fig, pmt, pts, clip=True, axes=ZX, highlight={}):
    ax = fig.add_subplot(1,1,1, aspect='equal')
    pp = PmtPlot(ax, pmt, axes=axes) 
    pp.highlight = highlight
    pp.plot_shape(pts, clip=clip)
    pp.limits()



if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)

    args = opticks_main(apmtidx=2)
    apmtpath = args.apmtpath


    # 0:4  PYREX
    # 4:8  VACUUM
    # 8:12 CATHODE
    # 12:14 BOTTOM
    # 14:15 DYNODE

    highlight = {}
    highlight[8] = 'r'
    highlight[9] = 'r'
    highlight[10] = 'r'
    highlight[11] = 'b'
Ejemplo n.º 28
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""
"""

import os, logging, numpy as np
from opticks.ana.base import opticks_main
from opticks.ana.cfh import CFH
log = logging.getLogger(__name__)

if __name__ == '__main__':
    ok = opticks_main(tag="1", src="torch", det="concentric")

    ctx = {'det': ok.det, 'tag': ok.tag}

    tagd = CFH.tagdir_(ctx)

    seq0s = os.listdir(tagd)

    seq0 = seq0s[0]

    irec = len(seq0.split("_")) - 1

    ctx.update({'seq0': seq0, 'irec': str(irec)})

    log.info(" ctx %r " % ctx)
Ejemplo n.º 29
0
        elif type(arg) is str:
            name = arg
        elif type(arg) is slice:
            return map(lambda name: self(name), self.names[arg])
        else:
            assert 0, (type(arg), "unexpected type")
        pass
        return self.check_bnd(name)

    def check_bnd(self, name):
        omat, osur, isur, imat = name.split("/")


if __name__ == '__main__':

    ok = opticks_main()

    blib = PropLib("GBndLib")
    names = blib.names
    n = len(names)

    nam = np.zeros((n, 4), dtype="|S64")
    for i, name in enumerate(names):
        nam[i] = name.split("/")

    cf = CFProp(ok)

if 0:
    for i in range(n):

        name = names[i]
Ejemplo n.º 30
0

"""
import os, sys, logging, numpy as np
log = logging.getLogger(__name__)

import matplotlib.pyplot as plt

from opticks.ana.base import opticks_main
from opticks.ana.nbase import vnorm
from opticks.ana.evt import Evt

X, Y, Z, W = 0, 1, 2, 3

if __name__ == '__main__':
    args = opticks_main(tag="1", src="torch", det="BoxInBox")

    np.set_printoptions(precision=4, linewidth=200)
    np.set_printoptions(formatter={'int': hex})

    plt.ion()
    plt.close()

    try:
        a = Evt(tag="%s" % args.tag, src=args.src, det=args.det, args=args)
        b = Evt(tag="-%s" % args.tag, src=args.src, det=args.det, args=args)
    except IOError as err:
        log.fatal(err)
        sys.exit(args.mrc)

    log.info(" A : %s " % a.brief)