File indexing completed on 2026-04-09 07:48:48
0001
0002 usage(){ cat << EOU
0003 input_photons.sh
0004 ===================
0005
0006 Running this script creates several input photon .npy arrays
0007 into the directory ~/.opticks/InputPhotons::
0008
0009 ~/o/ana/input_photons.sh
0010 ~/o/ana/iinput_photons.sh
0011
0012 Note that the python script runs twice with DTYPE envvar
0013 as np.float32 and np.float64 in order to create the arrays
0014 in both single and double precision.
0015
0016 EOU
0017 }
0018
0019 cd $(dirname $(realpath $BASH_SOURCE))
0020 script=input_photons.py
0021
0022 defarg="info_numpy_run_ls"
0023 [ "$OPT" == "-i" ] && defarg="info_numpy_dbg_ls"
0024
0025 arg=${1:-$defarg}
0026
0027 dtypes="np.float32 np.float64"
0028 vars="PWD script defarg arg dtypes"
0029
0030 if [ "${arg/info}" != "$arg" ]; then
0031 for var in $vars ; do printf "%30s : %s \n" "$var" "${!var}" ; done
0032 fi
0033
0034 if [ "${arg/numpy}" != "$arg" ]; then
0035 python -c "import numpy as np" 2>/dev/null
0036 [ $? -ne 0 ] && echo $BASH_SOURCE numpy package is not within your python - cannot generate input photons && exit 2
0037 fi
0038
0039 if [ "${arg/dbg}" != "$arg" ]; then
0040 for dtype in $dtypes ; do
0041 DTYPE=$dtype ${IPYTHON:-ipython} --pdb $OPT $script -- $*
0042 [ $? -ne 0 ] && echo $BASH_SOURCE dbg error && exit 1
0043 done
0044 fi
0045
0046
0047 if [ "${arg/run}" != "$arg" ]; then
0048 for dtype in $dtypes ; do
0049 DTYPE=$dtype python $script
0050 [ $? -ne 0 ] && echo $BASH_SOURCE run error && exit 2
0051 done
0052 fi
0053
0054 if [ "${arg/ls}" != "$arg" ]; then
0055 ls -alst ~/.opticks/InputPhotons
0056 fi
0057
0058