IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 26, 2009, 1:59:32 PM (17 years ago)
Author:
beaumont
Message:

merged with trunk

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ippScripts/scripts/diff_skycell.pl

    r23594 r24244  
    3535}
    3636
    37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $verbose, $no_update, $no_op, $redirect);
     37my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $verbose, $no_update, $no_op, $redirect);
    3838my ($skycell_id, $diff_skyfile_id);
    3939GetOptions(
     
    4444    'threads=s'         => \$threads,   # Number of threads to use
    4545    'outroot=s'         => \$outroot, # Output root name
     46    'inverse'           => \$inverse, # Make inverse subtraction?
    4647    'reduction=s'       => \$reduction, # Reduction class
    4748    'verbose'           => \$verbose,   # Print to stdout
     
    9596my $tess_id;                    # Tesselation identifier
    9697my $camera;                     # Camera
    97 my $magicked_0;
    98 my $magicked_1;
     98my ($inputMagic, $templateMagic); # Are the inputs been magicked?
    9999foreach my $file (@$files) {
    100100    if (defined $file->{template} and $file->{template}) {
     
    106106            $templateSources = "PSPHOT.OUT.CMF.MEF";  ## this must be consistent with the value in stack_skycell.pl:161
    107107            # template is a stack so it doesn't need to be magicked
    108             $magicked_1 = 1;
     108            $templateMagic = 1;
    109109            ## use an explicit stack name for psphot output objects
    110110        } else {
     
    112112            $templateVariance = "PSWARP.OUTPUT.VARIANCE";
    113113            $templateSources = "PSWARP.OUTPUT.SOURCES";
    114             $magicked_1 = $file->{magicked};
     114            $templateMagic = $file->{magicked};
    115115        }
    116116    } else {
    117117        $input = $file->{uri};
    118118        $inputPath = $file->{path_base};
    119         $magicked_0 = $file->{magicked};    # if input is a stack the output can't be "magicked"
     119        $inputMagic = $file->{magicked};    # if input is a stack the output can't be "magicked"
    120120        if ($file->{warp_id} == 0) {
    121121            $inputMask = "PPSTACK.OUTPUT.MASK";
     
    145145        $camera = $file->{camera};
    146146    }
    147 
    148147}
    149148
     
    158157# note that difftool -inputskyfile outputs the magicked boolean as an int not T or F
    159158# because the output is constructed from a union of two selects
    160 my $magicked = $magicked_0 && $magicked_1;
     159my $magicked = $inputMagic && $templateMagic;
    161160
    162161# Recipes to use based on reduction class
     
    207206my $outputMask = $ipprc->filename("PPSUB.OUTPUT.MASK", $outroot);
    208207my $outputVariance = $ipprc->filename("PPSUB.OUTPUT.VARIANCE", $outroot);
     208my $outputSources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $outroot);
     209my $jpeg1Name = $ipprc->filename("PPSUB.OUTPUT.JPEG1", $outroot);
     210my $jpeg2Name = $ipprc->filename("PPSUB.OUTPUT.JPEG2", $outroot);
    209211my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot);
    210 my $outputSources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $outroot);
    211 #my $bin1Name =  $ipprc->filename("PPSUB.BIN1", $outroot);
    212 #my $bin2Name =  $ipprc->filename("PPSUB.BIN2", $outroot);
    213212my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot);
    214213my $traceDest = $ipprc->filename("TRACE.EXP", $outroot);
     214
     215my ($inverseName, $inverseMask, $inverseVariance, $inverseSources);
     216if ($inverse) {
     217    $inverseName = $ipprc->filename("PPSUB.INVERSE", $outroot);
     218    $inverseMask = $ipprc->filename("PPSUB.INVERSE.MASK", $outroot);
     219    $inverseVariance = $ipprc->filename("PPSUB.INVERSE.VARIANCE", $outroot);
     220    $inverseSources = $ipprc->filename("PPSUB.INVERSE.SOURCES", $outroot);
     221}
    215222
    216223my $cmdflags;
     
    236243    $command .= " -F PSPHOT.BACKMDL PSPHOT.BACKMDL.MEF";
    237244    $command .= " -photometry";
     245    $command .= " -inverse" if $inverse;
    238246    $command .= " -tracedest $traceDest -log $logDest";
    239247    $command .= " -dumpconfig $configuration";
     
    248256        &my_die("Unable to perform ppSub: $error_code", $diff_id, $skycell_id, $error_code);
    249257    }
    250     &my_die("Couldn't find expected output file: $outputName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
    251     &my_die("Couldn't find expected output file: $outputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    252     &my_die("Couldn't find expected output file: $outputVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
    253 #    &my_die("Couldn't find expected output file: $outputSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
    254 #    &my_die("Couldn't find expected output file: $bin1Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name);
    255 #    &my_die("Couldn't find expected output file: $bin2Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
    256258
    257259    my $outputStatsReal = $ipprc->file_resolve($outputStats);
     
    270272    }
    271273    chomp $cmdflags;
     274
     275    my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
     276
     277    if (!$quality) {
     278        &my_die("Couldn't find expected output file: $outputName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
     279        &my_die("Couldn't find expected output file: $outputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     280        &my_die("Couldn't find expected output file: $outputVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
     281        &my_die("Couldn't find expected output file: $outputSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
     282        &my_die("Couldn't find expected output file: $jpeg1Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($jpeg1Name);
     283        &my_die("Couldn't find expected output file: $jpeg2Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($jpeg2Name);
     284        if ($inverse) {
     285            &my_die("Couldn't find expected output file: $inverseName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseName);
     286            &my_die("Couldn't find expected output file: $inverseMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseMask);
     287            &my_die("Couldn't find expected output file: $inverseVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseVariance);
     288            &my_die("Couldn't find expected output file: $inverseSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseSources);
     289        }
     290    }
    272291}
    273292
     
    276295    # Add the subtraction result
    277296    {
    278         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -uri $outputName -path_base $outroot";
     297        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -path_base $outroot";
    279298        $command .= " $cmdflags";
    280299        $command .= " -magicked" if $magicked;
     
    304323    warn($msg);
    305324    if (defined $diff_id and defined $skycell_id and not $no_update) {
    306         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -code $exit_code";
     325        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -fault $exit_code";
    307326        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    308327        $command .= " -hostname $host" if defined $host;
Note: See TracChangeset for help on using the changeset viewer.