Index: /branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_ICRF.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_ICRF.c	(revision 37602)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_ICRF.c	(revision 37603)
@@ -136,5 +136,4 @@
 
     // measure now carries R,D (not dR,dD) 
-    catalog[0].measure[Nmeas].dbFlags  = 0;
     catalog[0].measure[Nmeas].averef   = n;
     catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
Index: /branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/mkcmf.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/mkcmf.c	(revision 37602)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/mkcmf.c	(revision 37603)
@@ -294,6 +294,6 @@
   gfits_modify (&header, "NASTRO",   "%d", 1, 100); 
 
-  if (imageID == -1) imageID = 1000.0*drand48();
-  if (sourceID == -1) sourceID = 100.0*drand48();
+  if (imageID == -1) imageID = 100000.0*drand48();
+  if (sourceID == -1) sourceID = 1000.0*drand48();
   gfits_modify (&header, "IMAGEID",  "%d", 1, imageID);
   gfits_modify (&header, "SOURCEID", "%d", 1, sourceID);
Index: /branches/eam_branches/ipp-20140904/Ohana/src/addstar/test/relphot.parallel.dvo
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/addstar/test/relphot.parallel.dvo	(revision 37602)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/addstar/test/relphot.parallel.dvo	(revision 37603)
@@ -25,17 +25,23 @@
   if (not($?VERBOSE)) set VERBOSE = 0
 
-  # images are loaded into dvo with GPC1 photcodes, so we need to get the nominal zps for those filters
-  $zpt_nominal:g = 24.58
-  $zpt_nominal:r = 24.80
-  $zpt_nominal:i = 24.74
-  $zpt_nominal:z = 24.26
-  $zpt_nominal:y = 23.41
-
-  # klam is negative, so klam*(airmass - 1) increase the zero point
-  $klam_nominal:g = -0.15
-  $klam_nominal:r = -0.10
-  $klam_nominal:i = -0.04
-  $klam_nominal:z = -0.03
-  $klam_nominal:y = -0.03
+# images are loaded into dvo with GPC1 photcodes, so we need to get the nominal zps for those filters
+# $zpt_nominal:g = 24.58
+# $zpt_nominal:r = 24.80
+# $zpt_nominal:i = 24.74
+# $zpt_nominal:z = 24.26
+# $zpt_nominal:y = 23.41
+
+# klam is negative, so klam*(airmass - 1) increase the zero point
+# $klam_nominal:g = -0.15
+# $klam_nominal:r = -0.10
+# $klam_nominal:i = -0.04
+# $klam_nominal:z = -0.03
+# $klam_nominal:y = -0.03
+
+  $zpt_nominal:g = 24.563; $klam_nominal:g = -0.147
+  $zpt_nominal:r = 24.750; $klam_nominal:r = -0.085
+  $zpt_nominal:i = 24.611; $klam_nominal:i = -0.044
+  $zpt_nominal:z = 24.250; $klam_nominal:z = -0.033
+  $zpt_nominal:y = 23.320; $klam_nominal:y = -0.073
 
   # we have two sets of images: ubercaled and not-ubercaled
@@ -111,5 +117,5 @@
   mksequence $fileroot $catdir
   for i 0 mjd_nc[]
-    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
+    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw 0
   end
 
@@ -121,5 +127,5 @@
 
   # run relphot on the serial db and check that the images now match the expected values
-  exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.s0
+  exec relphot -images g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update >& log.relphot.s0
 
   for i 0 mjd_nc[]
@@ -128,11 +134,9 @@
     # matching the mean zp of photometric data, which we calculate in
     # 'init'
-    ckexposure $catdir mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
+    ckexposure $catdir mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc 0
   end
 
   # run relphot on the parallel db and check that the images now match the expected values
-  exec relphot -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0
-
-  exec dvodist -in $catdir.p0 >& log.dvodist.in
+  exec relphot -images -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0
 
   for i 0 mjd_nc[]
@@ -141,5 +145,5 @@
     # matching the mean zp of photometric data, which we calculate in
     # 'init'
-    ckexposure $catdir.p0 mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
+    ckexposure $catdir.p0 mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc 1
   end
 
@@ -148,6 +152,6 @@
 
 macro ckexposure
-  if ($0 != 8)
-    echo "ckexposure (catdir) (mjd) (zpt) (exptime) (airmass) (filter) (mode)"
+  if ($0 != 9)
+    echo "ckexposure (catdir) (mjd) (zpt) (exptime) (airmass) (filter) (mode) (isParallel)"
     echo "  mode == raw or corr"
     break
@@ -163,4 +167,8 @@
   $FILTER      = $6
   $MODE        = $7
+  $PARALLEL    =
+  if ($8) 
+    $PARALLEL = "-parallel"
+  end
 
   # XXX need a function to extract the nominal zpt for a given filter / photcode from the db
@@ -182,5 +190,5 @@
 
   skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2} 
-  mextract ra dec mag xccd yccd where (abs(time - $MJD_IMAGE) < 0.0001)
+  mextract $PARALLEL ra dec mag xccd yccd where (abs(time - $MJD_IMAGE) < 0.0001)
   if (not(ra[])) 
     echo "no matching data for MJD = $MJD_IMAGE"
@@ -344,5 +352,5 @@
     # the fake images have inconsistent ra,dec and airmass,sidtime values
     if ($VERBOSE) echo addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass
-    exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& /dev/null
+    exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& log.addstar
     # costs 10/36 sec / chip
   end
@@ -432,4 +440,5 @@
   $catdir = $tmp1/$tmp2
 
+  if ($VERBOSE) echo rsync -auv $catdir/ $catdir.p0/
   exec rsync -auv $catdir/ $catdir.p0/ >& log.rsync
   mkdir $catdir.d1
@@ -442,4 +451,5 @@
   exec echo "3 $hostname $catdir.d3" >> $catdir.p0/HostTable.dat
 
+  if ($VERBOSE) echo dvodist -out $catdir.p0
   exec dvodist -out $catdir.p0 >& log.dvodist.out
 end
