Index: /trunk/tools/dvodb_calib/README
===================================================================
--- /trunk/tools/dvodb_calib/README	(revision 36656)
+++ /trunk/tools/dvodb_calib/README	(revision 36657)
@@ -9,4 +9,4 @@
 Step Four: run gene.relastro.part2
 
-Step Five: run gene.relphot
+Step Five: run gene.relphot.3pinew or run gene.relphot.mdnew (depends on tess)
 
Index: /trunk/tools/dvodb_calib/gene.run.relphot.3pinew
===================================================================
--- /trunk/tools/dvodb_calib/gene.run.relphot.3pinew	(revision 36657)
+++ /trunk/tools/dvodb_calib/gene.run.relphot.3pinew	(revision 36657)
@@ -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 (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 -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/tess.3pi.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 (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 -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/gene.run.relphot.mdnew
===================================================================
--- /trunk/tools/dvodb_calib/gene.run.relphot.mdnew	(revision 36657)
+++ /trunk/tools/dvodb_calib/gene.run.relphot.mdnew	(revision 36657)
@@ -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 (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 -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 (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 -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/tess.md.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.
