Index: trunk/ippTasks/simtest.pro
===================================================================
--- trunk/ippTasks/simtest.pro	(revision 19266)
+++ trunk/ippTasks/simtest.pro	(revision 19381)
@@ -1,19 +1,58 @@
 ## simtest.pro : automatic full-suite simulated IPP test : -*- sh -*-
 
+## there are four features which define a simtest run:
+## the camera : any camera can be used, the sim... cameras are defined to be quick tests
+## the sequence : this file defines the set of observations generated
+## the auto : the automation file defines the sequence of analysis performed
+## the recipe : the ppsim recipe defines the features which are included in the generate data
+
+## these are not completely independent: a certain sequence may be
+## required to yield a sensible result for a specific auto, and a
+## specific recipe may also be needed
+
+if ($?PPSIM_RECIPE == 0) 
+  $PPSIM_RECIPE = default
+end
+if ($?SIMTEST_CAMERA == 0)
+  $SIMTEST_CAMERA = SIMTEST
+end
+if ($?SIMTEST_SEQUENCE == 0)
+  $SIMTEST_SEQUENCE = simtest.basic.config
+end
+if ($?SIMTEST_AUTO == 0)
+  $SIMTEST_AUTO = simtest.basic.auto
+end
+if ($?SIMTEST_THREADS == 0) 
+  $SIMTEST_THREADS = 0
+end
+
 macro simtest
-  if ($0 != 6)
-    echo "USAGE: simtest (testroot) (dbname) (hostname) (threads) (init)"
-    echo " if (init) == 0, just run the analysis tasks"
-    echo " if (init) == 1, (re)create the database and (re)inject the images"
-    echo " if (init) == 2, restart completely from scratch"
+  if ($0 != 4)
+    echo "USAGE: simtest (dbname) (hostname) (init)"
+    echo " if (init) == run    : just run the analysis tasks"
+    echo " if (init) == inject : (re)create the database and (re)inject the images"
+    echo " if (init) == new    : restart completely from scratch"
+    echo ""
+    echo "there are additional options which may be specified by setting the following variable names:" 
+    echo "  PPSIM_RECIPE     : define the recipe to use when generating the fake data"
+    echo "  SIMTEST_CAMERA   : define an alternate camera (otherwise uses entry in sequence file)"
+    echo "  SIMTEST_SEQUENCE : define the set of observations generated (simtest.basic.config)"
+    echo "  SIMTEST_AUTO     : define the analysis steps to perform (simtest.auto)"
+    echo "  SIMTEST_THREADS  : set the number of threads for the processing node (0)"
     break
   end
 
-  $testroot = $1
-  $dbname = $2
-  $hostname = $3
-  $threads = $4
+  $dbname = $1
+  $hostname = $2
+  $init = $3
+  if (("$init" != "run") && ("$init" != "inject") && ("$init" != "new"))
+    echo "USAGE: simtest (dbname) (hostname) (init)"
+    echo " if (init) == run    : just run the analysis tasks"
+    echo " if (init) == inject : (re)create the database and (re)inject the images"
+    echo " if (init) == new    : restart completely from scratch"
+    break
+  end    
  
-  if ($5 > 0)
+  if (("$init" == "new") || ("$init" == "new"))  
     # XXX this will fail and exit the script if the db does not exist or is old...
     exec pxadmin -delete -dbname $dbname
@@ -22,12 +61,18 @@
     exec pxadmin -create -dbname $dbname
 
-    if ($5 == 2)
+    if ("$init" == "new")
       # the labels "wait" and "proc" are special names used in automate.pro
-      exec ppSimSequence $MODULES:0/$testroot.config $testroot.mkimages $testroot.inject -path raw -workdir work -dbname $dbname -label wait -dvodb DVO -tess_id TESS 
-      # not ready for this yet
-      # -ppsim_recipe FLATCORR
+    
+      $ppsim = "ppSimSequence $MODULES:0/$SIMTEST_SEQUENCE simtest.mkimages simtest.inject -path raw -workdir work -dbname $dbname -label wait -dvodb DVO -tess_id TESS"
+      if ("$PPSIM_RECIPE" != "default") 
+         $ppsim = $ppsim -ppsim_recipe $PPSIM_RECIPE
+      end
+      $ppsim = $ppsim -camera $SIMTEST_CAMERA
 
-      exec source $testroot.mkimages
+      exec $ppsim
 
+      exec source simtest.mkimages
+
+      ## XXX this will need to be optional as well 
       file TESS/Images.dat found
       if ($found == 0)
@@ -37,5 +82,5 @@
 
     exec chiptool -dbname $dbname -block -label wait
-    exec source $testroot.inject
+    exec source simtest.inject
   end
 
@@ -45,10 +90,26 @@
   module.tasks
 
-  controller host add $hostname
+  if ($SIMTEST_THREADS == 0) 
+    controller host add $hostname
+  else
+    controller host add $hostname -threads $SIMTEST_THREADS
+  end
+
   add.database $dbname
 
-  automate.load simtest.auto $dbname
+  automate.load $SIMTEST_AUTO $SIMTEST_CAMERA $dbname
   run
 end
 
 # XXX add a test function to pxadmin to check for db existence
+
+## currently defined options for sequence, etc:
+
+# sequence: simtest.basic.config, simtest.flatcorr.config
+# auto: simtest.basic.auto, simtest.flatcorr.auto
+
+macro simtest.setup.flatcorr
+  $PPSIM_RECIPE = FLATCORR
+  $SIMTEST_SEQUENCE = simtest.flatcorr.config
+  $SIMTEST_AUTO = simtest.flatcorr.auto
+end
