IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2009, 6:15:31 PM (17 years ago)
Author:
beaumont
Message:

merged with head

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

    r23352 r23594  
    9191
    9292# Identify the input and the template
    93 my ($input, $inputMask, $inputVariance, $inputPath); # Input files and path
     93my ($input, $inputMask, $inputVariance, $inputPath, $inputSources); # Input files and path
    9494my ($template, $templateMask, $templateVariance, $templatePath, $templateSources); # Template files and path
    9595my $tess_id;                    # Tesselation identifier
    9696my $camera;                     # Camera
     97my $magicked_0;
     98my $magicked_1;
    9799foreach my $file (@$files) {
    98100    if (defined $file->{template} and $file->{template}) {
     
    103105            $templateVariance = "PPSTACK.OUTPUT.VARIANCE";
    104106            $templateSources = "PSPHOT.OUT.CMF.MEF";  ## this must be consistent with the value in stack_skycell.pl:161
     107            # template is a stack so it doesn't need to be magicked
     108            $magicked_1 = 1;
    105109            ## use an explicit stack name for psphot output objects
    106110        } else {
     
    108112            $templateVariance = "PSWARP.OUTPUT.VARIANCE";
    109113            $templateSources = "PSWARP.OUTPUT.SOURCES";
     114            $magicked_1 = $file->{magicked};
    110115        }
    111116    } else {
    112117        $input = $file->{uri};
    113118        $inputPath = $file->{path_base};
     119        $magicked_0 = $file->{magicked};    # if input is a stack the output can't be "magicked"
    114120        if ($file->{warp_id} == 0) {
    115121            $inputMask = "PPSTACK.OUTPUT.MASK";
    116122            $inputVariance = "PPSTACK.OUTPUT.VARIANCE";
     123            $inputSources = "PSPHOT.OUT.CMF.MEF";  ## this must be consistent with the value in stack_skycell.pl:161
    117124        } else {
    118125            $inputMask = "PSWARP.OUTPUT.MASK";
    119126            $inputVariance = "PSWARP.OUTPUT.VARIANCE";
     127            $inputSources = "PSWARP.OUTPUT.SOURCES";
    120128        }
    121129    }
     
    144152&my_die("Unable to identify camera", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless defined $camera;
    145153$ipprc->define_camera($camera);
     154
     155# Compute the magicked status of the output.
     156# The output file will be considered magicked if the input has been magicked and the
     157# template is either a stack or a warp that has been magicked.
     158# note that difftool -inputskyfile outputs the magicked boolean as an int not T or F
     159# because the output is constructed from a union of two selects
     160my $magicked = $magicked_0 && $magicked_1;
    146161
    147162# Recipes to use based on reduction class
     
    160175# print "inputVariance: $inputVariance\n";
    161176# print "templateSources: $templateSources\n";
     177# print "inputSources: $inputSources\n";
     178
     179$inputMask = $ipprc->filename($inputMask, $inputPath);
     180$inputVariance = $ipprc->filename($inputVariance, $inputPath);
     181$inputSources = $ipprc->filename($inputSources, $inputPath);
    162182
    163183$templateMask = $ipprc->filename($templateMask, $templatePath);
    164 $inputMask = $ipprc->filename($inputMask, $inputPath);
    165184$templateVariance = $ipprc->filename($templateVariance, $templatePath);
    166 $inputVariance = $ipprc->filename($inputVariance, $inputPath);
    167185$templateSources = $ipprc->filename($templateSources, $templatePath);
    168186
     
    174192print "inputVariance: $inputVariance\n";
    175193print "templateSources: $templateSources\n";
     194print "inputSources: $inputSources\n";
    176195
    177196&my_die("Couldn't find input: $template", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($template);
    178197&my_die("Couldn't find input: $templateMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateMask);
    179198&my_die("Couldn't find input: $templateVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateVariance);
     199&my_die("Couldn't find input: $templateSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateSources);
    180200&my_die("Couldn't find input: $input", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input);
    181201&my_die("Couldn't find input: $inputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputMask);
    182202&my_die("Couldn't find input: $inputVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputVariance);
    183 &my_die("Couldn't find input: $templateSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateSources);
     203&my_die("Couldn't find input: $inputSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputSources);
    184204
    185205# Get the output filenames
     
    198218# Perform subtraction
    199219unless ($no_op) {
    200     my $command = "$ppSub $input $template $outroot";
     220    my $command = "$ppSub $outroot";
     221    $command .= " -inimage $input";
     222    $command .= " -refimage $template";
    201223    $command .= " -inmask $inputMask";
    202224    $command .= " -refmask $templateMask";
    203225    $command .= " -invariance $inputVariance";
    204226    $command .= " -refvariance $templateVariance";
     227    $command .= " -insources $inputSources";
     228    $command .= " -refsources $templateSources";
    205229    $command .= " -stats $outputStats";
    206230    $command .= " -threads $threads" if defined $threads;
     
    211235    $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF";
    212236    $command .= " -F PSPHOT.BACKMDL PSPHOT.BACKMDL.MEF";
    213     $command .= " -sources $templateSources";
    214237    $command .= " -photometry";
    215238    $command .= " -tracedest $traceDest -log $logDest";
     
    255278        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -uri $outputName -path_base $outroot";
    256279        $command .= " $cmdflags";
     280        $command .= " -magicked" if $magicked;
    257281        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    258282        $command .= " -hostname $host" if defined $host;
Note: See TracChangeset for help on using the changeset viewer.