Index: /trunk/tools/eam/rawfix.20230221/src/ipp_apply_burntool_psvideo.pl
===================================================================
--- /trunk/tools/eam/rawfix.20230221/src/ipp_apply_burntool_psvideo.pl	(revision 42645)
+++ /trunk/tools/eam/rawfix.20230221/src/ipp_apply_burntool_psvideo.pl	(revision 42646)
@@ -15,4 +15,10 @@
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
 use Pod::Usage qw( pod2usage );
+
+use Sys::Hostname;
+my $host = hostname();
+my $date = `date`;
+print "\n\n";
+print "Starting script $0 on $host at $date\n\n";
 
 my ( $class_id, $dateobs_begin, $dateobs_end, $convert, $dbname, $logfile, $verbose, $save_temps, $rerun, $psvidOutput);
@@ -65,31 +71,36 @@
 $ipprc->redirect_output($logfile) if $logfile;
 
-# Determine the value of a "good" burntool run.
-# XXX this program should always generate the latest version
-# but the processing system must be told to use an earlier version 
-# until the newer version is validated.  Perhaps split these.
-my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
-my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-    run ( command => $config_cmd, verbose => $verbose);
-unless ($success) {
-    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-    &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
-}
-
-my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
-    &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
-
-my $burntoolStateGood = 999;
-foreach my $cfg (@$recipeData) {
-    if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
-        $burntoolStateGood = $cfg->{value};
-    }
-}
-if ($burntoolStateGood == 999) {
-    &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);
+my $burntoolStateGood = 15;
+if (0) { 
+    # Determine the value of a "good" burntool run.
+    # XXX this program should always generate the latest version
+    # but the processing system must be told to use an earlier version 
+    # until the newer version is validated.  Perhaps split these.
+
+    my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	run ( command => $config_cmd, verbose => $verbose);
+    unless ($success) {
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
+    }
+
+    my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
+	&my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
+
+    my $burntoolStateGood = 999;
+    foreach my $cfg (@$recipeData) {
+	if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
+	    $burntoolStateGood = $cfg->{value};
+	}
+    }
+    if ($burntoolStateGood == 999) {
+	&my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);
+    }
 }
 my $outState = -1 * abs($burntoolStateGood);
 
 print "Target burntool version: $burntoolStateGood\n";
+if ($burntoolStateGood != 15) { &my_die ("burntool state is not set to 15\n"); }
 
 # Define list of images to examine.
@@ -101,5 +112,5 @@
 $command .= " -dbname $dbname" if defined $dbname;
 
-( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     run ( command => $command, verbose => $verbose);
 unless ($success) {
@@ -144,7 +155,17 @@
     my $rawImfile = $file->{uri};
     my $rawImfileReal = $ipprc->file_resolve($rawImfile, 0);
+    if (not defined $rawImfileReal) {
+        print "DEAD: $rawImfile, no valid instances found\n";
+	next;
+    }
 
     my $outTable  = $file->{uri};
     
+    my $data_state = $file->{data_state};
+    if ($data_state eq "lossy") {
+	print "## skipping $rawImfile : data_state $data_state\n";
+	next;
+    }
+
     if($burntoolStateGood == 15) {
         $outTable =~ s/fits$/burn.v15.tbl/;	    
@@ -200,4 +221,5 @@
         $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN);
         if ($status) {
+	    print "FAIL: funpack fails for $rawImfile\n";
             &my_die("failed on funpack",$exp_id,$class_id);
         }
@@ -210,4 +232,5 @@
         }
         if ($status) {
+	    print STDERR "BURN: burntool failed for $exp_id $class_id\n";
             &my_die("failed on burntool",$exp_id,$class_id);
         }
@@ -269,4 +292,5 @@
 sub my_die {
     my $message = shift;
+    printf STDERR "$message\n";
     if ($#_ != -1) {
         my $exp_id = shift;
@@ -274,5 +298,5 @@
         vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1);
     }
-    printf STDERR "$message\n";
+    print STDERR "updated database with burntool state -3\n";
     exit 1;
 }
