Changeset 26567 for trunk/ippScripts/scripts/diff_skycell.pl
- Timestamp:
- Jan 12, 2010, 2:07:51 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/diff_skycell.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/diff_skycell.pl
r24179 r26567 35 35 } 36 36 37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $ verbose, $no_update, $no_op, $redirect);37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $run_state, $verbose, $no_update, $no_op, $redirect); 38 38 my ($skycell_id, $diff_skyfile_id); 39 39 GetOptions( … … 43 43 'dbname|d=s' => \$dbname, # Database name 44 44 'threads=s' => \$threads, # Number of threads to use 45 'run-state=s' => \$run_state, # state for run: 'new' or 'update' 45 46 'outroot=s' => \$outroot, # Output root name 46 47 'inverse' => \$inverse, # Make inverse subtraction? … … 54 55 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 55 56 pod2usage( 56 -msg => "Required options: --diff_id --skycell_id --outroot ",57 -msg => "Required options: --diff_id --skycell_id --outroot --run-state", 57 58 -exitval => 3, 58 59 ) unless defined $diff_id 59 60 and defined $skycell_id 60 61 and defined $diff_skyfile_id 62 and defined $run_state 61 63 and defined $outroot; 62 64 … … 66 68 # my $logDest = $ipprc->filename("LOG.EXP", $outroot); 67 69 my $logDest = "$outroot.log"; 70 $logDest .= ".update" if $run_state eq "update"; 68 71 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect; 69 72 … … 155 158 # The output file will be considered magicked if the input has been magicked and the 156 159 # template is either a stack or a warp that has been magicked. 157 # note that difftool -inputskyfile outputs the magicked boolean as an int not T or F 158 # because the output is constructed from a union of two selects 159 my $magicked = $inputMagic && $templateMagic; 160 my $magicked = $inputMagic && $templateMagic ? $inputMagic : 0; 160 161 161 162 # Recipes to use based on reduction class … … 212 213 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 213 214 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 215 216 if ($run_state eq 'update') { 217 $traceDest .= '.update'; 218 $outputStats .= '.update'; 219 } 214 220 215 221 my ($inverseName, $inverseMask, $inverseVariance, $inverseSources); … … 236 242 $command .= " -stats $outputStats"; 237 243 $command .= " -threads $threads" if defined $threads; 244 my $configurationReal = $ipprc->file_resolve($configuration); 245 if ($run_state eq "new") { 246 $command .= " -dumpconfig $configurationReal"; 247 } else { 248 $command .= " -ipprc $configurationReal"; 249 } 238 250 $command .= " -recipe PPSUB $recipe_ppSub"; 239 251 $command .= " -recipe PSPHOT $recipe_psphot"; … … 245 257 $command .= " -inverse" if $inverse; 246 258 $command .= " -tracedest $traceDest -log $logDest"; 247 $command .= " -dumpconfig $configuration";248 259 $command .= " -dbname $dbname" if defined $dbname; 249 260 $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id; … … 295 306 # Add the subtraction result 296 307 { 297 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -path_base $outroot"; 298 $command .= " $cmdflags"; 299 $command .= " -magicked" if $magicked; 300 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 301 $command .= " -hostname $host" if defined $host; 308 my $command = "$difftool -diff_id $diff_id -skycell_id $skycell_id"; 309 $command .= " -magicked $magicked" if $magicked; 310 if ($run_state eq 'new') { 311 $command .= " -adddiffskyfile -path_base $outroot"; 312 $command .= " $cmdflags"; 313 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 314 $command .= " -hostname $host" if defined $host; 315 } else { 316 $command .= " -tofullskyfile"; 317 } 302 318 $command .= " -dbname $dbname" if defined $dbname; 303 319 … … 306 322 unless ($success) { 307 323 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 308 &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $skycell_id, $error_code); 324 my $err_message = $run_state eq "update" ? 325 "Unable to perform difftool -adddiffskyfile" : 326 "Unable to perform difftool -tofullskyfile"; 327 &my_die("$err_message: $error_code", $diff_id, $skycell_id, $error_code); 309 328 } 310 329 } … … 323 342 warn($msg); 324 343 if (defined $diff_id and defined $skycell_id and not $no_update) { 325 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -fault $exit_code"; 326 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 327 $command .= " -hostname $host" if defined $host; 328 $command .= " -path_base $outroot" if defined $outroot; 329 $command .= " -dbname $dbname" if defined $dbname; 344 my $command = "$difftool -diff_id $diff_id -skycell_id $skycell_id -fault $exit_code"; 345 if ($run_state eq 'new') { 346 $command .= " -adddiffskyfile"; 347 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 348 $command .= " -hostname $host" if defined $host; 349 $command .= " -path_base $outroot" if defined $outroot; 350 $command .= " -dbname $dbname" if defined $dbname; 351 } else { 352 $command .= " -updatediffskyfile"; 353 } 330 354 run(command => $command, verbose => $verbose); 331 355 }
Note:
See TracChangeset
for help on using the changeset viewer.
