Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/bin/bash -l 
0002 
0003 usage(){ cat << EOU
0004 
0005 ::
0006 
0007     PUB=dyn_prim_scan ./pub1.sh 
0008 
0009 EOU
0010 }
0011 
0012 
0013 defpath=/Users/blyth/.opticks/geocache/DetSim0Svc_pWorld_g4live/g4ok_gltf/41c046fe05b28cb70b1fc65d0e6b7749/1/CSG_GGeo/CSGOptiXRenderTest/cvd1/70000/cxr_overview/cam_0_tmin_0.4/image_grid_elv_scan.jpg
0014 
0015 img=${1:-$defpath}
0016 
0017 relative_stem(){
0018    local jpg=$1
0019   
0020    local lgeocache=$HOME/.opticks/geocache/
0021    local geocache=${OPTICKS_GEOCACHE_PREFIX:-$HOME/.opticks}/geocache/
0022    local oktmp=/tmp/$USER/opticks/
0023 
0024    local rel 
0025    case $jpg in  
0026       ${lgeocache}*) rel=${jpg/$lgeocache/} ;;
0027       ${geocache}*)  rel=${jpg/$geocache/} ;;
0028          ${oktmp}*)  rel=${jpg/$oktmp/} ;;  
0029    esac 
0030    rel=${rel/\.jpg}
0031 
0032    echo $rel 
0033 }
0034 
0035 ext=${img##*.}
0036 rel=$(relative_stem $img)
0037 
0038 if [ "$PUB" == "1" ]; then 
0039     suf=""    ## use PUB=1 to debug the paths 
0040 else
0041     suf="_${PUB}" 
0042 fi  
0043 
0044 s5p=/env/presentation/${rel}${suf}.${ext}
0045 pub=$HOME/simoncblyth.bitbucket.io$s5p
0046 
0047 echo $msg img $img 
0048 echo $msg suf $suf 
0049 echo $msg rel $rel 
0050 echo $msg ext $ext 
0051 echo $msg pub $pub
0052 echo $msg s5p $s5p 1280px_720px 
0053 
0054 if [ -n "$img" -a "$(uname)" == "Darwin" -a -n "$PUB" ]; then 
0055     mkdir -p $(dirname $pub)
0056     if [ -f "$pub" ]; then 
0057         echo $msg published path exists already : NOT COPYING : set PUB to an ext string to distinguish the name or more permanently arrange for a different path   
0058     elif [ "$ext" == "" ]; then 
0059         echo $msg skipping copy : to do the copy you must set PUB to some descriptive string rather than just using PUB=1
0060     else
0061         echo $msg copying img to pub 
0062         cp $img $pub
0063         echo $msg add s5p to s5_background_image.txt
0064     fi
0065 fi
0066 
0067