Index: trunk/ippScripts/scripts/nightly_science.pl
===================================================================
--- trunk/ippScripts/scripts/nightly_science.pl	(revision 42316)
+++ trunk/ippScripts/scripts/nightly_science.pl	(revision 42341)
@@ -1557,8 +1557,7 @@
         my $this_object = shift @{ $object_row };       
         my $this_chunk = shift @{ $object_row };
-        my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,chipRun.state,camRun.state FROM ";
+        my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,camProcessedExp.fwhm_major,chipRun.state,camRun.state 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 .=   " AND camProcessedExp.fwhm_major <= $maxFWHM ";
         $input_sth .=   " AND substr(rawExp.comment, 1, position(' ' in rawExp.comment)) = '$this_chunk' ORDER BY rawExp.comment,dateobs ";
 
@@ -1574,6 +1573,7 @@
             my $this_state   = ${ $this_warp }[4];
             my $this_warp_id  = ${ $this_warp }[1];
-            my $chip_state   = ${ $this_warp }[6];
-            my $cam_state   = ${ $this_warp }[7];
+            my $this_fwhm   = ${ $this_warp }[6];
+            my $chip_state   = ${ $this_warp }[7];
+            my $cam_state   = ${ $this_warp }[8];
 	    
 	    #find exposures for this object that have not been fully processed
@@ -1585,6 +1585,6 @@
             }
 
-            if (($this_quality != 0) || ($this_state eq 'drop') ) {
-                print STDERR "diff_queue: excluding $this_exp_id for $this_object due to non-zero cam.quality $this_quality or state $this_state\n";
+            if (($this_quality != 0) || ($this_state eq 'drop') || ($this_fwhm > $maxFWHM)) {
+                print STDERR "diff_queue: excluding $this_exp_id for $this_object due to non-zero cam.quality $this_quality or state $this_state or FWHM $this_fwhm\n";
             }
             else {
@@ -1769,5 +1769,5 @@
             my $this_chunk = shift @{ $object_row };
        
-            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,substr(comment, 1, position(' ' in comment)),camProcessedExp.fwhm_major,chipRun.state,camRun.state FROM ";
+            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,camProcessedExp.fwhm_major,chipRun.state,camRun.state 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' ";
@@ -1786,8 +1786,8 @@
                 my $this_quality = ${ $this_warp }[5];
                 my $this_state   = ${ $this_warp }[4];
-                my $this_fwhm   = ${ $this_warp }[7];
                 my $this_warp_id  = ${ $this_warp }[1];
-                my $chip_state   = ${ $this_warp }[8];
-                my $cam_state   = ${ $this_warp }[9];
+                my $this_fwhm   = ${ $this_warp }[6];
+                my $chip_state   = ${ $this_warp }[7];
+                my $cam_state   = ${ $this_warp }[8];
 
 	        #find exposures for this object that have not been fully processed
@@ -2160,5 +2160,5 @@
             my $this_chunk = shift @{ $object_row };
        
-            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,substr(comment, 1, position(' ' in comment)),camProcessedExp.fwhm_major,chipRun.state,camRun.state FROM ";
+            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,camProcessedExp.fwhm_major,chipRun.state,camRun.state 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' ";
@@ -2177,8 +2177,8 @@
                 my $this_quality = ${ $this_warp }[5];
                 my $this_state   = ${ $this_warp }[4];
-                my $this_fwhm    = ${ $this_warp }[7];
                 my $this_warp_id  = ${ $this_warp }[1];
-                my $chip_state   = ${ $this_warp }[8];
-                my $cam_state   = ${ $this_warp }[9];
+                my $this_fwhm    = ${ $this_warp }[6];
+                my $chip_state   = ${ $this_warp }[7];
+                my $cam_state   = ${ $this_warp }[8];
 
 	     	#find exposures for this object that have not been fully processed
