Index: /tags/ipp-ops-20220906/ippScripts/scripts/nightly_science.pl
===================================================================
--- /tags/ipp-ops-20220906/ippScripts/scripts/nightly_science.pl	(revision 42418)
+++ /tags/ipp-ops-20220906/ippScripts/scripts/nightly_science.pl	(revision 42419)
@@ -1579,7 +1579,9 @@
 	    #find exposures for this object that have not been fully processed
             if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+                print STDERR "diff_queue: exposure with exp_id $this_exp_id for $this_object has warp_id $this_warp_id and quality $this_quality and is therefore not fully processed\n";
             	$Nbad += 1;
             }
             if (($chip_state ne 'full') || ($cam_state ne 'full') ) {
+                print STDERR "diff_queue: exposure with exp_id $this_exp_id for $this_object has chip state $chip_state and cam state $cam_state and is therefore not fully processed\n";
             	$Nbad += 1;
             }
@@ -1618,5 +1620,5 @@
             print STDERR "diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps } ";
             if ($#{ $warps} + 1 == 1) {
-                print STDERR ": I can do no diffs with only one exposure.\n";
+                print STDERR "diff_queue: I can do no diffs with only one exposure.\n";
                 next;
             }
@@ -1624,5 +1626,5 @@
                 my $rejected_warp = pop @{ $warps };
                 my $rejected_exp_id = ${ $rejected_warp }[0];
-                print STDERR ": Rejecting ${rejected_exp_id} to force visit count.\n";
+                print STDERR "diff_queue: Rejecting ${rejected_exp_id} to force visit count.\n";
             }
         }
@@ -1652,9 +1654,9 @@
             unless (defined($input_warp_id) && defined($template_warp_id) &&
                     ($input_warp_state eq 'full')&&($template_warp_state eq 'full')) {
-                print STDERR "Diff for this $date $target $input_exp_id $template_exp_id not fully processed ($input_warp_state $template_warp_state) ($input_warp_camQuality $template_warp_camQuality)\n";
+                print STDERR "diff_queue:Diff for this $date $target $input_exp_id $template_exp_id not fully processed ($input_warp_state $template_warp_state) ($input_warp_camQuality $template_warp_camQuality)\n";
                 if (($input_warp_camQuality == 4007)||($template_warp_camQuality == 4007)) {
                     # This should now never be reached.
                     # CZW: Trigger backup plan here?  Or simply set up framework?
-                    print STDERR "  ...but this is due to a camera stage astrometry quality\n";
+                    print STDERR "diff_queue: ...but this is due to a camera stage astrometry quality\n";
                     $Npotential--;
                 }
@@ -1664,9 +1666,9 @@
             if (verify_uniqueness_diff($input_warp_id,$template_warp_id,$date,$target) != 0) {
                 $Nqueued++;
-                print STDERR "Diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
+                print STDERR "diff_queue:Diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
                 next;
             }
             else {
-                print STDERR "Preparing to diff $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
+                print STDERR "diff_queue:Preparing to diff $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
             }
            
@@ -1793,7 +1795,9 @@
 	        #find exposures for this object that have not been fully processed
              	if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+                    print STDERR "desp_diff_singles: exposure with exp_id $this_exp_id for $this_object has warp_id $this_warp_id and quality $this_quality and is therefore not fully processed\n";
              	    $Nbad += 1;
              	}
              	if (($chip_state ne 'full') || ($cam_state ne 'full') ) {
+                    print STDERR "desp_diff_singles: exposure with exp_id $this_exp_id for $this_object has chip state $chip_state and cam state $cam_state and is therefore not fully processed\n";
              	    $Nbad += 1;
              	}
@@ -1864,8 +1868,9 @@
                 #The conditions are: uneven nr of warps greater than 3, and the most recent observations is more than $desdiffdt hours old
                 if (($nwarps % 2 != 0) && ($nwarps >= 3) && ($timediff < $desdiffdt)) {
-                    print STDERR "desp_diff_singles: There are potential desperate diffs to be done, but the time criterium is not met.\n";
+                    print STDERR "desp_diff_singles: There are potential desperate diffs to be done (nwarps = $nwarps), but the time criterium is not met ($timediff < $desdiffdt).\n";
                     next;
                 }
                 if (($nwarps % 2 == 0) || ($nwarps == 1) || ($timediff < $desdiffdt)) {
+                    print STDERR "desp_diff_singles: No desperate diffs will be attempted, since the number of warps is less than or equal to two ($nwarps) and/or the time criterium is not met ($timediff < $desdiffdt)\n";
                     next;
                 }
@@ -1881,5 +1886,5 @@
                     my $rejected_warp = pop @{ $warps };
                     my $rejected_exp_id = ${ $rejected_warp }[0];
-                    print STDERR ": Rejecting ${rejected_exp_id} to force visit count.\n";
+                    print STDERR "desp_diff_singles: Rejecting ${rejected_exp_id} to force visit count.\n";
                 }
        
