Changeset 20384
- Timestamp:
- Oct 24, 2008, 3:05:55 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTasks/detrend.correct.pro (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/detrend.correct.pro
r19465 r20384 1 1 ## detrend.correct.pro : globals and support macros : -*- sh -*- 2 2 ## this file contains the tasks for running the detrend correction stage 3 ## these tasks use the books detPendingCorrect edImfile and detPendingCorrectedExp3 ## these tasks use the books detPendingCorrectImfile 4 4 5 5 # test for required global variables 6 6 check.globals 7 7 8 book init detPendingCorrectedImfile 9 book init detPendingCorrectedExp 8 book init detPendingCorrectImfile 10 9 11 10 macro detcorr.reset 12 book init detPendingCorrectedImfile 13 book init detPendingCorrectedExp 11 book init detPendingCorrectImfile 14 12 end 15 13 16 14 macro detcorr.status 17 echo detPendingCorrectedImfile 18 book listbook detPendingCorrectedImfile 19 echo detPendingCorrectedExp 20 book listbook detPendingCorrectedExp 15 echo detPendingCorrectImfile 16 book listbook detPendingCorrectImfile 21 17 end 22 18 … … 26 22 end 27 23 task detrend.correct.run 28 active true29 end30 task detrend.correctexp.load31 active true32 end33 task detrend.correctexp.run34 24 active true 35 25 end … … 43 33 active false 44 34 end 45 task detrend.correctexp.load46 active false47 end48 task detrend.correctexp.run49 active false50 end51 35 end 52 36 53 37 54 38 # these variables will cycle through the known database names 55 $detPendingCorrectedImfile_DB = 0 56 $detPendingCorrectedExp_DB = 0 39 $detPendingCorrectImfile_DB = 0 57 40 58 41 # select images ready for copy 59 # new entries are added to detPendingCorrect edImfile42 # new entries are added to detPendingCorrectImfile 60 43 # compare the new list with the ones already selected 61 44 task detrend.correct.load … … 71 54 72 55 task.exec 73 $run = dettool -tocorrect edimfile56 $run = dettool -tocorrectimfile 74 57 if ($DB:n == 0) 75 58 option DEFAULT 76 59 else 77 60 # save the DB name for the exit tasks 78 option $DB:$detPendingCorrect edImfile_DB79 $run = $run -dbname $DB:$detPendingCorrect edImfile_DB80 $detPendingCorrect edImfile_DB ++81 if ($detPendingCorrect edImfile_DB >= $DB:n) set detPendingCorrectedImfile_DB = 061 option $DB:$detPendingCorrectImfile_DB 62 $run = $run -dbname $DB:$detPendingCorrectImfile_DB 63 $detPendingCorrectImfile_DB ++ 64 if ($detPendingCorrectImfile_DB >= $DB:n) set detPendingCorrectImfile_DB = 0 82 65 end 66 echo $run 83 67 add_poll_args run 68 echo $run 84 69 command $run 85 70 end … … 88 73 task.exit 0 89 74 # convert 'stdout' to book format 90 ipptool2book stdout detPendingCorrect edImfile -key det_id:exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT75 ipptool2book stdout detPendingCorrectImfile -key det_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT 91 76 if ($VERBOSE > 2) 92 book listbook detPendingCorrect edImfile77 book listbook detPendingCorrectImfile 93 78 end 94 79 95 80 # delete existing entries in the appropriate pantaskStates 96 process_cleanup detPendingCorrect edImfile81 process_cleanup detPendingCorrectImfile 97 82 end 98 83 … … 115 100 116 101 task.exec 117 book npages detPendingCorrect edImfile -var N102 book npages detPendingCorrectImfile -var N 118 103 if ($N == 0) break 119 104 if ($NETWORK == 0) break 120 105 121 # look for new images in detPendingCorrect edImfile122 book getpage detPendingCorrect edImfile 0 -var pageName -key pantaskState INIT106 # look for new images in detPendingCorrectImfile 107 book getpage detPendingCorrectImfile 0 -var pageName -key pantaskState INIT 123 108 if ("$pageName" == "NULL") break 124 109 125 book setword detPendingCorrectedImfile $pageName pantaskState RUN 126 book getword detPendingCorrectedImfile $pageName det_id -var DET_ID 127 book getword detPendingCorrectedImfile $pageName exp_id -var EXP_ID 128 book getword detPendingCorrectedImfile $pageName class_id -var CLASS_ID 129 book getword detPendingCorrectedImfile $pageName exp_tag -var EXP_TAG XXX where does this come from 130 book getword detPendingCorrectedImfile $pageName det_type -var DET_TYPE XXX where does this come from 131 book getword detPendingCorrectedImfile $pageName camera -var CAMERA XXX where does this come from 132 book getword detPendingCorrectedImfile $pageName uri -var URI 133 book getword detPendingCorrectedImfile $pageName corr_id -var CORR_ID 134 book getword detPendingCorrectedImfile $pageName corr_type -var CORR_TYPE 135 book getword detPendingCorrectedImfile $pageName workdir -var WORKDIR_TEMPLATE 136 book getword detPendingCorrectedImfile $pageName dbname -var DBNAME 110 book setword detPendingCorrectImfile $pageName pantaskState RUN 111 book getword detPendingCorrectImfile $pageName det_id -var DET_ID 112 book getword detPendingCorrectImfile $pageName class_id -var CLASS_ID 113 book getword detPendingCorrectImfile $pageName det_type -var DET_TYPE 114 book getword detPendingCorrectImfile $pageName camera -var CAMERA 115 book getword detPendingCorrectImfile $pageName uri -var URI 116 book getword detPendingCorrectImfile $pageName workdir -var WORKDIR_TEMPLATE 117 book getword detPendingCorrectImfile $pageName dbname -var DBNAME 137 118 138 119 # specify choice of local or remote host based on camera and chip (class_id) … … 143 124 144 125 ## generate outroot specific to this exposure (& chip) 145 sprintf outroot "%s/%s.%s.%s/%s /%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG$DET_ID126 sprintf outroot "%s/%s.%s.%s/%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID 146 127 147 128 stdout $LOGDIR/detcorr.run.log 148 129 stderr $LOGDIR/detcorr.run.log 149 130 150 $run = detrend_correct_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --outroot $outroot --redirect-output --verbose 151 if ("$WORKDIR" != "NULL") 152 $run = $run --workdir $WORKDIR 153 end 154 if ("$REDUCTION" != "NULL") 155 $run = $run --reduction $REDUCTION 156 end 131 $run = detrend_correct_imfile.pl --det_id $DET_ID --class_id $CLASS_ID --det_type $DET_TYPE --input_uri $URI --camera $CAMERA --outroot $outroot --redirect-output --verbose 157 132 add_standard_args run 158 133 … … 169 144 # default exit status 170 145 task.exit default 171 process_exit detPendingCorrect edImfile $options:0 $JOB_STATUS146 process_exit detPendingCorrectImfile $options:0 $JOB_STATUS 172 147 end 173 148 … … 175 150 task.exit timeout 176 151 showcommand timeout 177 book setword detPendingCorrect edImfile $options:0 pantaskState TIMEOUT152 book setword detPendingCorrectImfile $options:0 pantaskState TIMEOUT 178 153 end 179 154 end 180 155 181 # select images ready for copy182 # new entries are added to detPendingCorrectedExp183 # compare the new list with the ones already selected184 task detrend.correctexp.load185 host local186 187 periods -poll $LOADPOLL188 periods -exec $LOADEXEC189 periods -timeout 30190 npending 1191 192 stdout NULL193 stderr $LOGDIR/detcorr.exp.load.log194 195 task.exec196 $run = dettool -tocorrectedexp197 if ($DB:n == 0)198 option DEFAULT199 else200 # save the DB name for the exit tasks201 option $DB:$detPendingCorrectedExp_DB202 $run = $run -dbname $DB:$detPendingCorrectedExp_DB203 $detPendingCorrectedExp_DB ++204 if ($detPendingCorrectedExp_DB >= $DB:n) set detPendingCorrectedExp_DB = 0205 end206 add_poll_args run207 command $run208 end209 210 # success211 task.exit 0212 # convert 'stdout' to book format213 ipptool2book stdout detPendingCorrectedExp -key det_id:exp_id -uniq -setword dbname $options:0 -setword pantaskState INIT214 if ($VERBOSE > 2)215 book listbook detPendingCorrectedExp216 end217 218 # delete existing entries in the appropriate pantaskStates219 process_cleanup detPendingCorrectedExp220 end221 222 # error223 task.exit default224 showcommand failure225 end226 227 # operation times out?228 task.exit timeout229 showcommand timeout230 end231 end232 233 # copy new images, sending job to desired host234 task detrend.correctexp.run235 periods -poll $RUNPOLL236 periods -exec $RUNEXEC237 periods -timeout 30238 239 task.exec240 book npages detPendingCorrectedExp -var N241 if ($N == 0) break242 if ($NETWORK == 0) break243 244 # look for new exposures in detPendingCorrectedExp245 book getpage detPendingCorrectedExp 0 -var pageName -key pantaskState INIT246 if ("$pageName" == "NULL") break247 248 book setword detPendingCorrectedExp $pageName pantaskState RUN249 book getword detPendingCorrectedExp $pageName det_id -var DET_ID250 book getword detPendingCorrectedExp $pageName exp_id -var EXP_ID251 book getword detPendingCorrectedExp $pageName det_type -var DET_TYPE252 book getword detPendingCorrectedExp $pageName camera -var CAMERA253 book getword detPendingCorrectedExp $pageName exp_tag -var EXP_TAG254 book getword detPendingCorrectedExp $pageName corr_id -var CORR_ID255 book getword detPendingCorrectedExp $pageName corr_type -var CORR_TYPE256 book getword detPendingCorrectedExp $pageName workdir -var WORKDIR_TEMPLATE257 book getword detPendingCorrectedExp $pageName dbname -var DBNAME258 259 # specify choice of local or remote host based on camera and chip (class_id)260 set.host.for.camera $camera FPA261 262 # set workdir (interpolate host; see camera.pro for examples)263 set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR264 265 ## generate outroot specific to this exposure (& chip)266 sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID267 268 stdout $LOGDIR/detcorr.exp.run.log269 stderr $LOGDIR/detcorr.exp.run.log270 271 $run = detrend_correct_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --redirect-output --verbose272 273 if ("$WORKDIR" != "NULL")274 $run = $run --workdir $WORKDIR275 end276 add_standard_args run277 278 # save the pageName for future reference below279 options $pageName280 281 # create example job options as a demonstration282 if ($VERBOSE > 1)283 echo command $run284 end285 command $run286 end287 288 # success289 task.exit default290 process_exit detPendingCorrectedExp $options:0 $JOB_STATUS291 end292 293 # operation times out?294 task.exit timeout295 showcommand timeout296 book setword detPendingCorrectedExp $options:0 pantaskState TIMEOUT297 end298 end
Note:
See TracChangeset
for help on using the changeset viewer.
