Index: trunk/tools/dvodb_calib/gene.run.relastro
===================================================================
--- trunk/tools/dvodb_calib/gene.run.relastro	(revision 35584)
+++ trunk/tools/dvodb_calib/gene.run.relastro	(revision 35584)
@@ -0,0 +1,86 @@
+#!/bin/csh -f
+
+set catdir_3pi = /data/ipp064.0/eugene/3pi.20111229/catdir.20111229
+set REALRUN = 1
+
+alias run.relastro \
+  'echo -n "--- starting relastro $catdir_3pi ---"; date; \
+   echo          relastro $options $region -D CATDIR $catdir_3pi; \
+   if ($REALRUN) relastro $options $region -D CATDIR $catdir_3pi'
+
+## NOTE (2012.09.12, pt 1) : I previously ran relastro including all
+## photcodes.  For reasons I don't yet understand, the SCO data is
+## really messed up (bad dR,dD values), and messed up the mean
+## positions for lots of objects.  I am re-running update-objects with
+## only gpc1 and 2MASS data, and I will figure out how to fix SCO
+## later.
+
+## NOTE (2012.09.12, pt 2) : I used the default statmode previously:
+## this is bad since it results in different rejections and thus
+## inconsistent ChiSq values for ChiSqPos and ChiSqPM.  In this
+## re-run, explicitly used the weighted version
+
+# 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 -statmode WTMEAN"
+  set options = "$options +photcode g,r,i,z,y,J,H,K"
+  set options = "$options -update"
+  set options = "$options -parallel"
+  set options = "$options -reset"
+  set options = "$options -v"
+
+  # set region = "-region 180 190 30 40"
+  set region = "-region 0 360 -60 90"
+  
+  # run relastro -update-objects
+  run.relastro
+endif
+
+# try 2000 meas per deg^2, but if memory if available, go to more
+if (0) then
+  set options = "-update-chips"
+  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 2000"
+  set options = "$options -threads 4"
+  set options = "$options -v"
+
+  # run relastro -update-chips
+  set ra_min = 0
+  while ($ra_min < 360) 
+    set ra_max = $ra_min
+    @ ra_max += 35
+  
+    if (($ra_min == 240) || ($ra_min == 270)) then 
+      set region = "-region $ra_min $ra_max -60 0"
+      run.relastro 
+
+      set region = "-region $ra_min $ra_max -5 60"
+      run.relastro
+
+      @ ra_min += 30
+      continue
+    endif
+
+    set region = "-region $ra_min $ra_max -60 60"
+    run.relastro
+
+    @ ra_min += 30
+  end
+
+  # pole region 
+  set region = "-region 0 360 55 90"
+  run.relastro
+endif
+
+echo -n "--- done with relastro ---"; date
Index: trunk/tools/dvodb_calib/gene.run.relastro.part1
===================================================================
--- trunk/tools/dvodb_calib/gene.run.relastro.part1	(revision 35584)
+++ trunk/tools/dvodb_calib/gene.run.relastro.part1	(revision 35584)
@@ -0,0 +1,84 @@
+#!/bin/csh -f
+if ($#argv != 1) then 
+  echo "USAGE: run.relastro.part1 (catdir) "
+  exit 2
+endif
+
+set REALRUN = 1
+
+set  catdir_3pi = $argv[1]
+
+
+alias run.relastro \
+  'echo -n "--- starting relastro $catdir_3pi ---"; date; \
+   echo          relastro $options $region -D CATDIR $catdir_3pi; \
+   if ($REALRUN) relastro $options $region -D CATDIR $catdir_3pi'
+
+## NOTE (2012.09.12, pt 1) : I previously ran relastro including all
+## photcodes.  For reasons I don't yet understand, the SCO data is
+## really messed up (bad dR,dD values), and messed up the mean
+## positions for lots of objects.  I am re-running update-objects with
+## only gpc1 and 2MASS data, and I will figure out how to fix SCO
+## later.
+
+## NOTE (2012.09.12, pt 2) : I used the default statmode previously:
+## this is bad since it results in different rejections and thus
+## inconsistent ChiSq values for ChiSqPos and ChiSqPM.  In this
+## re-run, explicitly used the weighted version
+
+# run update-objects on the whole sky
+
+# try 2000 meas per deg^2, but if memory if available, go to more
+if (1) then
+  set options = "-update-chips"
+  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 2000"
+  set options = "$options -threads 4"
+  set options = "$options -v"
+
+  # run relastro -update-chips
+  set ra_min = 0
+  while ($ra_min < 360) 
+    set ra_max = $ra_min
+    @ ra_max += 35
+  
+    if (($ra_min == 240) || ($ra_min == 270)) then 
+      set region = "-region $ra_min $ra_max -60 0"
+      run.relastro 
+      if ($status) then
+         echo "ERROR : failure running relastro region $ra_min $ra_max -60 0 "
+	 echo -n "--- done with relastro --- "; date
+      endif
+
+      set region = "-region $ra_min $ra_max -5 90"
+      run.relastro
+      if ($status) then
+	echo "ERROR : failure running relastro region $ra_min $ra_max -5 90"
+	echo -n "--- done with relastro --- "; date
+	
+      endif
+
+      @ ra_min += 30
+      continue
+    endif
+
+    set region = "-region $ra_min $ra_max -60 90"
+    run.relastro
+    if ($status) then
+	echo "ERROR : failure running relastro region $ra_min $ra_max -60 90 "
+	echo -n "--- done with relastro --- "; date
+	
+    endif
+
+    @ ra_min += 30
+  end
+
+endif
+
+echo -n "--- done with relastro ---"; date
Index: trunk/tools/dvodb_calib/gene.run.relastro.part1.
===================================================================
--- trunk/tools/dvodb_calib/gene.run.relastro.part1.	(revision 35584)
+++ trunk/tools/dvodb_calib/gene.run.relastro.part1.	(revision 35584)
@@ -0,0 +1,86 @@
+#!/bin/csh -f
+
+set catdir_3pi = /data/ipp064.0/eugene/3pi.20111229/catdir.20111229
+set REALRUN = 1
+
+alias run.relastro \
+  'echo -n "--- starting relastro $catdir_3pi ---"; date; \
+   echo          relastro $options $region -D CATDIR $catdir_3pi; \
+   if ($REALRUN) relastro $options $region -D CATDIR $catdir_3pi'
+
+## NOTE (2012.09.12, pt 1) : I previously ran relastro including all
+## photcodes.  For reasons I don't yet understand, the SCO data is
+## really messed up (bad dR,dD values), and messed up the mean
+## positions for lots of objects.  I am re-running update-objects with
+## only gpc1 and 2MASS data, and I will figure out how to fix SCO
+## later.
+
+## NOTE (2012.09.12, pt 2) : I used the default statmode previously:
+## this is bad since it results in different rejections and thus
+## inconsistent ChiSq values for ChiSqPos and ChiSqPM.  In this
+## re-run, explicitly used the weighted version
+
+# 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 -statmode WTMEAN"
+  set options = "$options +photcode g,r,i,z,y,J,H,K"
+  set options = "$options -update"
+  set options = "$options -parallel"
+  set options = "$options -reset"
+  set options = "$options -v"
+
+  # set region = "-region 180 190 30 40"
+  set region = "-region 0 360 -60 90"
+  
+  # run relastro -update-objects
+  run.relastro
+endif
+
+# try 2000 meas per deg^2, but if memory if available, go to more
+if (0) then
+  set options = "-update-chips"
+  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 2000"
+  set options = "$options -threads 4"
+  set options = "$options -v"
+
+  # run relastro -update-chips
+  set ra_min = 0
+  while ($ra_min < 360) 
+    set ra_max = $ra_min
+    @ ra_max += 35
+  
+    if (($ra_min == 240) || ($ra_min == 270)) then 
+      set region = "-region $ra_min $ra_max -60 0"
+      run.relastro 
+
+      set region = "-region $ra_min $ra_max -5 60"
+      run.relastro
+
+      @ ra_min += 30
+      continue
+    endif
+
+    set region = "-region $ra_min $ra_max -60 60"
+    run.relastro
+
+    @ ra_min += 30
+  end
+
+  # pole region 
+  set region = "-region 0 360 55 90"
+  run.relastro
+endif
+
+echo -n "--- done with relastro ---"; date
Index: trunk/tools/dvodb_calib/gene.run.relastro.part2
===================================================================
--- trunk/tools/dvodb_calib/gene.run.relastro.part2	(revision 35584)
+++ trunk/tools/dvodb_calib/gene.run.relastro.part2	(revision 35584)
@@ -0,0 +1,57 @@
+#!/bin/csh -f
+
+if ($#argv != 1) then 
+  echo "USAGE: run.relastro (catdir) "
+  exit 2
+endif
+
+set REALRUN = 1
+
+set catdir_3pi = $argv[1]
+
+alias run.relastro \
+  'echo -n "--- starting relastro $catdir_3pi ---"; date; \
+   echo          relastro $options $region -D CATDIR $catdir_3pi; \
+   if ($REALRUN) relastro $options $region -D CATDIR $catdir_3pi'
+
+## NOTE (2012.09.12, pt 1) : I previously ran relastro including all
+## photcodes.  For reasons I don't yet understand, the SCO data is
+## really messed up (bad dR,dD values), and messed up the mean
+## positions for lots of objects.  I am re-running update-objects with
+## only gpc1 and 2MASS data, and I will figure out how to fix SCO
+## later.
+
+## NOTE (2012.09.12, pt 2) : I used the default statmode previously:
+## this is bad since it results in different rejections and thus
+## inconsistent ChiSq values for ChiSqPos and ChiSqPM.  In this
+## re-run, explicitly used the weighted version
+
+# 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 -statmode WTMEAN"
+  set options = "$options +photcode g,r,i,z,y,J,H,K"
+  set options = "$options -update"
+  set options = "$options -parallel"
+  set options = "$options -reset"
+  set options = "$options -v"
+
+  # set region = "-region 180 190 30 40"
+  set region = "-region 0 360 -60 90"
+  
+  # run relastro -update-objects
+  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
Index: trunk/tools/dvodb_calib/gene.run.relphot
===================================================================
--- trunk/tools/dvodb_calib/gene.run.relphot	(revision 35584)
+++ trunk/tools/dvodb_calib/gene.run.relphot	(revision 35584)
@@ -0,0 +1,134 @@
+#!/bin/csh -f
+if ($#argv != 1) then 
+  echo "USAGE: run.relphot (catdir)"
+  exit 2
+endif
+
+set REALRUN = 1
+
+set catdir_3pi = $argv[1]
+
+alias run.relphot \
+  'echo -n "--- starting relphot $catdir_3pi ---"; date; \
+   echo          relphot $options $region -D CATDIR $catdir_3pi; \
+   if ($REALRUN) relphot $options $region -D CATDIR $catdir_3pi'
+
+# try 2000 meas per deg^2
+if (0) then
+  set filters = "g,r,i,z,y"
+
+  set options = "-imfreeze -mosaic"
+  set options = "$options -D MAG_LIM 32.0"
+  set options = "$options -D SIGMA_LIM 0.1"
+  set options = "$options -D STAR_TOOFEW 1"
+  set options = "$options -D STAR_CHISQ 20.0"
+  set options = "$options -D IMAGE_OFFSET 2.0"
+  set options = "$options -D CAMERA gpc1"
+  set options = "$options -nloop 25"
+  set options = "$options -basic-image-search"
+  set options = "$options -update"
+  set options = "$options -reset"
+  set options = "$options -threads 4"
+  set options = "$options -parallel"
+  set options = "$options -statmode WT_MEAN"
+  set options = "$options -max-density 2000"
+
+  ## note the boundary tree location is hard-wired
+  set options = "$options -boundary-tree ~ippdvo/RINGS.V3.tree.v2.fits"
+
+  set options = "$options $filters"
+
+  # set options = "$options -update-catformat PS1_V3"
+
+  # loop over RA bins, splitting into south and north sections
+  set ra_min = 0
+  while ($ra_min < 360) 
+    set ra_max = $ra_min
+    @ ra_max += 35
+
+    # splitting the sky for all slices
+    # if (($ra_min == 240) || ($ra_min == 270)) then 
+
+    # south half
+    set region = "-region $ra_min $ra_max -60 0"
+    run.relphot
+    if ($status) then
+    	echo "ERROR : failure running relphot $ra_min $ra_max -60 0"
+    	echo -n "--- done with relphot --- "; date
+    endif
+
+    # north half
+    set region = "-region $ra_min $ra_max -5 90"
+    run.relphot
+    if ($status) then
+    	echo "ERROR : failure running relphot $ra_min $ra_max -5 90"
+    	echo -n "--- done with relphot --- "; date	
+    endif
+
+    @ ra_min += 30
+    continue
+  end
+endif
+
+## this block is used to set the mean mags in the assumption that the images are calibrated
+if (1) then
+  set filters = "g,r,i,z,y"
+
+  set options = "-imfreeze -mosaic"
+  set options = "$options -D MAG_LIM 32.0"
+  set options = "$options -D SIGMA_LIM 0.1"
+  set options = "$options -D STAR_TOOFEW 1"
+  set options = "$options -D STAR_CHISQ 20.0"
+  set options = "$options -D IMAGE_OFFSET 2.0"
+  set options = "$options -D CAMERA gpc1"
+  set options = "$options -basic-image-search"
+  set options = "$options -update"
+  set options = "$options -threads 4"
+  set options = "$options -parallel"
+  set options = "$options -statmode WT_MEAN"
+
+  ## note the boundary tree location is hard-wired
+  set options = "$options -boundary-tree ~ippdvo/RINGS.V3.tree.v2.fits"
+  set options = "$options -nloop 0"
+
+  set options = "$options $filters"
+
+  # loop over RA bins, splitting into south and north sections
+  set ra_min = 0
+  set ra_max = 360
+  set dec_min = -90
+  set dec_max = +90
+
+  set region = "-region $ra_min $ra_max $dec_min $dec_max"
+  run.relphot
+  if ($status) then
+    echo "ERROR : failure running relphot $ra_min $ra_max $dec_min $dec_max"
+    echo -n "--- done with relphot --- "; date
+  endif
+endif
+
+echo -n "--- done with relphot ---"; date
+
+## Note from Eddie re overall zero point
+## I compare to each of JT's 8 absolutely calibrated fields.  I compute
+## for each field the best zero point bringing my and his data into
+## agreement.  I report the mean and standard deviations of those zero
+## points over the eight fields.  The sign of the mean is such that mean
+## = < ubercal - JT >, so that these values should be subtracted from the
+## noref2.fits zero points in order to absolutely calibrate them.
+## 
+## filter g: mean = -0.013, sigma =  0.013
+## filter r: mean =  0.012, sigma =  0.007
+## filter i: mean =  0.001, sigma =  0.006
+## filter z: mean = -0.016, sigma =  0.007
+## filter y: mean = -0.021, sigma =  0.010
+## 
+## I think we're going to be adding a hundredth uncertainty in quadrature
+## with everything else getting this right.  John trusts his MD09 data
+## most; that gives results different from what I've given here by about
+## -0.01 in all of the bands.  The choice of whether to average over the
+## 8 fields or just use MD09 depends on whether you believe it's an
+## absolute calibration or relative calibration problem; I don't know.
+## Since the ~1 hundredth scatter is comparable with what we think the
+## uncertainty in ubercal is, I'm recommending using the values above,
+## averaged over the 8 fields.
Index: trunk/tools/dvodb_calib/run.addstar.resort
===================================================================
--- trunk/tools/dvodb_calib/run.addstar.resort	(revision 35584)
+++ trunk/tools/dvodb_calib/run.addstar.resort	(revision 35584)
@@ -0,0 +1,35 @@
+#!/bin/csh -f
+
+if ($#argv != 1) then 
+  echo "USAGE: run.addstar.resort (catdir)"
+  exit 2
+endif
+
+set REALRUN = 1
+
+set  catdir = $argv[1]
+
+
+alias run.addstar \
+  'echo -n "--- starting addstar -resort $catdir --- "; date; \
+   echo          addstar -resort $options -D CATDIR $catdir ; \
+   if ($REALRUN) addstar -resort $options -D CATDIR $catdir'
+
+set options = ""
+set options = "$options -D CAMERA GPC1 "
+
+# activate parallel mode when catdir is parallel
+set options = "$options -parallel"
+
+run.addstar
+if ($status) then
+  echo "failed addstar -resort"
+  echo -n "--- done with addstar -resort ---"; date
+    
+  exit 1
+endif
+echo -n "--- done with addstar -resort ---"; date
+exit 0
+
+
+
Index: trunk/tools/dvodb_calib/run.relastro.part1
===================================================================
--- trunk/tools/dvodb_calib/run.relastro.part1	(revision 35584)
+++ trunk/tools/dvodb_calib/run.relastro.part1	(revision 35584)
@@ -0,0 +1,47 @@
+#!/bin/csh -f
+
+if ($#argv != 5) then 
+  echo "USAGE: run.relastro (catdir) (Rmin) (Rmax) (Dmin) (Dmax)"
+  exit 2
+endif
+
+set REALRUN = 1
+
+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 (1) then
+  set options = "-update-chips"
+  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 -max-density 3000"
+  set options = "$options -threads 4"
+  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
Index: trunk/tools/dvodb_calib/run.relastro.part2
===================================================================
--- trunk/tools/dvodb_calib/run.relastro.part2	(revision 35584)
+++ trunk/tools/dvodb_calib/run.relastro.part2	(revision 35584)
@@ -0,0 +1,44 @@
+#!/bin/csh -f
+
+if ($#argv != 5) then 
+  echo "USAGE: run.relastro (catdir) (Rmin) (Rmax) (Dmin) (Dmax)"
+  exit 2
+endif
+
+set REALRUN = 1
+
+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
+
+# -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
Index: trunk/tools/dvodb_calib/run.relphot
===================================================================
--- trunk/tools/dvodb_calib/run.relphot	(revision 35584)
+++ trunk/tools/dvodb_calib/run.relphot	(revision 35584)
@@ -0,0 +1,98 @@
+#!/bin/csh -f
+
+if ($#argv != 5) then 
+  echo "USAGE: run.relphot (catdir) (Rmin) (Rmax) (Dmin) (Dmax)"
+  exit 2
+endif
+
+set REALRUN = 1
+
+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.relphot \
+  'echo -n "--- starting relphot $catdir --- "; date; \
+   echo          relphot $options $region -D CATDIR $catdir; \
+   if ($REALRUN) relphot $options $region -D CATDIR $catdir'
+
+## this block is used to calibrate the images and set the mean mags
+# try 2000 meas per deg^2
+if (0) then
+  set filters = "g,r,i,z,y"
+
+  set options = "$filters -imfreeze -mosaic"
+  set options = "$options -D MAG_LIM 32.0"
+  set options = "$options -D SIGMA_LIM 0.1"
+  set options = "$options -D STAR_TOOFEW 1"
+  set options = "$options -D STAR_CHISQ 20.0"
+  set options = "$options -D IMAGE_OFFSET 2.0"
+
+  set options = "$options -nloop 25"
+
+  set options = "$options -D CAMERA gpc1"
+  set options = "$options -basic-image-search"
+  set options = "$options -update"
+  set options = "$options -threads 4"
+  set options = "$options -statmode WT_MEAN"
+  set options = "$options -max-density 2000"
+
+  ## note the boundary tree location is hard-wired
+  set options = "$options -boundary-tree ~ippdvo/RINGS.V3.tree.v2.fits"
+
+  # activate parallel mode when catdir is parallel
+  set options = "$options -parallel"
+
+  # option to change the schema
+  # set options = "$options -update-catformat PS1_V3"
+
+  set region = "-region $ra_min $ra_max $dec_min $dec_max"
+  run.relphot
+  if ($status) then
+    echo "ERROR : failure running relphot"
+    echo -n "--- done with relphot --- "; date
+    exit 1
+  endif
+endif
+
+## this block is used to set the mean mags in the assumption that the images are calibrated
+if (0) then
+  set filters = "g,r,i,z,y"
+
+  set options = "$filters -imfreeze -mosaic"
+  set options = "$options -D MAG_LIM 32.0"
+  set options = "$options -D SIGMA_LIM 0.1"
+  set options = "$options -D STAR_TOOFEW 1"
+  set options = "$options -D STAR_CHISQ 20.0"
+  set options = "$options -D IMAGE_OFFSET 2.0"
+
+  ## note the boundary tree location is hard-wired
+  set options = "$options -boundary-tree ~ippdvo/RINGS.V3.tree.v2.fits"
+  set options = "$options -nloop 0"
+
+  set options = "$options -D CAMERA gpc1"
+  set options = "$options -basic-image-search"
+  set options = "$options -update"
+  set options = "$options -threads 4"
+  set options = "$options -statmode WT_MEAN"
+  set options = "$options -max-density 2000"
+
+  # activate parallel mode when catdir is parallel
+  set options = "$options -parallel"
+
+  # option to change the schema
+  # set options = "$options -update-catformat PS1_V3"
+
+  set region = "-region $ra_min $ra_max $dec_min $dec_max"
+  run.relphot
+  if ($status) then
+    echo "ERROR : failure running relphot"
+    echo -n "--- done with relphot --- "; date
+    exit 1
+  endif
+endif
+
+echo -n "--- done with relphot --- "; date
+exit 0
Index: trunk/tools/dvodb_calib/run.setphot
===================================================================
--- trunk/tools/dvodb_calib/run.setphot	(revision 35584)
+++ trunk/tools/dvodb_calib/run.setphot	(revision 35584)
@@ -0,0 +1,41 @@
+#!/bin/csh -f
+
+if ($#argv != 1) then 
+  echo "USAGE: run.setphot (catdir)"
+  exit 2
+endif
+
+set REALRUN = 1
+
+set  catdir = $argv[1]
+set ubercal = ~ipp/ucalqw_noref.fits
+
+alias run.setphot \
+  'echo -n "--- starting setphot $catdir --- "; date; \
+   echo          setphot $options -D CATDIR $catdir $ubercal; \
+   if ($REALRUN) setphot $options -D CATDIR $catdir $ubercal'
+
+set options = ""
+set options = "$options -update"
+set options = "$options -ubercal"
+set options = "$options -no-metadata"
+
+# activate parallel mode when catdir is parallel
+set options = "$options -parallel"
+
+set options = "$options -v"
+# the new ubercal file includes Eddie's offsets relative to JT (so, no need to supply -zpt-offsets)
+run.setphot
+if ($status) then
+  echo "failed setphot"
+  echo -n "--- done with setphot ---"; date
+  exit 1
+endif
+echo -n "--- done with setphot ---"; date
+exit 0
+
+
+# old command lines with zpt offsets
+# setphot -parallel -reset -zpt-offsets g,r,i,z,y -0.013,+0.012,+0.001,-0.016,-0.021 -update -ubercal -no-metadata -D CATDIR $catdir_3pi $ubercal
+# setphot -images-only -parallel -reset -zpt-offsets g,r,i,z,y -0.013,+0.012,+0.001,-0.016,-0.021 -update -ubercal -no-metadata -D CATDIR $catdir_3pi $ubercal
+
