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]:


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

simon:ana blyth$ ana-t
==           ==  ->    0 OK
==                ==  ->  101 MISSING EVT
==               ==  ->    0 OK
==           ==  ->    0 OK
==     ==  ->    0 OK
==             ==  ->    0 OK
==                ==  SKIP
==            ==  ->  101 MISSING EVT
==            ==  ->    0 OK
==                ==  ->    0 OK
==            ==  ->    0 OK
==              ==  ->  101 MISSING EVT
==            ==  ->    0 OK
==           ==  ->    0 OK
==            ==  ->    0 OK
==           ==  ->    0 OK
==            ==  ->    0 OK
==         ==  ->    0 OK
==           ==  ->    0 OK
==              ==  ->    0 OK
==            ==  ->    0 OK
==              ==  ->    0 OK
==                 ==  ->    0 OK
==             ==  ->    0 OK
==     ==  ->  101 MISSING EVT
==            ==  ->    0 OK
==                ==  ->    0 OK
==             ==  ->  101 MISSING EVT
==               ==  ->  101 MISSING EVT
==               ==  ->  101 MISSING EVT
==              ==  ->    0 OK
==               ==  ->  101 MISSING EVT
==       ==  ->  101 MISSING EVT
==       ==  ->  101 MISSING EVT
==             ==  ->  101 MISSING EVT
==           ==  ->  101 MISSING EVT
==           ==  ->  101 MISSING EVT
==             ==  ->  101 MISSING EVT
==           ==  ->    0 OK

PMT Tests : 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 : PmtInBox Opticks vs Geant4 distributions
Compare Opticks and Geant4 photon distributions for simple PMT in box of mineral oil geometry 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 : BoxInBox Opticks vs Geant4 comparisons
BoxInBox Opticks vs Geant4 history sequence comparisons analogous to see ../tests/tbox
Looks like simple event comparison, without using AB/CF etc.. TODO: use the generic AB machinery to do the same

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

Scatter Tests

Without selection scatter distrib plots from arrays created by:

optixrap/tests/ cfg4/tests/

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

Full Geometry Tests
tests within default full geometry, using CF (older than the AB/CFH machinery?)
tests within default full geometry, using cf,cfplot
okg4 comparisons manually using Evt (not the newer AB)
okg4 comparisons using CF (not the newer CFH)

Analytic/NCSG Geometry tests

analysis of photon_buffer written by oxrap/cu/

TODO: rename, too special case to share name with tboolean-
Shakedown analytic geometry, with analytic geometry transform access

Concentric Tests : idealised spherical DYB AD
comparison using AB, with scatter polarization debug/plotting see tconcentric-i
comparison histo mass production with see tconcentric-d

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

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

G4Gun Tests loads G4Gun event
Load single G4Gun event

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

Event Comparison Infrastructure
loads evt pair and compares at Evt level
event pair comparison with AB class. Used by,,,
history table slicing, selection. Used by,
pure python utility used by
Sliced history CF spawning. Used by

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

Used from :

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

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

Used from :
Testing CFH

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

Used from :

Event Infrastructure : Loads a single event
Loads single event and dumps constituent array dimensions and photon history tables
loads event data : used by many ~30 other scripts

loads and dumps a single events metadata –det tboolean-torus –tag 1
internal envvar setup based on input envvar IDPATH json and ini loading with Abbrev and ItemList classes
test of opticks_main arg parsing/defaults
parsing C++ enum into python dict. Used by
numpy array and .ini metadata loading with clases A, I, II
load just final photons, testing nload and arg parsing
load ph photon seqhis, dumping progressing SeqAna sequences
pure numpy utility functions: count_unique, count_unique_sorted, chi2, decompression_bins

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 :

HisType (SeqType subclass) and tests of history table formation and dumping. Used by With entry point: --det tboolean-torus --tag -1 --src torch
converts seqhis into a mask, not the usual sequence : used by
MatType (SeqType subclass) and tests
fit genstep xyz vs time, to obtain parametric eqn for the viewpoint tracking used to create videos, see vids-
combine Cerenkov and scintillation gensteps in natural ones
geometrical and plotting utils
analog of okc/ geometry selection string parsing available from opticks_main args.query

Plotting Infrastructure
Comparison Plotter with Chi2 Underplot

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

Color Infrastructure
converts wavelength spectra into XYZ and RGB colorspace (depends on env repo)