Index: /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_catalog_setphot.c
===================================================================
--- /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 39711)
+++ /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 39712)
@@ -1,3 +1,7 @@
 # include "setphot.h"
+
+// XXX I need to add a few things for HSC + MC + GPC1:
+// * I can generate a zpt table for the MC exposures using the nominal zero points
+// * for the HSC data, I need to add a function to define Mflat as a function of Xmos, Ymos
 
 void update_catalog_setphot (Catalog *catalog, Image *image, off_t *index, off_t Nimage, CamPhotomCorrection *camcorr) {
@@ -14,8 +18,13 @@
     Measure *measure = &catalog[0].measure[i];
 
-    // only do GPC1 data for now
-    if (measure[0].photcode < 10000) continue;
-    if (measure[0].photcode > 10600) continue;
+    // XXX deprecated 2016.09.22 : only do GPC1 data for now
+    // if (measure[0].photcode < 10000) continue;
+    // if (measure[0].photcode > 10600) continue;
       
+    // only do DEP photcodes (skip REF, etc)
+    PhotCode *code = GetPhotcodebyCode (measure[0].photcode);
+    if (!code) continue; // invalid photcode
+    if (code->type != PHOT_DEP) continue;
+
     off_t idx = measure[0].imageID;
     if (idx <= 0) continue; // detections with imageID == 0 do not have a valid image (eg, ref photcode)
@@ -33,4 +42,16 @@
       Mflat = CamPhotomCorrectionValue (camcorr, flat_id, measure[0].Xccd, measure[0].Yccd);
     }
+
+# if (0)
+    // the mosaic lookup is broken : fix it then redo this block
+    if (radialZP) {
+      mosaic = MatchMosaicMetadata (measure[0].imageID);
+      if (mosaic == NULL) break;
+      double Rm = measure[0].R;
+      double Dm = measure[0].D;
+      RD_to_XY (&XMOS_MEAS, &YMOS_MEAS, Rm, Dm, mosaic);
+      Mflat = RadialZPtrend (XMOS_MEAS, XMOS_MEAS);
+    }
+# endif
 
     measure[0].Mcal = Mcal;
