Index: trunk/ippTasks/detrend.correct.pro
===================================================================
--- trunk/ippTasks/detrend.correct.pro	(revision 20383)
+++ trunk/ippTasks/detrend.correct.pro	(revision 20384)
@@ -1,22 +1,18 @@
 ## detrend.correct.pro : globals and support macros : -*- sh -*-
 ## this file contains the tasks for running the detrend correction stage
-## these tasks use the books detPendingCorrectedImfile and detPendingCorrectedExp
+## these tasks use the books detPendingCorrectImfile
 
 # test for required global variables
 check.globals
 
-book init detPendingCorrectedImfile
-book init detPendingCorrectedExp
+book init detPendingCorrectImfile
 
 macro detcorr.reset
-  book init detPendingCorrectedImfile
-  book init detPendingCorrectedExp
+  book init detPendingCorrectImfile
 end
 
 macro detcorr.status
-  echo detPendingCorrectedImfile
-  book listbook detPendingCorrectedImfile
-  echo detPendingCorrectedExp
-  book listbook detPendingCorrectedExp
+  echo detPendingCorrectImfile
+  book listbook detPendingCorrectImfile
 end
 
@@ -26,10 +22,4 @@
   end
   task detrend.correct.run
-    active true
-  end
-  task detrend.correctexp.load
-    active true
-  end
-  task detrend.correctexp.run
     active true
   end
@@ -43,19 +33,12 @@
     active false
   end
-  task detrend.correctexp.load
-    active false
-  end
-  task detrend.correctexp.run
-    active false
-  end
 end
 
 
 # these variables will cycle through the known database names
-$detPendingCorrectedImfile_DB = 0
-$detPendingCorrectedExp_DB = 0
+$detPendingCorrectImfile_DB = 0
 
 # select images ready for copy 
-# new entries are added to detPendingCorrectedImfile
+# new entries are added to detPendingCorrectImfile
 # compare the new list with the ones already selected
 task	       detrend.correct.load
@@ -71,15 +54,17 @@
 
   task.exec
-    $run = dettool -tocorrectedimfile
+    $run = dettool -tocorrectimfile
     if ($DB:n == 0)
       option DEFAULT
     else
       # save the DB name for the exit tasks
-      option $DB:$detPendingCorrectedImfile_DB
-      $run = $run -dbname $DB:$detPendingCorrectedImfile_DB
-      $detPendingCorrectedImfile_DB ++
-      if ($detPendingCorrectedImfile_DB >= $DB:n) set detPendingCorrectedImfile_DB = 0
+      option $DB:$detPendingCorrectImfile_DB
+      $run = $run -dbname $DB:$detPendingCorrectImfile_DB
+      $detPendingCorrectImfile_DB ++
+      if ($detPendingCorrectImfile_DB >= $DB:n) set detPendingCorrectImfile_DB = 0
     end
+    echo $run
     add_poll_args run
+    echo $run
     command $run
   end
@@ -88,11 +73,11 @@
   task.exit    0
     # convert 'stdout' to book format
-    ipptool2book stdout detPendingCorrectedImfile -key det_id:exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    ipptool2book stdout detPendingCorrectImfile -key det_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     if ($VERBOSE > 2)
-      book listbook detPendingCorrectedImfile
+      book listbook detPendingCorrectImfile
     end
 
     # delete existing entries in the appropriate pantaskStates
-    process_cleanup detPendingCorrectedImfile
+    process_cleanup detPendingCorrectImfile
   end
 
@@ -115,24 +100,20 @@
 
   task.exec
-    book npages detPendingCorrectedImfile -var N
+    book npages detPendingCorrectImfile -var N
     if ($N == 0) break
     if ($NETWORK == 0) break
     
-    # look for new images in detPendingCorrectedImfile
-    book getpage detPendingCorrectedImfile 0 -var pageName -key pantaskState INIT
+    # look for new images in detPendingCorrectImfile
+    book getpage detPendingCorrectImfile 0 -var pageName -key pantaskState INIT
     if ("$pageName" == "NULL") break
 
-    book setword detPendingCorrectedImfile $pageName pantaskState RUN
-    book getword detPendingCorrectedImfile $pageName det_id    -var DET_ID   
-    book getword detPendingCorrectedImfile $pageName exp_id    -var EXP_ID  
-    book getword detPendingCorrectedImfile $pageName class_id  -var CLASS_ID 
-    book getword detPendingCorrectedImfile $pageName exp_tag   -var EXP_TAG  XXX where does this come from
-    book getword detPendingCorrectedImfile $pageName det_type  -var DET_TYPE  XXX where does this come from
-    book getword detPendingCorrectedImfile $pageName camera    -var CAMERA  XXX where does this come from
-    book getword detPendingCorrectedImfile $pageName uri       -var URI      
-    book getword detPendingCorrectedImfile $pageName corr_id   -var CORR_ID
-    book getword detPendingCorrectedImfile $pageName corr_type -var CORR_TYPE
-    book getword detPendingCorrectedImfile $pageName workdir   -var WORKDIR_TEMPLATE
-    book getword detPendingCorrectedImfile $pageName dbname    -var DBNAME
+    book setword detPendingCorrectImfile $pageName pantaskState RUN
+    book getword detPendingCorrectImfile $pageName det_id    -var DET_ID   
+    book getword detPendingCorrectImfile $pageName class_id  -var CLASS_ID 
+    book getword detPendingCorrectImfile $pageName det_type  -var DET_TYPE
+    book getword detPendingCorrectImfile $pageName camera    -var CAMERA
+    book getword detPendingCorrectImfile $pageName uri       -var URI      
+    book getword detPendingCorrectImfile $pageName workdir   -var WORKDIR_TEMPLATE
+    book getword detPendingCorrectImfile $pageName dbname    -var DBNAME
 
     # specify choice of local or remote host based on camera and chip (class_id)
