Index: trunk/tools/run.relastro
===================================================================
--- trunk/tools/run.relastro	(revision 34869)
+++ trunk/tools/run.relastro	(revision 34870)
@@ -1,52 +1,25 @@
 #!/bin/csh -f
 
-set catdir_3pi = /data/ipp064.0/eugene/3pi.20111229/catdir.3pi
-
-# run update-objects on the whole sky
-if (1) then
-  # for a test, only run -pm
-  # set options = "-update-objects -pmpar"
-  set options = "-update-objects -pm"
-  set options = "$options -D PM_DT_MIN 1.0"
-  set options = "$options -D PAR_FACTOR_MIN 0.25"
-  set options = "$options -update"
-  set options = "$options -parallel"
-  set options = "$options -v"
-
-  set region = "-region 0 360 -60 90"
-  
-  # run relastro -update-objects
-  echo -n "--- starting relastro $catdir_3pi ---"; date
-  echo relastro $options $region -D CATDIR $catdir_3pi
-  relastro $options $region -D CATDIR $catdir_3pi
+if ($#argv != 5) then 
+  echo "USAGE: run.relastro (catdir) (Rmin) (Rmax) (Dmin) (Dmax)"
+  exit 2
 endif
 
-# run update-offsets for 300-335
-if (0) then
-  set options = "-update-offsets"
-  set options = "$options -D RELASTRO_SRC_MEAS_TOOFEW 1"
-  set options = "$options -D RELASTRO_SIGMA_LIM 0.1"
-  set options = "$options -nloop 6"
-  set options = "$options -basic-image-search"
-  set options = "$options -reset"
-  set options = "$options -update"
-  set options = "$options -parallel"
-  set options = "$options -max-density 3000"
-  set options = "$options -threads 4"
-  set options = "$options -v"
+set REALRUN = 0
 
-  set ra_min = 300
-  set ra_max = $ra_min
-  @ ra_max += 35
-  set region = "-region $ra_min $ra_max -60 60"
-  
-  # run relastro -update-chips
-  echo -n "--- starting relastro $catdir_3pi ---"; date
-  echo relastro $options $region -D CATDIR $catdir_3pi
-  relastro $options $region -D CATDIR $catdir_3pi
-endif
+set  catdir = $argv[1]
+set  ra_min = $argv[2]
+set  ra_max = $argv[3]
+set dec_min = $argv[4]
+set dec_max = $argv[5]
 
+alias run.relastro \
+  'echo -n "--- starting relastro $catdir --- "; date; \
+   echo          relastro $options $region -D CATDIR $catdir; \
+   if ($REALRUN) relastro $options $region -D CATDIR $catdir'
+
+# -update-chips : determine improved astrometry calibrations
 # try 1000 meas per deg^2, but if memory if available, go to more
-if (0) then
+if (1) then
   set options = "-update-chips"
   set options = "$options -D RELASTRO_SRC_MEAS_TOOFEW 1"
@@ -56,38 +29,39 @@
   set options = "$options -reset"
   set options = "$options -update"
-  set options = "$options -parallel"
   set options = "$options -max-density 3000"
   set options = "$options -threads 4"
   set options = "$options -v"
 
-  # set ra_min = 0
-  # set ra_min = 150
-  set ra_min = 300
-  while ($ra_min < 360) 
-    set ra_max = $ra_min
-    @ ra_max += 35
-    set region = "-region $ra_min $ra_max -60 60"
-  
-    # test region (SDSS)
-    # set region = "-region 120 140 0 20"
-    # set region = "-region 180 240 10 50"
+  # enable parallel operations for parallel databases
+  # set options = "$options -parallel"
 
-    # run relastro -update-chips
-    echo -n "--- starting relastro $catdir_3pi ---"; date
-    echo relastro $options $region -D CATDIR $catdir_3pi
-    relastro $options $region -D CATDIR $catdir_3pi
-
-    @ ra_min += 30
-    # exit
-  end
-
-  # pole region 
-  set region = "-region 0 360 55 90"
-
-  # run relastro -update-chips
-  echo -n "--- starting relastro $catdir_3pi ---"; date
-  echo relastro $options $region -D CATDIR $catdir_3pi
-  relastro $options $region -D CATDIR $catdir_3pi
+  set region = "-region $ra_min $ra_max $dec_min $dec_max"
+  run.relastro
+  if ($status) then
+    echo "ERROR : failure running relastro"
+    echo -n "--- done with relastro --- "; date
+    exit 1
+  endif
 endif
 
-echo -n "--- done with relastro ---"; date
+# -update-objects : determine improved positions, including parallax and proper motions
+if (1) then
+  set options = "-update-objects -pmpar"
+  set options = "$options -D PM_DT_MIN 1.0"
+  set options = "$options -D PAR_FACTOR_MIN 0.25"
+  set options = "$options -update"
+  set options = "$options -v"
+
+  # enable parallel operations for parallel databases
+  # set options = "$options -parallel"
+
+  set region = "-region $ra_min $ra_max $dec_min $dec_max"
+  run.relastro
+  if ($status) then
+    echo "ERROR : failure running relastro"
+    echo -n "--- done with relastro --- "; date
+    exit 1
+  endif
+endif
+
+echo -n "--- done with relastro --- "; date
