IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 8, 2011, 2:44:12 PM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20110906
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110906

  • branches/eam_branches/ipp-20110906/ippScripts/scripts/warp_skycell.pl

    r31941 r32630  
    3838
    3939my ($warp_id, $skycell_id, $warp_skyfile_id, $tess_dir, $reduction, $camera, $dbname, $outroot, $threads, $run_state, $magicked, $verbose, $no_update, $no_op, $redirect, $save_temps);
    40 my $zaplog = 0;
    4140
    4241GetOptions(
     
    5554    'no-update'           => \$no_update, # Don't update the database?
    5655    'no-op'               => \$no_op, # Don't do any operations?
    57     'zaplog'              => \$zaplog, # delete previous logfile
    5856    'redirect-output'     => \$redirect,
    5957    'save-temps'          => \$save_temps, # Save temporary files?
     
    7775my $do_stats;
    7876if ($run_state eq 'new') {
    79     $logDest = prepare_output("LOG.EXP", $outroot, $skycell_id, $zaplog);
     77    $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id);
    8078    $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1);
    8179    $do_stats = 1;
    8280} elsif ($run_state eq 'update')  {
    83     $logDest = prepare_output("LOG.EXP.UPDATE", $outroot, $skycell_id, 1);
     81    $logDest = $ipprc->filename("LOG.EXP.UPDATE", $outroot, $skycell_id);
    8482    $traceDest = prepare_output("TRACE.EXP.UPDATE", $outroot, $skycell_id, 1);
    8583} else {
     
    9391}
    9492
    95 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect;
     93$ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect;
    9694
    9795# Recipes to use based on reduction class
     
    333331            }
    334332        }
    335 
     333        print "Quality: $quality\n";
    336334        unless ($no_update) {
    337335            # XXX change -tess_id to -tess_dir when db is updated
     
    358356        }
    359357    } else {
     358
     359        my $quality = 0;
     360
     361        unless ($ipprc->file_exists($outputPSF)) {
     362            $quality = 8006; # bad data.
     363        }
     364#         if (!$quality) {
     365#             check_output($outputImage, 0);
     366#             check_output($outputMask, 0);
     367#             check_output($outputWeight, 0);
     368#             check_output($outputSources, 1);
     369#             check_output($outputPSF, 1) if metadataLookupBool($recipe, 'PSF')  ;
     370#         }
     371        print "Quality: $quality\n";
     372
    360373        # $run_state eq 'update'
    361374        unless ($no_update) {
     
    364377            $command .= " -skycell_id $skycell_id";
    365378            $command .= " -set_magicked $magicked" if $magicked;
     379            $command .= " -set_quality $quality" if $quality;
    366380            $command .= " -dbname $dbname"   if defined $dbname;
    367381
     
    407421
    408422    &my_die("Couldn't find expected output file: $file",  $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file);
     423
     424    # Funpack to confirm we've really made things correctly
     425    my $diskfile = $ipprc->file_resolve($file);
     426    if ($diskfile =~ /fits/) {
     427        my $funpack  = can_run('funpack') or &my_die ("Can't find funpack", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR);
     428        my $check_command = "$funpack -S $diskfile > /dev/null";
     429        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     430            run(command => $check_command, verbose => $verbose);
     431        if (!$success) {
     432            &my_die("Output file not a valid fits file: $file", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR);
     433        }
     434    }
     435    #####
    409436
    410437    if ($replicate and $neb) {
Note: See TracChangeset for help on using the changeset viewer.