IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2024, 2:26:58 PM (2 years ago)
Author:
eugene
Message:

skip lossy-compressed files, skip missing chips

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/eam/rawfix.20230221/src/ipp_apply_burntool_psvideo.pl

    r42458 r42646  
    1515use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    1616use Pod::Usage qw( pod2usage );
     17
     18use Sys::Hostname;
     19my $host = hostname();
     20my $date = `date`;
     21print "\n\n";
     22print "Starting script $0 on $host at $date\n\n";
    1723
    1824my ( $class_id, $dateobs_begin, $dateobs_end, $convert, $dbname, $logfile, $verbose, $save_temps, $rerun, $psvidOutput);
     
    6571$ipprc->redirect_output($logfile) if $logfile;
    6672
    67 # Determine the value of a "good" burntool run.
    68 # XXX this program should always generate the latest version
    69 # but the processing system must be told to use an earlier version
    70 # until the newer version is validated.  Perhaps split these.
    71 my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
    72 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    73     run ( command => $config_cmd, verbose => $verbose);
    74 unless ($success) {
    75     $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    76     &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
    77 }
    78 
    79 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
    80     &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
    81 
    82 my $burntoolStateGood = 999;
    83 foreach my $cfg (@$recipeData) {
    84     if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
    85         $burntoolStateGood = $cfg->{value};
    86     }
    87 }
    88 if ($burntoolStateGood == 999) {
    89     &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);
     73my $burntoolStateGood = 15;
     74if (0) {
     75    # Determine the value of a "good" burntool run.
     76    # XXX this program should always generate the latest version
     77    # but the processing system must be told to use an earlier version
     78    # until the newer version is validated.  Perhaps split these.
     79
     80    my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
     81    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     82        run ( command => $config_cmd, verbose => $verbose);
     83    unless ($success) {
     84        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     85        &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
     86    }
     87
     88    my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
     89        &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
     90
     91    my $burntoolStateGood = 999;
     92    foreach my $cfg (@$recipeData) {
     93        if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
     94            $burntoolStateGood = $cfg->{value};
     95        }
     96    }
     97    if ($burntoolStateGood == 999) {
     98        &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);
     99    }
    90100}
    91101my $outState = -1 * abs($burntoolStateGood);
    92102
    93103print "Target burntool version: $burntoolStateGood\n";
     104if ($burntoolStateGood != 15) { &my_die ("burntool state is not set to 15\n"); }
    94105
    95106# Define list of images to examine.
     
    101112$command .= " -dbname $dbname" if defined $dbname;
    102113
    103 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     114my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    104115    run ( command => $command, verbose => $verbose);
    105116unless ($success) {
     
    144155    my $rawImfile = $file->{uri};
    145156    my $rawImfileReal = $ipprc->file_resolve($rawImfile, 0);
     157    if (not defined $rawImfileReal) {
     158        print "DEAD: $rawImfile, no valid instances found\n";
     159        next;
     160    }
    146161
    147162    my $outTable  = $file->{uri};
    148163   
     164    my $data_state = $file->{data_state};
     165    if ($data_state eq "lossy") {
     166        print "## skipping $rawImfile : data_state $data_state\n";
     167        next;
     168    }
     169
    149170    if($burntoolStateGood == 15) {
    150171        $outTable =~ s/fits$/burn.v15.tbl/;         
     
    200221        $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN);
    201222        if ($status) {
     223            print "FAIL: funpack fails for $rawImfile\n";
    202224            &my_die("failed on funpack",$exp_id,$class_id);
    203225        }
     
    210232        }
    211233        if ($status) {
     234            print STDERR "BURN: burntool failed for $exp_id $class_id\n";
    212235            &my_die("failed on burntool",$exp_id,$class_id);
    213236        }
     
    269292sub my_die {
    270293    my $message = shift;
     294    printf STDERR "$message\n";
    271295    if ($#_ != -1) {
    272296        my $exp_id = shift;
     
    274298        vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1);
    275299    }
    276     printf STDERR "$message\n";
     300    print STDERR "updated database with burntool state -3\n";
    277301    exit 1;
    278302}
Note: See TracChangeset for help on using the changeset viewer.