@@ -1908,9 +1913,9 @@
                     unless (defined($input_warp_id) && defined($template_warp_id) &&
                         ($input_warp_state eq 'full')&&($template_warp_state eq 'full')) {
-                        print STDERR "Desp diff for this $date $target $input_exp_id $template_exp_id not fully processed ($input_warp_state $template_warp_state) ($input_warp_camQuality $template_warp_camQuality)\n";
+                        print STDERR "desp_diff_singles: Desp diff for this $date $target $input_exp_id $template_exp_id not fully processed ($input_warp_state $template_warp_state) ($input_warp_camQuality $template_warp_camQuality)\n";
                         if (($input_warp_camQuality == 4007)||($template_warp_camQuality == 4007)) {
                             # This should now never be reached.
                             # CZW: Trigger backup plan here?  Or simply set up framework?
-                            print STDERR "  ...but this is due to a camera stage astrometry quality\n";
+                            print STDERR "desp_diff_singles: ...but this is due to a camera stage astrometry quality\n";
                             $Npotential--;
                         }
@@ -1920,9 +1925,9 @@
                     if (verify_uniqueness_diff($input_warp_id,$template_warp_id,$date,$target) != 0) {
                         $Nqueued++;
-                        print STDERR "Desp diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
+                        print STDERR "desp_diff_singles: Desp diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
                         next;
                     }
                     else {
-                        print STDERR "Preparing to single desperate diff $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
+                        print STDERR "desp_diff_singles: Preparing to single desperate diff $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
                     }
            
@@ -1958,5 +1963,5 @@
            
             } else {       
-                print STDERR "desp_diff_singles: There is a possibility for dirty diffs to be made\n";	    
+                print STDERR "desp_diff_singles: There is a possibility for dirty diffs to be made, but this is not implemeted at the moment\n";	    
                 #Consider the case of on-the-fly dirty desperate diffs
                 #The conditions are: uneven nr of bad quality warps greater than 3, and the most recent observations is more than $desdiffdt hours old
@@ -2184,7 +2189,9 @@
 	     	#find exposures for this object that have not been fully processed
              	if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+                    print STDERR "desp_diff_queue: exposure with exp_id $this_exp_id for $this_object has warp_id $this_warp_id and quality $this_quality and is therefore not fully processed\n";
              	    $Nbad += 1;
              	}
                 if (($chip_state ne 'full') || ($cam_state ne 'full') ) {
+                    print STDERR "desp_diff_queue: exposure with exp_id $this_exp_id for $this_object has chip state $chip_state and cam state $cam_state and is therefore not fully processed\n";
             	    $Nbad += 1;
                 }
@@ -2241,5 +2248,5 @@
                     print STDERR "desp_diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps } ";
                     if ($#{ $warps} + 1 == 1) {
-                        print STDERR ": I can do no diffs with only one exposure.\n";
+                        print STDERR "desp_diff_queue: I can do no diffs with only one exposure.\n";
                         next;
                     }
@@ -2247,5 +2254,5 @@
                         my $rejected_warp = pop @{ $warps };
                         my $rejected_exp_id = ${ $rejected_warp }[0];
-                        print STDERR ": Rejecting ${rejected_exp_id} to force visit count.\n";
+                        print STDERR "desp_diff_queue: Rejecting ${rejected_exp_id} to force visit count.\n";
                     }
                 }
@@ -2275,9 +2282,9 @@
                     unless (defined($input_warp_id) && defined($template_warp_id) &&
                         ($input_warp_state eq 'full')&&($template_warp_state eq 'full')) {
-                        print STDERR "Desp diff for this $date $target $input_exp_id $template_exp_id not fully processed ($input_warp_state $template_warp_state) ($input_warp_camQuality $template_warp_camQuality)\n";
+                        print STDERR "desp_diff_queue: Desp diff for this $date $target $input_exp_id $template_exp_id not fully processed ($input_warp_state $template_warp_state) ($input_warp_camQuality $template_warp_camQuality)\n";
                         if (($input_warp_camQuality == 4007)||($template_warp_camQuality == 4007)) {
                             # This should now never be reached.
                             # CZW: Trigger backup plan here?  Or simply set up framework?
-                            print STDERR "  ...but this is due to a camera stage astrometry quality\n";
+                            print STDERR "desp_diff_queue: ...but this is due to a camera stage astrometry quality\n";
                             $Npotential--;
                         }
@@ -2287,9 +2294,9 @@
                     if (verify_uniqueness_diff($input_warp_id,$template_warp_id,$date,$target) != 0) {
                         $Nqueued++;
-                        print STDERR "Desp diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
+                        print STDERR "desp_diff_queue: Desp diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
                         next;
                     }
                     else {
-                        print STDERR "Preparing to desperate diff $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
+                        print STDERR "desp_diff_queue: Preparing to desperate diff $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment $template_comment\n";
                     }
            
@@ -2325,5 +2332,5 @@
            
             } else {       
-                print STDERR "desp_diff_queue: There is a possibility for dirty diffs to be made\n";
+                print STDERR "desp_diff_queue: There is a possibility for dirty diffs to be made, but this is currently not implemented\n";
                 #Consider the case of on-the-fly dirty desperate diffs
                 #The conditions are: uneven nr of bad quality warps greater than 3, and the most recent observations is more than $desdiffdt hours old
