ana : Opticks Analysis Scripts

Issue : analysis machinery expects a geocache

simon:analytic blyth$ ip
Python 2.7.11 (default, Dec  5 2015, 23:51:51)
...
IPython profile: g4opticks
args: /opt/local/bin/ipython
Invalid/missing IDPATH envvar /usr/local/opticks/opticksdata/export/DayaBay_VGDX_20140414-1300/g4_00.96ff965744a2f6b78c24e33c80d3a4cd.dae
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

To exit: use 'exit', 'quit', or Ctrl-D.

In [1]:

FUNCTION ana-t

After running tests-t all the below “MISSING EVT” should become “OK”:

simon:ana blyth$ ana-t
==                    __init__.py ==  ->    0 OK
==                         ana.py ==  ->  101 MISSING EVT
==                        base.py ==  ->    0 OK
==                    boundary.py ==  ->    0 OK
==              cfg4_speedplot.py ==  ->    0 OK
==                      cfplot.py ==  ->    0 OK
==                         cie.py ==  SKIP
==                     dbgseed.py ==  ->  101 MISSING EVT
==                     droplet.py ==  ->    0 OK
==                         evt.py ==  ->    0 OK
==                     fresnel.py ==  ->    0 OK
==                       g4gun.py ==  ->  101 MISSING EVT
==                     genstep.py ==  ->    0 OK
==                    geometry.py ==  ->    0 OK
==                     histype.py ==  ->    0 OK
==                    material.py ==  ->    0 OK
==                     mattype.py ==  ->    0 OK
==                  mergedmesh.py ==  ->    0 OK
==                    metadata.py ==  ->    0 OK
==                       nbase.py ==  ->    0 OK
==                     ncensus.py ==  ->    0 OK
==                       nload.py ==  ->    0 OK
==                          ox.py ==  ->    0 OK
==                      planck.py ==  ->    0 OK
==              prism_spectrum.py ==  ->  101 MISSING EVT
==                     proplib.py ==  ->    0 OK
==                         seq.py ==  ->    0 OK
==                      sphere.py ==  ->  101 MISSING EVT
==                        tbox.py ==  ->  101 MISSING EVT
==                        tevt.py ==  ->  101 MISSING EVT
==                       tmeta.py ==  ->    0 OK
==                        tpmt.py ==  ->  101 MISSING EVT
==                tpmt_distrib.py ==  ->  101 MISSING EVT
==                tpmt_skimmer.py ==  ->  101 MISSING EVT
==                      tprism.py ==  ->  101 MISSING EVT
==                    trainbow.py ==  ->  101 MISSING EVT
==                    treflect.py ==  ->  101 MISSING EVT
==                      twhite.py ==  ->  101 MISSING EVT
==                    xrainbow.py ==  ->    0 OK

PMT Tests

tpmt.py : PmtInBox Opticks vs G4 History comparisons
Compare Opticks and Geant4 photon bounce histories for simple PMT in box of mineral oil geometry, see ../tests/tpmt
tpmt_distrib.py : PmtInBox Opticks vs Geant4 distributions
Compare Opticks and Geant4 photon distributions for simple PMT in box of mineral oil geometry
tpmt_skimmer.py: Following positions of PMT skimmers
Plotting and tabulating mean step by step positions of all photons with specific step histories such as “TO BT BT SA”

BoxInBox tests

tbox.py : BoxInBox Opticks vs Geant4 comparisons
BoxInBox Opticks vs Geant4 history sequence comparisons analogous to tpmt.py see ../tests/tbox
tboxlaser.py
Looks like simple event comparison, without using AB/CF etc.. TODO: use the generic AB machinery to do the same

Rainbow Tests

trainbow.py : Rainbow deviation angle comparison between Opticks and Geant4
Rainbow scattering angle comparison between Opticks and Geant4, see ../tests/trainbow
xrainbow.py
Rainbow expectations with classes XRainbow and XFrac
droplet.py
geometry calculation of spherical drop incident, refracted, deviation angles for k orders of rainbow corresponding to different numbers of internal reflections
sphere.py
SphereReflect intersection, polarization calculation and spatial plot

Scatter Tests

rayleigh.py

Without selection scatter distrib plots from arrays created by:

optixrap/tests/ORayleighTest.cc cfg4/tests/OpRayleighTest.cc

Source Tests

twhite.py: Wavelength Distribution Check
Compare wavelength spectrum from ../tests/twhite against analytic Planck distribution
planck.py
Planck black body formula : CDF technique dev, plotting

Full Geometry Tests

tdefault.py
tests within default full geometry, using CF (older than the AB/CFH machinery?)
tdefault_distrib.py
tests within default full geometry, using cf,cfplot
tlaser.py
okg4 comparisons manually using Evt (not the newer AB)
tlaser_distrib.py
okg4 comparisons using CF (not the newer CFH)