@@ -143,16 +124,10 @@
 
     ## generate outroot specific to this exposure (& chip)
-    sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
+    sprintf outroot "%s/%s.%s.%s/%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID
 
     stdout $LOGDIR/detcorr.run.log
     stderr $LOGDIR/detcorr.run.log
 
-    $run = detrend_correct_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --outroot $outroot --redirect-output --verbose
-    if ("$WORKDIR" != "NULL")
-      $run = $run --workdir $WORKDIR
-    end
-    if ("$REDUCTION" != "NULL")
-      $run = $run --reduction $REDUCTION
-    end
+    $run = detrend_correct_imfile.pl --det_id $DET_ID --class_id $CLASS_ID --det_type $DET_TYPE --input_uri $URI --camera $CAMERA --outroot $outroot --redirect-output --verbose
     add_standard_args run
 
@@ -169,5 +144,5 @@
   # default exit status
   task.exit    default
-    process_exit detPendingCorrectedImfile $options:0 $JOB_STATUS
+    process_exit detPendingCorrectImfile $options:0 $JOB_STATUS
   end
 
@@ -175,124 +150,6 @@
   task.exit    timeout
     showcommand timeout
-    book setword detPendingCorrectedImfile $options:0 pantaskState TIMEOUT
+    book setword detPendingCorrectImfile $options:0 pantaskState TIMEOUT
  end
 end
 
-# select images ready for copy 
-# new entries are added to detPendingCorrectedExp
-# compare the new list with the ones already selected
-task	       detrend.correctexp.load
-  host         local
-
-  periods      -poll $LOADPOLL
-  periods      -exec $LOADEXEC
-  periods      -timeout 30
-  npending     1
-
-  stdout NULL
-  stderr $LOGDIR/detcorr.exp.load.log
-
-  task.exec
-    $run = dettool -tocorrectedexp
-    if ($DB:n == 0)
-      option DEFAULT
-    else
-      # save the DB name for the exit tasks
-      option $DB:$detPendingCorrectedExp_DB
-      $run = $run -dbname $DB:$detPendingCorrectedExp_DB
-      $detPendingCorrectedExp_DB ++
-      if ($detPendingCorrectedExp_DB >= $DB:n) set detPendingCorrectedExp_DB = 0
-    end
-    add_poll_args run
-    command $run
-  end
-
-  # success
-  task.exit    0
-    # convert 'stdout' to book format
-    ipptool2book stdout detPendingCorrectedExp -key det_id:exp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
-    if ($VERBOSE > 2)
-      book listbook detPendingCorrectedExp
-    end
-
-    # delete existing entries in the appropriate pantaskStates
-    process_cleanup detPendingCorrectedExp
-  end
-
-  # error
-  task.exit    default
-    showcommand failure
-  end
-
-  # operation times out?
-  task.exit    timeout
-    showcommand timeout
-  end
-end
-
-# copy new images, sending job to desired host
-task	       detrend.correctexp.run
-  periods      -poll $RUNPOLL
-  periods      -exec $RUNEXEC
-  periods      -timeout 30
-
-  task.exec
-    book npages detPendingCorrectedExp -var N
-    if ($N == 0) break
-    if ($NETWORK == 0) break
-    
-    # look for new exposures in detPendingCorrectedExp
-    book getpage detPendingCorrectedExp 0 -var pageName -key pantaskState INIT
-    if ("$pageName" == "NULL") break
-
-    book setword detPendingCorrectedExp $pageName pantaskState RUN
-    book getword detPendingCorrectedExp $pageName det_id    -var DET_ID
-    book getword detPendingCorrectedExp $pageName exp_id    -var EXP_ID
-    book getword detPendingCorrectedExp $pageName det_type  -var DET_TYPE
-    book getword detPendingCorrectedExp $pageName camera    -var CAMERA  
-    book getword detPendingCorrectedExp $pageName exp_tag   -var EXP_TAG
-    book getword detPendingCorrectedExp $pageName corr_id   -var CORR_ID
-    book getword detPendingCorrectedExp $pageName corr_type -var CORR_TYPE
-    book getword detPendingCorrectedExp $pageName workdir   -var WORKDIR_TEMPLATE
-    book getword detPendingCorrectedExp $pageName dbname    -var DBNAME
-
-    # specify choice of local or remote host based on camera and chip (class_id)
-    set.host.for.camera $camera FPA
-
-    # set workdir (interpolate host; see camera.pro for examples)
-    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
-
-    ## generate outroot specific to this exposure (& chip)
-    sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
-
-    stdout $LOGDIR/detcorr.exp.run.log
-    stderr $LOGDIR/detcorr.exp.run.log
-
-    $run = detrend_correct_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --redirect-output --verbose
-
-    if ("$WORKDIR" != "NULL")
-      $run = $run --workdir $WORKDIR
-    end
-    add_standard_args run
-
-    # save the pageName for future reference below
-    options $pageName
-
-    # create example job options as a demonstration
-    if ($VERBOSE > 1)
-      echo command $run
-    end
-    command $run
-  end
-
-  # success
-  task.exit    default
-    process_exit detPendingCorrectedExp $options:0 $JOB_STATUS
-  end
-
-  # operation times out?
-  task.exit    timeout
-    showcommand timeout
-    book setword detPendingCorrectedExp $options:0 pantaskState TIMEOUT
-  end
-end
