Index: trunk/ippScripts/scripts/lap_science.pl
===================================================================
--- trunk/ippScripts/scripts/lap_science.pl	(revision 31498)
+++ trunk/ippScripts/scripts/lap_science.pl	(revision 31511)
@@ -474,26 +474,31 @@
 	    $exposure = remake_this_exposure($exposure);
 	}
-	if ($exposure->{cam_quality}) {
-	    $needs_qstack = 1;
-	    $needs_something_private = 1;
-	    if ($companion) {
-		$companion->{private} = 1;
-		$companion->{pairwise} = 0;
-		&update_this_exposure($companion);
+	# Do quality checks here
+	if ((($exposure->{chipRun_state} eq 'full')&&($exposure->{chip_bad_quality} / $exposure->{chip_component_count} > 0.05)) ||
+	    (($exposure->{camRun_state} eq 'full')&&($exposure->{cam_bad_quality} / $exposure->{cam_component_count} > 0)) ||
+	    (($exposure->{warpRun_state} eq 'full')&&($exposure->{warp_bad_quality} / $exposure->{warp_component_count} > 0.2)) ||
+	    (($exposure->{diffRun_state} eq 'full')&&($exposure->{diff_bad_quality} / $exposure->{diff_component_count} > 0.5)))  {
+	    printf( "QUALITY: $exposure->{exp_id} has bad quality fractions: chip: %d/%d cam: %d/%d warp: %d/%d diff: %d/%d\n",
+		    $exposure->{chip_bad_quality} , $exposure->{chip_component_count},
+		    $exposure->{cam_bad_quality} , $exposure->{cam_component_count},
+		    $exposure->{warp_bad_quality} , $exposure->{warp_component_count},
+		    $exposure->{diff_bad_quality} , $exposure->{diff_component_count});
+
+	    unless ($exposure->{diffRun_state} eq 'full') {
+		$needs_qstack = 1;
+		$needs_something_private = 1;
+		if ($companion) {
+		    $companion->{private} = 1;
+		    $companion->{pairwise} = 0;
+		    &update_this_exposure($companion);
+		}
+		$exposure->{private} = 1;
+		$exposure->{pairwise} = 0;
 	    }
-	    $exposure->{private} = 1;
-	    $exposure->{pairwise} = 0;
 	    $exposure->{data_state} = 'drop';
 	    &update_this_exposure($exposure);
 
 	}
-# 	if ($companion) { # Validate that there are no problems with the companion exposure
-# 	    if ($companion->{cam_quality}) { # Maybe other things here?
-# 		$exposure->{private} = 1;
-# 		$exposure->{data_state} = 'drop';
-# 		&update_this_exposure($exposure);
-# 		$needs_qstack = 1;
-# 	    }
-# 	}
+
 	if  ($exposure->{data_state} eq 'drop') { # This exposure is impossible, so fudge the counts so we get through.
 	    $can_qstack ++;