Analytic/NCSG Geometry tests

analytic_boundary_dbg.py

analysis of photon_buffer written by oxrap/cu/generate.cu:tracetest

TODO: rename, too special case to share name with tboolean-

tgltf.py
Shakedown analytic geometry, with analytic geometry transform access

Concentric Tests : idealised spherical DYB AD

tconcentric.py
comparison using AB, with scatter polarization debug/plotting see tconcentric-i
tconcentric_distrib.py
comparison histo mass production with see tconcentric-d

Lens/Prism Tests

tlens.py
Single Evt dumping, no comparisons
tprism.py
Comparison of simulation with analytic expectations for deviation angle vs incident angle, see ../tests/tprism
prism_spectrum.py
Compare ggv-newton evts with PrismExpected

Reflection Tests

treflect.py
comparison of simulated S and P absolute reflection with Fresnel formula see ../tests/treflect
fresnel.py
analytic reflection expectations from Fresnel formula

G4Gun Tests

g4gun.py: loads G4Gun event
Load single G4Gun event

Geometry Infrastructure

material.py : optical properties access
Material class gives access to geocache material properties
boundary.py : inner/outer materials and surfaces
Boundary class acts as holder of inner/outer materials and surfaces
PropLib : Geocache Access
Access to geocache via PropLib
bnd.py
testing PropLib usage to access material and surface properties
MergedMesh
Access geometrical data such as positions, transforms of volumes of the geometry
geometry.py
Shape, Ray, Plane, Intersect, IntersectFrame : simple intersect calulations

Event Comparison Infrastructure

tokg4.py
loads evt pair and compares at Evt level
ab.py
event pair comparison with AB class. Used by cfh.py, cfplot.py, tconcentric.py, tconcentric_distrib.py
abstat.py
history table slicing, selection. Used by ab.py, cfh.py
make_rst_table.py
pure python utility used by ab.py abstat.py
cf.py
Sliced history CF spawning. Used by tdefault.py tdefault_distrib.py tlaser_distrib.py tpmt_distrib.py
decompression.py

Deco : utils for re-binning domain compressed values that avoid binning artifacts

Used from : ab.py cf.py

cfh.py

CFH : persistable comparison histograms and chi2, with random access via path specification

ipython -i $(which cfh.py) – /tmp/blyth/opticks/CFH/concentric/1/TO_BT_BT_BT_BT_SA/0/X

Used from : ab.py cf.py cfhload.py cfplot.py tconcentric.py

cfhload.py
Testing cfh.py CFH
ctx.py

Ctx : Utility providing conversions between various ways of addressing comparison histograms

Used from : ab.py cfh.py evt.py

Event Infrastructure

tevt.py : Loads a single event
Loads single event and dumps constituent array dimensions and photon history tables
evt.py
loads event data : used by many ~30 other scripts
tmeta.py

loads and dumps a single events metadata

tmeta.py –det tboolean-torus –tag 1

base.py
internal envvar setup based on input envvar IDPATH json and ini loading with Abbrev and ItemList classes
ok.py
test of opticks_main arg parsing/defaults
enum.py
parsing C++ enum into python dict. Used by base.py
nload.py
numpy array and .ini metadata loading with clases A, I, II
ox.py
load just final photons, testing nload and arg parsing
ph.py
load ph photon seqhis, dumping progressing SeqAna sequences
nbase.py
pure numpy utility functions: count_unique, count_unique_sorted, chi2, decompression_bins
seq.py

SeqType conversions of long integer sequence codes to abbreviation string sequences like “TO BT BR BR BT SA” SeqTable presenting frequencies of different sequences

Used by : evt.py hismask.py histype.py mattype.py

histype.py

HisType (SeqType subclass) and tests of history table formation and dumping. Used by ab.py cf.py evt.py seq.py. With entry point:

histype.py --det tboolean-torus --tag -1 --src torch
hismask.py
converts seqhis into a mask, not the usual sequence : used by evt.py pflags.py
mattype.py
MatType (SeqType subclass) and tests
genstep.py
fit genstep xyz vs time, to obtain parametric eqn for the viewpoint tracking used to create videos, see vids-
genstep_merge.py
combine Cerenkov and scintillation gensteps in natural ones
ana.py
geometrical and plotting utils
OpticksQuery.py
analog of okc/OpticksQuery.cc geometry selection string parsing available from opticks_main args.query

Plotting Infrastructure

cfplot.py
Comparison Plotter with Chi2 Underplot

Metadata Infrastructure

cfg4_speedplot.py
compare simulation times using json metadata written by Opticks simulation invokations
metadata.py
access metadata .json written by Opticks allowing comparisons of evt digests and simulation times
ncensus.py
event census looking across many events with array shape dumping

Color Infrastructure

cie.py
converts wavelength spectra into XYZ and RGB colorspace (depends on env repo)