Index: trunk/ippScripts/scripts/lap_science.pl
===================================================================
--- trunk/ippScripts/scripts/lap_science.pl	(revision 31795)
+++ trunk/ippScripts/scripts/lap_science.pl	(revision 31922)
@@ -29,4 +29,7 @@
 my ( $lap_id );
 my ( $chip_mode, $monitor_mode, $cleanup_mode);
+
+# Global configuration constants that probably should be read from elsewhere.
+my $qstack_threshold = 0.05; # Only make a quickstack if more than 5% of the exposures require it.
 
 GetOptions(
@@ -456,5 +459,5 @@
     my $can_fstack = 0;
     my $total_exposures = 0;
-    my $lonely_exposures = 0;
+    my @lonely_exposures = ();
     foreach my $exposure (@$exposures) {
 	$total_exposures++;
@@ -474,5 +477,6 @@
 	
 	if ($exposure->{private}) { # I've declared this exposure private to this lapRun.
-	    $needs_qstack = 1;
+	    $needs_qstack++;
+	    push @lonely_exposures, $exposure;
 #	    $lonely_exposures++;
 	}
@@ -512,5 +516,5 @@
 	    unless ((defined($exposure->{diffRun_state}))&&
 		    ($exposure->{diffRun_state} eq 'full')) {
-		$needs_qstack = 1;
+		$needs_qstack++;
 		$needs_something_private = 1;
 		if ($companion) {
@@ -518,4 +522,5 @@
 		    $companion->{pairwise} = 0;
 		    &update_this_exposure($companion);
+		    push @lonely_exposures, $companion;
 #		    $lonely_exposures++;
 		}
@@ -569,11 +574,20 @@
 	exit(0);
     }
-    if (($needs_qstack == 1)&&              # Do we need the quick stack?
+    if (($needs_qstack > 0)&&              # Do we need the quick stack?
 	($defined_qstack == 0)&&            # Have we not made it already?
 	($can_qstack == $total_exposures)&& # Are all warps done?
 	($needs_something_remade == 0)      # Do we need to wait for a stolen exposure?
 	) {
-	print "STATUS: Will now queue quickstacks\n";
-	&queue_quickstack($exposures);
+	if ($needs_qstack < $total_exposures * $qstack_threshold) { # Drop any exposures that are requiring the qstack
+	    print "STATUS: Insufficient unpaired exposures to justify quickstack.  Dropping unpaired exposures\n";
+	    foreach $exposure (@lonely_exposures) {
+		$exposure->{data_state} = 'drop';
+		&update_this_exposure($exposure);
+	    }
+	}
+	else {
+	    print "STATUS: Will now queue quickstacks\n";
+	    &queue_quickstack($exposures);
+	}
     }
 
