Changeset 41982 for branches/eam_branches/ipp-20211108/ippTests/ippCheck
- Timestamp:
- Jan 7, 2022, 4:38:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20211108/ippTests/ippCheck/ippCheck
r41979 r41982 1 1 #!/usr/bin/env dvo 2 2 3 # XXX create a config file to hold values like this: 3 # XXX need alternate source for camID (if !cam) and warpID (if !warp) 4 # XXX create a config file to hold values like PV3_CATDIR 5 4 6 $PV3_CATDIR = /data/ipp105.0/eugene/3pi.dvo.masters/3pi.pv3.20170919 5 7 6 8 module truth.pro 7 # provides the following:8 # make.truth.sources (camera) (expname) (source) (type)9 # make.truth.sources.mpc (camera) (expname) (source)10 # make.truth.sources.dvo (camera) (expname) (source)11 # get.exposure.metadata (camera) (expname)12 13 9 module cammask.pro 14 10 module warpmask.pro … … 17 13 module warpstats.pro 18 14 19 ## XXX I need to enable only parts of this analysis 20 ## for now, just comment out the warp & diff stages 21 22 macro example.full.dvo 15 ##### 16 macro check.exposure.dvo 17 local SKIP_PLOTS CAMERA 18 19 $CAMERA = gpc1 20 21 # strip out optional arguments 22 getargs -no-cam BOOL -var SKIP_CAM 23 getargs -no-warp BOOL -var SKIP_WARP 24 getargs -no-diff BOOL -var SKIP_DIFF 25 getargs -no-plots BOOL -var SKIP_PLOTS 26 getargs -camera VALUE -var CAMERA 27 23 28 if ($0 != 3) 24 echo "USAGE: example.full.dvo (expname) (label)" 25 break 26 end 27 28 # XXX Can I add flags to turn on/off certain stages? 29 # -no-warp, -no-diff, -no-cam 30 31 getargs -no-cam BOOL -var SKIP_CAM 32 getargs -no-warp BOOL -var SKIP_WARP 33 getargs -no-diff BOOL -var SKIP_DIFF 29 echo "USAGE: check.exposure.dvo (expname) (label)" 30 echo " -no-cam, -no-warp, -no-diff, -no-plots" 31 echo " [-camera gpc2]" 32 break 33 end 34 34 35 35 local expname camlabel … … 37 37 $camlabel = $2 38 38 39 $OUTVERSION = DVO 40 41 make.truth.sources gpc1 $expname $PV3_CATDIR DVO 42 get.camera.eff gpc1 $expname $camlabel $REFSOURCE 43 # get.warp.eff gpc1 $expname $camID $REFSOURCE 44 # get.diff.eff gpc1 $expname $warpID $REFSOURCE 45 46 $KAPA = kapa -noX 47 antialias 0.5 48 49 load.camstats $expname.stats/$expname.DVO.cam.stf 50 plot.camstats.fracs; png -name $expname.stats/$expname.dvo.fracs.png 51 plot.camstats.resid; png -name $expname.stats/$expname.dvo.resid.png 52 53 # load.warpstats $expname.stats/$expname.DVO.wrp.stf 54 # png -name $expname.stats/$expname.dvo.warphist.png 55 # 56 # load.camstats $expname.stats/$expname.DVO.dif.stf 57 # png -name $expname.stats/$expname.dvo.diffhist.png 58 end 59 60 macro example.full.mpc 39 $OUTVERSION = DVO; # used to define output names 40 $REFMODE = DVO; # used by plot.exposure.user for input 41 42 make.truth.sources $CAMERA $expname $PV3_CATDIR DVO 43 if (not($SKIP_CAM)) get.camera.eff $CAMERA $expname $camlabel $REFSOURCE 44 if (not($SKIP_WARP)) get.warp.eff $CAMERA $expname $camID $REFSOURCE 45 if (not($SKIP_DIFF)) get.diff.eff $CAMERA $expname $warpID $REFSOURCE 46 47 if (not($SKIP_PLOTS)) plot.exposure.real $expname 48 end 49 50 ##### 51 macro check.exposure.mpc 52 local SKIP_PLOTS CAMERA 53 54 $CAMERA = gpc1 55 56 # strip out optional arguments 57 getargs -no-cam BOOL -var SKIP_CAM 58 getargs -no-warp BOOL -var SKIP_WARP 59 getargs -no-diff BOOL -var SKIP_DIFF 60 getargs -do-plots BOOL -var DO_PLOTS; 61 getargs -use-refs BOOL -var USE_REFSOURCE 62 getargs -camera VALUE -var CAMERA; 63 61 64 if ($0 != 4) 62 echo "USAGE: example.full.mpc (expname) (label) (mpcfile)"65 echo "USAGE: check.exposure.mpc (expname) (label) (mpcfile)" 63 66 break 64 67 end … … 69 72 $mpcfile = $3 70 73 71 # download the most current MPCORB.DAT file with:72 # wget ...73 74 # generate orbit list for night / chunk with75 # exec mpcorb_predict trange (MPCORB.DAT) (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax) (range.fits)76 # exec mpcorb_predict trange mpc/mpcorb_extended.59396.dat 59396.3 59396.9 220.0 235.0 40.0 50.0 mpc/mpcorb.trange.59396.fits77 # exec mpcorb_predict trange mpc/mpcorb_extended.59396.dat 59401.3 59401.9 190.0 215.0 12.0 28.0 mpc/mpcorb.trange.59401.fits78 # visit 1 on 59401 has exposures o9401g0123o - o9401g0143o79 # this sample has ~1900 known asteroids covering 375 sq deg. we should expect ~ 35 asteroids per exposure80 81 # mpcorb_predict trange mpc/mpcorb_extended.59396.dat 59375.2 59375.8 190 250 -10 20 trange.59375.fits82 # this area covers exposures o9375g0060o - o9375g0341o (visit 1) and later visits83 84 74 # use a larger match radius for the asteroids 85 # MATCH_RADIUS is in pixels : this should probably be even larger86 $MATCH_RADIUS = 8.0 75 # MATCH_RADIUS is in pixels 76 $MATCH_RADIUS = 8.0; # XXX add option to set the radius? 87 77 $OUTVERSION = MPC 88 78 $COPYMASKS = 0 89 79 90 make.truth.sources gpc1 $expname $mpcfile MPC; # sets the value of REFSOURCE 91 get.camera.eff gpc1 $expname $camlabel $REFSOURCE 92 # get.warp.eff gpc1 $expname $camID $REFSOURCE 93 # get.diff.eff gpc1 $expname $warpID $REFSOURCE 94 # load data from cam stage output: 95 $USE_CAMSOURCE = 1 96 get.warp.eff gpc1 $expname $camID $CAMSOURCE 97 get.diff.eff gpc1 $expname $warpID $CAMSOURCE 98 99 return 100 101 $KAPA = kapa -noX 102 camstats.glob $expname.stats/$expname.*.MPC.cam.stf 103 png -name $expname.stats/$expname.mpc.camhist.png 80 make.truth.sources $CAMERA $expname $mpcfile MPC; # sets the value of REFSOURCE 81 82 if (not($SKIP_CAM)) get.camera.eff $CAMERA $expname $camlabel $REFSOURCE 83 84 # CAMSOURCE lists all REFSOURCE entries which actually fall on a chip, while REFSOURCE includes 85 # the objects which are in the larger field. The latter is not accurate for the detection fraction 86 # but, if we did not measure the camera sources, we must use REFSOURCE 87 88 if ($USE_REFSOURCE || $SKIP_CAM) 89 if (not($SKIP_WARP)) get.warp.eff $CAMERA $expname $camID $REFSOURCE 90 if (not($SKIP_DIFF)) get.diff.eff $CAMERA $expname $warpID $REFSOURCE 91 else 92 # load data from cam stage output: 93 $USE_CAMSOURCE = 1; # this is used by get.warp.eff to choose the correct fields 94 if (not($SKIP_WARP)) get.warp.eff $CAMERA $expname $camID $CAMSOURCE 95 if (not($SKIP_DIFF)) get.diff.eff $CAMERA $expname $warpID $CAMSOURCE 96 end 97 98 if ($DO_PLOTS) plot.exposure.real $expname 99 end 100 101 # XXX uses fixed name for orbit file (MPCORB.DAT) 102 macro make.mpc.refsources 103 local GET_ORBITS 104 105 # strip out optional arguments 106 getargs -get-orbits BOOL -var GET_ORBITS 107 108 if ($0 != 7) 109 echo "USAGE: make.mpc.refsources (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax) [-get-orbits]" 110 break 111 end 112 113 local Tmin Tmax Rmin Rmax Dmin Dmax 114 $Tmin = $1 115 $Tmax = $2 116 $Rmin = $3 117 $Rmax = $4 118 $Dmin = $5 119 $Dmax = $6 120 121 if ($GET_ORBITS) 122 # download the most current MPCORB.DAT file with: 123 exec rm -f MPCORB.DAT 124 exec wget https://www.minorplanetcenter.net/iau/MPCORB/MPCORB.DAT 125 end 126 127 $Tref = int($Tmin) 128 exec mpcorb_predict trange MPCORB.DAT $Tmin $Tmax $Rmin $Rmax $Dmin $Dmax mpcorb.trange.$Tref.fits 129 end 130 131 ##### 132 macro plot.exposure.user 133 $REFMODE = DVO 134 135 # strip out optional arguments 136 getargs -no-cam BOOL -var SKIP_CAM 137 getargs -no-warp BOOL -var SKIP_WARP 138 getargs -no-diff BOOL -var SKIP_DIFF 139 getargs -refmode VALUE -var REFMODE 140 141 if ($0 != 2) 142 echo "USAGE: plot.exposure.user (expname)" 143 echo " -no-cam, -no-warp, -no-diff" 144 echo " -refmode MODE : MODE = MPC, DVO" 145 break 146 end 147 148 local expname; $expname = $1 149 plot.exposure.real $expname 150 end 151 152 ##### plot.exposure.user strips optional arguments and calls plot.exposure.real 153 macro plot.exposure.real 154 if ($0 != 2) 155 echo "USAGE: plot.exposure.real (expname)" 156 break 157 end 158 local expname; $expname = $1 159 160 $KAPA = kapa -noX; # XXX make this optional (default: do not display) 161 antialias 0.5 162 163 if (not($SKIP_CAM)) 164 load.camstats $expname.stats/$expname.$REFMODE.cam.stf 165 plot.camstats.fracs; png -name $expname.stats/$expname.$REFMODE.camfracs.png 166 plot.camstats.resid; png -name $expname.stats/$expname.$REFMODE.camresid.png 167 end 104 168 105 warpstats.glob $expname.stats/$expname.*.MPC.warp.stf 106 png -name $expname.stats/$expname.mpc.warphist.png 107 108 camstats.glob $expname.stats/$expname.*.MPC.diff.stf 109 png -name $expname.stats/$expname.mpc.diffhist.png 110 end 111 112 macro example.old 113 make.truth.sources gpc1 o9395g0315o $PV3_CATDIR DVO 114 get.camera.eff gpc1 o9395g0315o EU.nightlyscience test.fits 115 get.warp.eff gpc1 o9395g0315o $camID test.fits 116 get.diff.eff gpc1 o9395g0315o $warpID test.fits 117 end 118 119 # o9396g0312o 120 # o9396g0313o 121 # o9396g0314o 122 # o9396g0315o 123 # o9395g0315o 169 if (not($SKIP_WARP)) 170 load.warpstats $expname.stats/$expname.$REFMODE.wrp.stf 171 plot.warpstats.fracs; png -name $expname.stats/$expname.$REFMODE.wrpfracs.png 172 end 173 174 if (not($SKIP_DIFF)) 175 load.camstats $expname.stats/$expname.$REFMODE.dif.stf 176 plot.camstats.fracs; png -name $expname.stats/$expname.$REFMODE.diffracs.png 177 plot.camstats.resid; png -name $expname.stats/$expname.$REFMODE.difresid.png 178 end 179 end 180 181 ##### plot.exposure.glob 182 macro plot.exposure.glob 183 $REFMODE = DVO 184 185 # strip out optional arguments 186 getargs -no-cam BOOL -var SKIP_CAM 187 getargs -no-warp BOOL -var SKIP_WARP 188 getargs -no-diff BOOL -var SKIP_DIFF 189 getargs -refmode VALUE -var REFMODE 190 191 if ($0 != 3) 192 echo "USAGE: plot.exposure.glob (expglob) (outroot)" 193 echo " -no-cam, -no-warp, -no-diff" 194 echo " -refmode MODE : MODE = MPC, DVO" 195 break 196 end 197 198 local expglob outroot 199 $expglob = $1 200 $outroot = $2 201 202 dirname $outroot -var outdir; mkdir $outdir 203 204 $KAPA = kapa -noX; # XXX make this optional (default: do not display) 205 antialias 0.5 206 207 if (not($SKIP_CAM)) 208 load.camstats $expglob.$REFMODE.cam.stf 209 plot.camstats.fracs; png -name $outroot.$REFMODE.camfracs.png 210 plot.camstats.resid; png -name $outroot.$REFMODE.camresid.png 211 end 212 213 if (not($SKIP_WARP)) 214 load.warpstats $expglob.$REFMODE.wrp.stf 215 plot.warpstats.fracs; png -name $outroot.$REFMODE.wrpfracs.png 216 end 217 218 if (not($SKIP_DIFF)) 219 load.camstats $expglob.$REFMODE.dif.stf 220 plot.camstats.fracs; png -name $outroot.$REFMODE.diffracs.png 221 plot.camstats.resid; png -name $outroot.$REFMODE.difresid.png 222 end 223 end 224 225 macro show.usage 226 echo "USAGE: ippCheck (mode) ..." 227 echo " EG: ippCheck mpc (expname) (label) [mpcfile]" 228 echo " EG: ippCheck dvo (expname) (label)" 229 echo " EG: ippCheck plot (expname)" 230 echo " EG: ippCheck plot.glob (expglob) (outroot)" 231 echo " EG: ippCheck mpcrefs (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax)" 232 end 124 233 125 234 if ($SCRIPT) 126 if ($argv:n < 3) 127 echo "USAGE: ippCheck (mode) (expname) (label) [mpcfile]" 128 break 235 if ($argv:n < 1) 236 show.usage 237 break 238 end 239 240 list argv -join arglist -start 1 241 242 if ("$argv:0" == "dvo") 243 check.exposure.dvo $arglist 244 exit 0 129 245 end 130 246 131 247 if ("$argv:0" == "mpc") 132 if ($argv:n != 4) 133 echo "USAGE: ippCheck mpc (expname) (label) (mpcfile)" 134 break 135 end 136 137 example.full.mpc $argv:1 $argv:2 $argv:3 138 exit 0 139 end 140 141 if ("$argv:0" == "dvo") 142 if ($argv:n != 3) 143 echo "USAGE: ippCheck dvo (expname) (label)" 144 break 145 end 146 147 example.full.dvo $argv:1 $argv:2 248 check.exposure.mpc $arglist 249 exit 0 250 end 251 252 if ("$argv:0" == "mpcrefs") 253 make.mpc.refsources $arglist 148 254 exit 0 149 255 end 150 256 151 257 if ("$argv:0" == "smf") 152 if ($argv:n != 4) 153 echo "USAGE: ippCheck smf (expname) (label) (smffile)" 154 break 155 end 156 157 example.full.dvo $argv:1 $argv:2 158 exit 0 159 end 160 161 echo "USAGE: ippCheck (mode) (expname) (label) [mpcfile]" 162 echo " mode may be 'dvo' or 'mpc'" 258 check.exposure.smf $arglist 259 exit 0 260 end 261 262 if ("$argv:0" == "plot") 263 plot.exposure.user $arglist 264 exit 0 265 end 266 267 if ("$argv:0" == "plot.glob") 268 plot.exposure.glob $arglist 269 exit 0 270 end 271 272 show.usage 163 273 exit 2 164 274 end
Note:
See TracChangeset
for help on using the changeset viewer.
