Index: trunk/ippScripts/scripts/nightly_science.pl
===================================================================
--- trunk/ippScripts/scripts/nightly_science.pl	(revision 30674)
+++ trunk/ippScripts/scripts/nightly_science.pl	(revision 30688)
@@ -1315,5 +1315,4 @@
     my $cam_ref  = $db->selectall_arrayref( $cam_sth );
     my $warp_ref = $db->selectall_arrayref( $warp_sth );
-
     return($#{ $chip_ref } + 1, $#{ $cam_ref } + $#{ $warp_ref } + 2);
 }
@@ -1439,6 +1438,6 @@
 #	$input_sth .= " ORDER BY dateobs ";
 	
-	my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state FROM ";
-	$input_sth .=   " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) ";
+	my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality FROM ";
+	$input_sth .=   " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) ";
 	$input_sth .=   " WHERE chipRun.label = '$label' AND chipRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' ";
 	$input_sth .=   " ORDER BY dateobs ";
@@ -1461,5 +1460,5 @@
 	    }
 	    else {
-		print STDERR ": I should declare an exposure to be faulty.\n";
+		print STDERR ": I should declare an exposure to be qualityy.\n";
 		my @keep_warps = ();
 #		print "@{ $warps }\n";
@@ -1494,10 +1493,17 @@
 	    my $input_warp_state = ${ $input_warp }[4];
 	    my $template_warp_state = ${ $template_warp }[4];
-	    
+
+	    my $input_warp_camQuality = ${ $input_warp }[5];
+	    my $template_warp_camQuality = ${ $template_warp }[5];
+
 	    $Npotential++;
 
 	    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\n";
+		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";
+		if (($input_warp_camQuality == 4007)||($template_warp_camQuality == 4007)) {
+		    print STDERR "  ...but this is due to a camera stage astrometry quality\n";
+		    $Npotential--;
+		}
 		next;
 	    }
