IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2010, 2:07:51 PM (16 years ago)
Author:
bills
Message:

Make update processing compatible with magic. Fix some bugs in update for the warp stage
Make script changes to implement update for diff stage.
Change value of 'magicked' in the various runs and files to contain the value
the magic_id of the magicRun that corresponds to the streaks file used for desreaking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/diff_skycell.pl

    r24179 r26567  
    3535}
    3636
    37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $verbose, $no_update, $no_op, $redirect);
     37my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $run_state, $verbose, $no_update, $no_op, $redirect);
    3838my ($skycell_id, $diff_skyfile_id);
    3939GetOptions(
     
    4343    'dbname|d=s'        => \$dbname, # Database name
    4444    'threads=s'         => \$threads,   # Number of threads to use
     45    'run-state=s'       => \$run_state,   # state for run: 'new' or 'update'
    4546    'outroot=s'         => \$outroot, # Output root name
    4647    'inverse'           => \$inverse, # Make inverse subtraction?
     
    5455pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5556pod2usage(
    56     -msg => "Required options: --diff_id --skycell_id --outroot",
     57    -msg => "Required options: --diff_id --skycell_id --outroot --run-state",
    5758    -exitval => 3,
    5859          ) unless defined $diff_id
    5960    and defined $skycell_id
    6061    and defined $diff_skyfile_id
     62    and defined $run_state
    6163    and defined $outroot;
    6264
     
    6668# my $logDest = $ipprc->filename("LOG.EXP", $outroot);
    6769my $logDest = "$outroot.log";
     70$logDest .= ".update" if $run_state eq "update";
    6871$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    6972
     
    155158# The output file will be considered magicked if the input has been magicked and the
    156159# 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;
     160my $magicked = $inputMagic && $templateMagic ? $inputMagic : 0;
    160161
    161162# Recipes to use based on reduction class
     
    212213my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot);
    213214my $traceDest = $ipprc->filename("TRACE.EXP", $outroot);
     215
     216if ($run_state eq 'update') {
     217    $traceDest .= '.update';
     218    $outputStats .= '.update';
     219}
    214220
    215221my ($inverseName, $inverseMask, $inverseVariance, $inverseSources);
     
    236242    $command .= " -stats $outputStats";
    237243    $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    }
    238250    $command .= " -recipe PPSUB $recipe_ppSub";
    239251    $command .= " -recipe PSPHOT $recipe_psphot";
     
    245257    $command .= " -inverse" if $inverse;
    246258    $command .= " -tracedest $traceDest -log $logDest";
    247     $command .= " -dumpconfig $configuration";
    248259    $command .= " -dbname $dbname" if defined $dbname;
    249260    $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id;
     
    295306    # Add the subtraction result
    296307    {
    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        }
    302318        $command .= " -dbname $dbname" if defined $dbname;
    303319
     
    306322        unless ($success) {
    307323            $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);
    309328        }
    310329    }
     
    323342    warn($msg);
    324343    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        }
    330354        run(command => $command, verbose => $verbose);
    331355    }
Note: See TracChangeset for help on using the changeset viewer.