Index: trunk/ippTasks/detrend.resid.pro
===================================================================
--- trunk/ippTasks/detrend.resid.pro	(revision 9506)
+++ trunk/ippTasks/detrend.resid.pro	(revision 10542)
@@ -49,14 +49,16 @@
       queuepop stdout -var line
       list word -split $line
-      $ITER     = $word:0
-      $DET_TYPE = $word:1
-      $DET_ID   = $word:2
-      $EXP_TAG  = $word:3
-      $CLASS_ID = $word:4
-      $URI_IN   = $word:5
-      $CAMERA   = $word:13
+      $DET_ID   = $word:0
+      $ITER     = $word:1
+      $DET_TYPE = $word:2
+      $MODE     = $word:3
+      $EXP_TAG  = $word:4
+      $CLASS_ID = $word:5
+      $URI      = $word:6
+      $DET_URI  = $word:7
+      $CAMERA   = $word:8
       ## must include the detID and iter in the key (if we have two running at the same time...)
       ## Also needed to be in the output file (or path)
-      queuepush DetrendResidImfiles -uniq -key 1:3:4:5 "NEW $ITER $DET_TYPE $DET_ID $EXP_TAG $CLASS_ID $URI_IN $CAMERA"
+      queuepush DetrendResidImfiles -uniq -key 1:2:5:6 "NEW $DET_ID $ITER $DET_TYPE $MODE $EXP_TAG $CLASS_ID $URI $DET_URI $CAMERA"
     end
 
@@ -95,5 +97,5 @@
 
     strpop line state
-    queuepush DetrendResidImfiles -replace -key 1:3:4:5 "RUN $line"
+    queuepush DetrendResidImfiles -replace -key 1:2:5:6 "RUN $line"
 
     ## the DetrendResidImfiles queue contains:
@@ -101,11 +103,13 @@
     ## NOTE: the queue has the STATE prepended 
     list word -split $line
-    $ITER     = $word:0
-    $DET_TYPE = $word:1
-    $DET_ID   = $word:2
-    $EXP_TAG  = $word:3
-    $CLASS_ID = $word:4
-    $URI_IN   = $word:5
-    $CAMERA   = $word:6
+    $DET_ID   = $word:0
+    $ITER     = $word:1
+    $DET_TYPE = $word:2
+    $MODE     = $word:3
+    $EXP_TAG  = $word:4
+    $CLASS_ID = $word:5
+    $URI      = $word:6
+    $DET_URI  = $word:7
+    $CAMERA   = $word:8
 
     $DET_DIR = `dirname $URI_IN`
@@ -127,21 +131,21 @@
     # need to parse the subdir path for the detrend URL
     $DET_URL = $DET_DIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.fits
-    echo command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URL --input_uri $URI_IN
-    command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URL --input_uri $URI_IN
+    echo command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URL --input_uri $URI_IN --camera $CAMERA
+    command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URL --input_uri $URI_IN --camera $CAMERA
   end
 
   # success
   task.exit 0
-    queuepush DetrendResidImfiles -replace -key 1:3:4:5 "DONE $options:0"
-  end
-
-  # default exit status
-  task.exit    default
-    queuepush DetrendResidImfiles -replace -key 1:3:4:5 "FAIL $options:0"
-  end
-
-  # operation times out?
-  task.exit    timeout
-    queuepush DetrendResidImfiles -replace -key 1:3:4:5 "TIMEOUT $options:0"
+    queuepush DetrendResidImfiles -replace -key 1:2:5:6 "DONE $options:0"
+  end
+
+  # default exit status
+  task.exit    default
+    queuepush DetrendResidImfiles -replace -key 1:2:5:6 "FAIL $options:0"
+  end
+
+  # operation times out?
+  task.exit    timeout
+    queuepush DetrendResidImfiles -replace -key 1:2:6:6 "TIMEOUT $options:0"
   end
 end
@@ -176,8 +180,9 @@
       $ITER     = $word:1
       $DET_TYPE = $word:2
-      $EXP_TAG  = $word:3
-      $INCLUDE  = $word:4
-      $CAMERA   = $word:5
-      queuepush DetrendResidExposures -uniq -key 1:2:4 "NEW $DET_ID $ITER $DET_TYPE $EXP_TAG $INCLUDE $CAMERA"
+      $MODE     = $word:3
+      $EXP_TAG  = $word:4
+      $INCLUDE  = $word:5
+      $CAMERA   = $word:6
+      queuepush DetrendResidExposures -uniq -key 1:2:5 "NEW $DET_ID $ITER $DET_TYPE $MODE $EXP_TAG $INCLUDE $CAMERA"
     end
 
@@ -216,5 +221,5 @@
 
     strpop line state
-    queuepush DetrendResidExposures -replace -key 1:2:4 "RUN $line"
+    queuepush DetrendResidExposures -replace -key 1:2:5 "RUN $line"
 
     ## the DetrendResidExposures queue contains:
@@ -225,7 +230,8 @@
     $ITER     = $word:1
     $DET_TYPE = $word:2
-    $EXP_TAG  = $word:3
-    $INCLUDE  = $word:4
-    $CAMERA   = $word:5
+    $MODE     = $word:3
+    $EXP_TAG  = $word:4
+    $INCLUDE  = $word:5
+    $CAMERA   = $word:6
 
     # XXX add $WORKDIR/$LOG_DIR
@@ -240,37 +246,23 @@
     end
 
-    ### XXX artificially reject a few randomly
-    if ($ITER == 0)
-      $drop = (rnd(0) < 0.33)
-    else
-      $drop = ("$INCLUDE" == "F")
-    end
-    ### XXX no artificial rejections
-    $drop = 0
-
     # create example job options as a demonstration
     options "$line"
-    if ($drop) 
-      echo command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --reject
-      command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --reject
-    else 
-      echo command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
-      command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
-    end
+    echo command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
+    command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
   end
 
   # success
   task.exit 0
-    queuepush DetrendResidExposures -replace -key 1:2:4 "DONE $options:0"
-  end
-
-  # default exit status
-  task.exit    default
-    queuepush DetrendResidExposures -replace -key 1:2:4 "FAIL $options:0"
-  end
-
-  # operation times out?
-  task.exit    timeout
-    queuepush DetrendResidExposures -replace -key 1:2:4 "TIMEOUT $options:0"
-  end
-end
+    queuepush DetrendResidExposures -replace -key 1:2:5 "DONE $options:0"
+  end
+
+  # default exit status
+  task.exit    default
+    queuepush DetrendResidExposures -replace -key 1:2:5 "FAIL $options:0"
+  end
+
+  # operation times out?
+  task.exit    timeout
+    queuepush DetrendResidExposures -replace -key 1:2:5 "TIMEOUT $options:0"
+  end
+end
