IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 19, 2012, 5:24:19 PM (14 years ago)
Author:
mhuber
Message:

merging latest r34040 trunk changes to branch

Location:
branches/meh_branches/ppstack_test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/meh_branches/ppstack_test

  • branches/meh_branches/ppstack_test/ippScripts/scripts/staticsky.pl

    r31662 r34041  
    8181    -msg => "Required options: --sky_id --outroot --camera",
    8282    -exitval => 3,
    83           ) unless 
     83          ) unless
    8484    defined $sky_id and
    8585    defined $outroot and
     
    8989
    9090my $logDest = $ipprc->filename("LOG.EXP", $outroot);
    91 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $sky_id, $PS_EXIT_SYS_ERROR ) if $redirect;
     91$ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $sky_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    9292
    9393my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
     
    120120
    121121
    122 # generate the input 
     122# generate the input
    123123print $listFile "INPUT   MULTI\n";
    124124my $nInputs = @$files;
     
    144144            my $path_base = $file->{path_base};
    145145            print "input: $path_base\n";
     146            my $stack_id = $file->{stack_id};
    146147
    147148            my $imageCnv  = $ipprc->filename("PPSTACK.OUTPUT",          $path_base ); # Image name
    148149            my $maskCnv   = $ipprc->filename("PPSTACK.OUTPUT.MASK",     $path_base ); # Mask name
    149150            my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name
     151            my $expnumCnv = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM",   $path_base ); # Expnum name
    150152
    151153            my $imageRaw  = $ipprc->filename("PPSTACK.UNCONV",          $path_base ); # Image name
    152154            my $maskRaw   = $ipprc->filename("PPSTACK.UNCONV.MASK",     $path_base ); # Mask name
    153155            my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name
     156            my $expnumRaw = $ipprc->filename("PPSTACK.UNCONV.EXPNUM",   $path_base ); # Expnum name
    154157
    155158            my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF",      $path_base ); # Sources name
     
    162165            &my_die("Couldn't find input: $maskRaw",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw");
    163166            &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw");
     167            &my_die("Couldn't find input: $expnumRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$expnumRaw");
    164168            &my_die("Couldn't find input: $imageCnv",  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv");
    165169            &my_die("Couldn't find input: $maskCnv",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv");
    166170            &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv");
     171            &my_die("Couldn't find input: $expnumCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$expnumCnv");
    167172            &my_die("Couldn't find input: $psfCnv",    $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv");
    168173            &my_die("Couldn't find input: $sources",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources");
    169174
     175            print $listFile "  STACK_ID      S64  " . $stack_id  . "\n";
    170176            print $listFile "  RAW:IMAGE     STR  " . $imageRaw  . "\n";
    171177            print $listFile "  RAW:MASK      STR  " . $maskRaw   . "\n";
    172178            print $listFile "  RAW:VARIANCE  STR  " . $weightRaw . "\n";
     179            print $listFile "  RAW:EXPNUM    STR  " . $expnumRaw . "\n";
    173180
    174181            print $listFile "  CNV:IMAGE     STR  " . $imageCnv  . "\n";
    175182            print $listFile "  CNV:MASK      STR  " . $maskCnv   . "\n";
    176183            print $listFile "  CNV:VARIANCE  STR  " . $weightCnv . "\n";
     184            print $listFile "  CNV:EXPNUM    STR  " . $expnumCnv . "\n";
    177185            print $listFile "  CNV:PSF       STR  " . $psfCnv    . "\n";
    178186
     
    227235                    # we have one set of output files per input file set
    228236                    for (my $i = 0; $i < @$files; $i++) {
    229                         my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
    230                         my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
    231                         my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
    232                         my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
     237                        my $stack_id = @$files[$i]->{stack_id};
     238                        my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $stack_id);
     239                        my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $stack_id);
     240                        my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $stack_id);
     241                        my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $stack_id);
    233242
    234243                        # XXX these are optional and not generated by default
     
    248257
    249258                    # XXX check the recipe -- should we expect these to exist?
    250                     # &my_die("Couldn't find expected output file: $chisqName",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
    251                     # &my_die("Couldn't find expected output file: $chisqMask",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
     259                    # &my_die("Couldn't find expected output file: $chisqName",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
     260                    # &my_die("Couldn't find expected output file: $chisqMask",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
    252261                    # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance);
    253262                }
     
    288297        my $use_raw = metadataLookupBool($recipeData, 'PSPHOT.STACK.USE.RAW');
    289298
    290         my ($image, $mask, $variance);
     299        my ($image, $mask, $variance, $expnum);
    291300        if ($use_raw) {
    292301            $image  = $ipprc->filename("PPSTACK.UNCONV",          $path_base ); # Image name
     
    297306            $mask   = $ipprc->filename("PPSTACK.OUTPUT.MASK",     $path_base ); # Mask name
    298307            $variance = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name
     308            $expnum = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM", $path_base ); # Weight name
    299309        }
    300310
     
    306316        &my_die("Couldn't find input: $mask",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$mask");
    307317        &my_die("Couldn't find input: $variance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$variance");
     318        &my_die("Couldn't find input: $expnum", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$expnum");
    308319
    309320        # Perform stack photometry analysis
     
    313324            $command .= " -mask $mask";
    314325            $command .= " -variance $variance";
     326            $command .= " -expnum $expnum";
    315327            $command .= " -threads $threads" if defined $threads;
    316328            $command .= " -recipe PSPHOT  $recipe_psphot";
     
    335347                }
    336348
    337                 &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR) 
     349                &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR)
    338350                    unless $ipprc->file_exists($configuration);
    339351            } else {
     
    348360    {
    349361        my $command = "$staticskytool -sky_id $sky_id";
    350         $command .= " -addresult -path_base $outroot";
    351         $command .= " -num_inputs $nInputs";
    352         # $command .= " $cmdflags";
    353         $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    354         $command .= " -hostname $host" if defined $host;
     362        $command .= " -addresult -path_base $outroot";
     363        $command .= " -num_inputs $nInputs";
     364        # $command .= " $cmdflags";
     365        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     366        $command .= " -hostname $host" if defined $host;
    355367        $command .= " -dbname $dbname" if defined $dbname;
    356368
     
    360372            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    361373            my $err_message = "Unable to perform staticskytool -addresult";
    362             warn($err_message);
    363             exit $error_code;
     374            warn($err_message);
     375            exit $error_code;
    364376        }
    365377    }
     
    378390    if (defined $sky_id and not $no_update) {
    379391        my $command = "$staticskytool -sky_id $sky_id -fault $exit_code";
    380         $command .= " -addresult";
    381         $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    382         $command .= " -hostname $host" if defined $host;
    383         $command .= " -path_base $outroot" if defined $outroot;
    384         $command .= " -dbname $dbname" if defined $dbname;
     392        $command .= " -addresult";
     393        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     394        $command .= " -hostname $host" if defined $host;
     395        $command .= " -path_base $outroot" if defined $outroot;
     396        $command .= " -dbname $dbname" if defined $dbname;
    385397        run(command => $command, verbose => $verbose);
    386398    }
Note: See TracChangeset for help on using the changeset viewer.