Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:02

0001 #!/bin/bash
0002 usage(){ cat << EOU
0003 cxt_precision.sh : Simtrace Geometry Intersect Precision Test
0004 ===============================================================
0005 
0006 ~/o/CSGOptiX/cxt_precision.sh
0007 
0008 FIG=1 TEST=input_photon_poolcover        ~/o/CSGOptiX/cxt_precision.sh pdb
0009 FIG=1 TEST=input_photon_poolcover_refine ~/o/CSGOptiX/cxt_precision.sh pdb
0010 
0011 
0012 EOU
0013 }
0014 
0015 cd $(dirname $(realpath $BASH_SOURCE))
0016 
0017 defarg=info_run_pdb
0018 [ -n "$BP" ] && defarg="info_dbg"
0019 arg=${1:-$defarg}
0020 arg2=$2
0021 
0022 bin=CSGOptiXTMTest   ## just calls CSGOptiX::SimtraceMain()
0023 script=cxt_precision.py
0024 export SCRIPT=cxt_precision
0025 
0026 source $HOME/.opticks/GEOM/GEOM.sh   # sets GEOM envvar, use GEOM bash function to setup/edit
0027 source $HOME/.opticks/GEOM/CUR.sh 2>/dev/null  ## optionally define CUR_ bash function, for controlling directory for screenshots
0028 source $HOME/.opticks/GEOM/EVT.sh 2>/dev/null  ## optionally define AFOLD and/or BFOLD for adding event tracks to simtrace plots
0029 
0030 
0031 
0032 
0033 tmp=/tmp/$USER/opticks
0034 TMP=${TMP:-$tmp}
0035 
0036 
0037 if [ "$GEOM" == "BigWaterPool" ]; then
0038 
0039     #test=input_photon_poolcover
0040     test=input_photon_poolcover_refine
0041 
0042     unset FIGPATH
0043     export TEST=${TEST:-$test}
0044 
0045     if [ "$TEST" == "input_photon_poolcover" -o "$TEST" == "input_photon_poolcover_refine" ]; then
0046 
0047         _CUR=GEOM/$GEOM/$SCRIPT/simtrace/input_photon_poolcover_and_refine
0048 
0049         [ -n "$FIG" ] && export FIGPATH=$HOME/Pictures/$(date +"%Y%m%d_%H%M%S").png
0050         export RFOLD=/data1/blyth/tmp/GEOM/BigWaterPool/CSGOptiXSMTest/ALL98_Debug_Philox_${TEST}/A000
0051         export OPTICKS_INPUT_PHOTON=$RFOLD/record.npy
0052 
0053         case $TEST in
0054            input_photon_poolcover)        export OPTICKS_INPUT_PHOTON_RECORD_SLICE="TO BT BT BT SA,TO BT BT SA"  ;;
0055            input_photon_poolcover_refine) export OPTICKS_INPUT_PHOTON_RECORD_SLICE="TO BT BT SA"                 ;;
0056         esac
0057 
0058         if [ "${TEST/refine}" != "$TEST" ]; then
0059             export OPTICKS_PROPAGATE_REFINE=1
0060             export OPTICKS_PROPAGATE_REFINE_DISTANCE=5000
0061         else
0062             unset OPTICKS_PROPAGATE_REFINE
0063             unset OPTICKS_PROPAGATE_REFINE_DISTANCE
0064         fi
0065 
0066         export OPTICKS_INPUT_PHOTON_RECORD_TIME="[0.1:88.8:-444]"  # -ve step for np.linspace
0067 
0068         ## choose first time to match TO and last time just before the earliest BT
0069         ## earliest first intersect r.f.record[rw,1,0,3].min() 88.851036
0070         export OPTICKS_EVENT_NAME=Debug_Philox_${TEST}     ## HMM cxt_precision too ?
0071         export AFOLD=$TMP/GEOM/$GEOM/$bin/ALL${VERSION:-0}_${OPTICKS_EVENT_NAME}/A000
0072     fi
0073 
0074 fi
0075 
0076 export OPTICKS_EVENT_MODE=DebugLite
0077 export OPTICKS_INTEGRATION_MODE=1
0078 
0079 
0080 
0081 logging(){
0082     type $FUNCNAME
0083     #export CSGOptiX=INFO
0084     #export QEvt=INFO
0085     #export QSim=INFO
0086     #export SFrameGenstep=INFO
0087     #export CSGTarget=INFO
0088     #export SEvt=INFO
0089     export SEvt__LIFECYCLE=INFO
0090     export SEvt__SIMTRACE=INFO
0091 
0092     export SRecord__level=3
0093 
0094 }
0095 [ "$LOG" == "1" ] && logging
0096 
0097 
0098 vars="BASH_SOURCE PWD script bin defarg arg GEOM ${GEOM}_CFBaseFromGEOM CUDA_VISIBLE_DEVICES CEGS AFOLD _CUR"
0099 
0100 if [ "${arg/info}" != "$arg" ]; then
0101    for var in $vars ; do printf "%30s : %s \n" "$var" "${!var}" ; done
0102 fi
0103 
0104 if [ "${arg/open}" != "$arg" ]; then
0105     # open to define current context string which controls where screenshots are copied to by ~/j/bin/pic.sh
0106     CUR_open ${_CUR}
0107 fi
0108 
0109 if [ "${arg/run}" != "$arg" ]; then
0110    $bin
0111    [ $? -ne 0 ] && echo $BASH_SOURCE run error && exit 1
0112 fi
0113 
0114 if [ "${arg/dbg}" != "$arg" ]; then
0115    source dbg__.sh
0116    dbg__ $bin
0117    [ $? -ne 0 ] && echo $BASH_SOURCE run/dbg error && exit 1
0118 fi
0119 
0120 if [ "${arg/pdb}" != "$arg" ]; then
0121     ${IPYTHON:-ipython} --pdb -i $script
0122 fi
0123 
0124 if [ "${arg/ana}" != "$arg" ]; then
0125     ${PYTHON:-python} $script
0126 fi
0127 
0128 if [ "${arg/close}" != "$arg" ]; then
0129     # close to invalidate the context
0130     CUR_close
0131 fi
0132 
0133 if [ "$arg" == "touch"  ]; then
0134     if [ -n "$arg2" ]; then
0135         CUR_touch "$arg2"
0136     else
0137         echo $BASH_SOURCE arg2 needs to be a datetime accepted by CUR_touch eg "cxt_precision.sh touch 21:00"
0138     fi
0139 fi
0140 
0141 
0142 
0143 
0144