Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/FilterStars.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/FilterStars.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/FilterStars.c	(revision 12008)
@@ -25,11 +25,11 @@
     while (stars[N].R >= 360.0) stars[N].R -= 360.0;
     stars[N].found = -1;
-    stars[N].code = image[0].source;
+    stars[N].code = image[0].photcode;
 
     /** additional quantities to supply to Stars based on the image data **/
 
     /* calculate accurate per-star airmass */
-    stars[N].airmass = airmass (image[0].secz_PS, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
-    stars[N].Mcal    = image[0].Mcal_PS;
+    stars[N].airmass = airmass (image[0].secz, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
+    stars[N].Mcal    = image[0].Mcal;
     stars[N].t       = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
 
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ImageOptions.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ImageOptions.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ImageOptions.c	(revision 12008)
@@ -24,5 +24,5 @@
     if (!strcmp (&images[0].coords.ctype[4], "-DIS")) continue;
 
-    photcode = GetPhotcodebyCode (images[i].source);
+    photcode = GetPhotcodebyCode (images[i].photcode);
 
     if (equivPhotcode) {
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/LoadStars.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/LoadStars.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/LoadStars.c	(revision 12008)
@@ -52,5 +52,5 @@
     exit (1);
   }
-  image[0].source = photcode;
+  image[0].photcode = photcode;
 
   image[0].NX -= XOVERSCAN;
@@ -62,9 +62,9 @@
   tmp = 0;
   /* gfits_scan (&header, "APMIFIT",  "%lf", 1, &tmp); */
-  image[0].apmifit_PS = tmp;
+  image[0].apmifit = tmp;
 
   tmp = 0;
   /* gfits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */
-  image[0].dapmifit_PS = tmp;
+  image[0].dapmifit = tmp;
 
   tmp = 0;
@@ -108,5 +108,5 @@
   tmp = 0;
   gfits_scan (&header, AirmassKeyword, "%lf", 1, &tmp);
-  image[0].secz_PS = MIN (NO_MAG, tmp);
+  image[0].secz = MIN (NO_MAG, tmp);
 
   if (!gfits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) {
@@ -120,5 +120,5 @@
 
   /* secz is in units milli-airmass */
-  image[0].Mcal_PS = 0.0;
+  image[0].Mcal = 0.0;
   image[0].Xm   = NO_MAG;
   image[0].code = 0;
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ReadImageHeader.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ReadImageHeader.c	(revision 12008)
@@ -66,5 +66,5 @@
     exit (1);
   }
-  image[0].source = photcode;
+  image[0].photcode = photcode;
 
   image[0].NX -= XOVERSCAN;
@@ -76,9 +76,9 @@
   tmp = 0;
   /* gfits_scan (header, "APMIFIT",  "%lf", 1, &tmp); */
-  image[0].apmifit_PS = tmp;
+  image[0].apmifit = tmp;
 
   tmp = 0;
   /* gfits_scan (header, "dAPMIFIT", "%lf", 1, &tmp); */
-  image[0].dapmifit_PS = tmp;
+  image[0].dapmifit = tmp;
 
   tmp = 0;
@@ -118,5 +118,5 @@
   tmp = 0;
   gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp);
-  image[0].secz_PS = MIN (NO_MAG, tmp);
+  image[0].secz = MIN (NO_MAG, tmp);
 
   if (!gfits_scan (header, CCDNumKeyword, "%d", 1, &ccdnum)) {
@@ -130,5 +130,5 @@
 
   /* secz is in units milli-airmass */
-  image[0].Mcal_PS = 0.0;
+  image[0].Mcal = 0.0;
   image[0].Xm   = NO_MAG;
   image[0].code = 0;
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ReadStarsFITS.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 12008)
@@ -93,5 +93,5 @@
   PS1Data *ps1data;
 
-  ps1data = gfits_table_get_PS1Data (table, &Nstars, NULL);
+  ps1data = gfits_table_get1Data (table, &Nstars, NULL);
 
   ALLOCATE (stars, Stars, Nstars);
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/SEDfit.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/SEDfit.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/SEDfit.c	(revision 12008)
@@ -80,5 +80,5 @@
     Nphot = 0;
     for (j = 0; j < incat[0].average[i].Nm; j++) {
-      idx = table[0].hashcode[incat[0].measure[m+j].source];
+      idx = table[0].hashcode[incat[0].measure[m+j].photcode];
       if (idx == -1) continue;
       // only fit the selected photcodes (mode == "fit")
@@ -86,8 +86,8 @@
       if (table[0].mode[idx] == SED_SAMPLE) continue; 
       // XXX do something more clever if more than one value exists per photcode
-      sourceValue.mags[idx] = incat[0].measure[m+j].M_PS + table[0].vegaToAB[idx];
-      sourceError.mags[idx] = incat[0].measure[m+j].dM_PS;
-      if (incat[0].measure[m+j].source == USNOred) sourceError.mags[idx] = 0.3;
-      if (incat[0].measure[m+j].source == USNOblu) sourceError.mags[idx] = 0.3;
+      sourceValue.mags[idx] = incat[0].measure[m+j].M + table[0].vegaToAB[idx];
+      sourceError.mags[idx] = incat[0].measure[m+j].dM;
+      if (incat[0].measure[m+j].photcode == USNOred) sourceError.mags[idx] = 0.3;
+      if (incat[0].measure[m+j].photcode == USNOblu) sourceError.mags[idx] = 0.3;
       found[idx] = TRUE;
       Nphot ++;
@@ -171,6 +171,6 @@
 
     for (j = 0; j < Nsec; j++) {
-      outcat[0].secfilt[Nave*Nsec+j].M_PS  = NO_MAG;
-      outcat[0].secfilt[Nave*Nsec+j].dM_PS = NO_MAG;
+      outcat[0].secfilt[Nave*Nsec+j].M  = NO_MAG;
+      outcat[0].secfilt[Nave*Nsec+j].dM = NO_MAG;
       outcat[0].secfilt[Nave*Nsec+j].Xm    = NO_MAG;
     }
@@ -185,18 +185,18 @@
     for (j = 0; valid && (j < Nmodel); j++) {
       n = modelRow[j];
-      outcat[0].measure[Nmeas].dR_PS       = 0.0;
-      outcat[0].measure[Nmeas].dD_PS       = 0.0;
-      outcat[0].measure[Nmeas].M_PS        = MIN (table[0].row[minFit.row][0].mags[n] + minFit.Md,  NO_MAG);
-      outcat[0].measure[Nmeas].dM_PS       = 0.0;
-      outcat[0].measure[Nmeas].Mcal_PS     = 0;
+      outcat[0].measure[Nmeas].dR       = 0.0;
+      outcat[0].measure[Nmeas].dD       = 0.0;
+      outcat[0].measure[Nmeas].M        = MIN (table[0].row[minFit.row][0].mags[n] + minFit.Md,  NO_MAG);
+      outcat[0].measure[Nmeas].dM       = 0.0;
+      outcat[0].measure[Nmeas].Mcal     = 0;
       outcat[0].measure[Nmeas].t           = TIMEREF;
       outcat[0].measure[Nmeas].averef      = Nave;
-      outcat[0].measure[Nmeas].source      = table[0].code[n];
+      outcat[0].measure[Nmeas].photcode      = table[0].code[n];
       outcat[0].measure[Nmeas].dophot      = 0;
       outcat[0].measure[Nmeas].flags       = 0;
-      outcat[0].measure[Nmeas].dt_PS       = 0xffff;
-
-      outcat[0].measure[Nmeas].Mgal_PS     = NO_MAG;
-      outcat[0].measure[Nmeas].airmass_PS  = 0;
+      outcat[0].measure[Nmeas].dt       = 0xffff;
+
+      outcat[0].measure[Nmeas].Mgal     = NO_MAG;
+      outcat[0].measure[Nmeas].airmass  = 0;
       outcat[0].measure[Nmeas].FWx         = NO_MAG;
       outcat[0].measure[Nmeas].FWy         = NO_ERR;
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/calibrate.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/calibrate.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/calibrate.c	(revision 12008)
@@ -60,5 +60,5 @@
   //  - calibrate to external system (Mref)
 
-  mycode = GetPhotcodebyCode (new[0].source);
+  mycode = GetPhotcodebyCode (new[0].photcode);
   incode = GetPhotcodebyCode (mycode[0].equiv);
   excode = GetPhotcodebyCode (incode[0].equiv);
@@ -74,19 +74,19 @@
   m = average[0].offset;
   for (i = 0; i < average[0].Nm; i++) {
-    if (measure[m].source == CalC0) { 
+    if (measure[m].photcode == CalC0) { 
       found0 = TRUE; 
-      CalM0  = measure[m].M_PS; 
-      dCalM  = measure[m].dM_PS; 
+      CalM0  = measure[m].M; 
+      dCalM  = measure[m].dM; 
     }
-    if (measure[m].source == CalC1) { 
+    if (measure[m].photcode == CalC1) { 
       found1 = TRUE; 
-      CalM1  = measure[m].M_PS; 
+      CalM1  = measure[m].M; 
     }
-    if (measure[m].source == CalC2) { 
+    if (measure[m].photcode == CalC2) { 
       found2 = TRUE; 
-      CalM2  = measure[m].M_PS; 
+      CalM2  = measure[m].M; 
     }
     if (found0 && found1 && found2) {
-      Mcal   = new[0].M_PS + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass_PS - 1.0) - ZeroPt;
+      Mcal   = new[0].M + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass - 1.0) - ZeroPt;
       color  = CalM1 - CalM2 - 0.001*mycode[0].dX;
       factor = color;
@@ -99,5 +99,5 @@
       }
       // if we want to apply a Mcal -> Mref color correction, we need the additional color term
-      SaveCalibration (Mcal, new[0].dM_PS, CalM0, dCalM, new[0].M_PS - ZeroPt - new[0].dt_PS, Nstar);
+      SaveCalibration (Mcal, new[0].dM, CalM0, dCalM, new[0].M - ZeroPt - new[0].dt, Nstar);
       return;
     }
@@ -121,6 +121,6 @@
   if (MaxN == -1) {
     fprintf (stderr, "no clean stars\n");
-    image[0].Mcal_PS = 10.000;
-    image[0].dMcal_PS = 10.000;
+    image[0].Mcal = 10.000;
+    image[0].dMcal = 10.000;
     return;
   }
@@ -155,6 +155,6 @@
   if (Nkeep < 5) {
     fprintf (stderr, "too few stars\n");
-    image[0].Mcal_PS = 10.000;
-    image[0].dMcal_PS = 10.000;
+    image[0].Mcal = 10.000;
+    image[0].dMcal = 10.000;
     return;
   }
@@ -187,11 +187,11 @@
     Mw = W1 / W2;
     fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N));
-    image[0].Mcal_PS = M1;
-    image[0].dMcal_PS = M2 / sqrt (N);
+    image[0].Mcal = M1;
+    image[0].dMcal = M2 / sqrt (N);
     image[0].Mxxxx = N;
   } else {
     fprintf (stderr, "too few stars\n");
-    image[0].Mcal_PS = 10.000;
-    image[0].dMcal_PS = 10.000;
+    image[0].Mcal = 10.000;
+    image[0].dMcal = 10.000;
     image[0].Mxxxx = 0;
   }
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/fakeimage.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/fakeimage.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/fakeimage.c	(revision 12008)
@@ -111,10 +111,10 @@
     image[i+1].NY = Ny;
 
-    image[i+1].source = photcode;
+    image[i+1].photcode = photcode;
 
     image[i+1].exptime = 0.0;
   
-    image[i+1].apmifit_PS = 0.0;
-    image[i+1].dapmifit_PS = 0.0;
+    image[i+1].apmifit = 0.0;
+    image[i+1].dapmifit = 0.0;
 
     image[i+1].detection_limit = 0.0;
@@ -124,8 +124,8 @@
     image[i+1].tzero = MosaicTime;
     image[i+1].trate = 0;
-    image[i+1].secz_PS = 1.0;
+    image[i+1].secz = 1.0;
     image[i+1].ccdnum = 0xff;
 
-    image[i+1].Mcal_PS = 0.0;
+    image[i+1].Mcal = 0.0;
     image[i+1].Xm   = NO_MAG;
     image[i+1].code = 0;
@@ -173,9 +173,9 @@
   image[0].NY = Dmax - Dmin;
 
-  image[0].source = photcode;
+  image[0].photcode = photcode;
 
   image[0].exptime = 0.0;
-  image[0].apmifit_PS = 0.0;
-  image[0].dapmifit_PS = 0.0;
+  image[0].apmifit = 0.0;
+  image[0].dapmifit = 0.0;
   image[0].detection_limit = 0.0;
   image[0].saturation_limit = 0.0;
@@ -184,7 +184,7 @@
   image[0].tzero = MosaicTime;
   image[0].trate = 0;
-  image[0].secz_PS = 1.0;
+  image[0].secz = 1.0;
   image[0].ccdnum = 0xff;
-  image[0].Mcal_PS = 0.0;
+  image[0].Mcal = 0.0;
   image[0].Xm   = NO_MAG;
   image[0].code = 0;
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches.c	(revision 12008)
@@ -142,16 +142,16 @@
       /** add measurements for this star **/
       /** dR,dD now represent arcsec **/
-      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R - stars[N].R);
-      if (catalog[0].measure[Nmeas].dR_PS > +180.0*3600.0) {
+      catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].R);
+      if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
 	  // average on high end of boundary, move star up
 	  stars[N].R += 360.0;
-	  catalog[0].measure[Nmeas].dR_PS = 3600.0*(catalog[0].average[n].R - stars[N].R);
-      }
-      if (catalog[0].measure[Nmeas].dR_PS < -180.0*3600.0) {
+	  catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
+      }
+      if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
 	  // average on low end of boundary, move star down
 	  stars[N].R -= 360.0;
-	  catalog[0].measure[Nmeas].dR_PS = 3600.0*(catalog[0].average[n].R - stars[N].R);
-      }
-      if (fabs(catalog[0].measure[Nmeas].dR_PS) > 10*RADIUS) {
+	  catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
+      }
+      if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
 	  fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 
 		   catalog[0].average[n].R, catalog[0].average[n].D, 
@@ -160,25 +160,31 @@
 		   Y1[i], Y2[J]);
       }
-      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N].D);
-      catalog[0].measure[Nmeas].M_PS        = stars[N].M;
-      catalog[0].measure[Nmeas].dM_PS       = stars[N].dM;  /* error in input files stored in thousandths of mag */
-      catalog[0].measure[Nmeas].Mcal_PS     = stars[N].Mcal;
-      catalog[0].measure[Nmeas].t           = stars[N].t;
-      catalog[0].measure[Nmeas].averef      = n;              /* this must be an absolute sequence number, if partial average is loaded */
-      catalog[0].measure[Nmeas].source      = stars[N].code;  /* photcode */
-      catalog[0].measure[Nmeas].dophot      = stars[N].dophot;  
-      catalog[0].measure[Nmeas].flags       = 0;
-      catalog[0].measure[Nmeas].dt_PS       = stars[N].dt;
-      catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
-
-      catalog[0].measure[Nmeas].Mgal_PS     = stars[N].Mgal;
-      catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
-      catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
-      catalog[0].measure[Nmeas].theta       = MIN ((255/360)*stars[N].df, NO_ERR);
+      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].D);
+
+      /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
+      /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
+      catalog[0].measure[Nmeas].Xccd     = stars[N].X;
+      catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
+
+      catalog[0].measure[Nmeas].M        = stars[N].M;
+      catalog[0].measure[Nmeas].dM       = stars[N].dM;  /* error in input files stored in thousandths of mag */
+      catalog[0].measure[Nmeas].Mcal     = stars[N].Mcal;
+      catalog[0].measure[Nmeas].t        = stars[N].t;
+      catalog[0].measure[Nmeas].averef   = n;              /* this must be an absolute sequence number, if partial average is loaded */
+      catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
+      catalog[0].measure[Nmeas].dophot   = stars[N].dophot;  
+      catalog[0].measure[Nmeas].flags    = 0;
+      catalog[0].measure[Nmeas].dt       = stars[N].dt;
+      catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
+
+      catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
+      catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
+      catalog[0].measure[Nmeas].FWy      = MIN (100*stars[N].fy, NO_MAG);
+      catalog[0].measure[Nmeas].theta    = MIN ((0xffff/360.0)*stars[N].df, NO_MAG);
 	
       /* it is not valid to pass PRI/SEC/REF photcodes to this routine */
       /* check for entries in the secfilt lists */
       Mcat = PhotCat (&catalog[0].measure[Nmeas]);
-      Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
+      Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M;
       if (*Mval == NO_MAG) *Mval = Mcat;
       /* in UPDATE mode, this value is not saved; use relphot to recalculate */
@@ -263,29 +269,35 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      catalog[0].secfilt[Nave*Nsecfilt+j].M_PS  = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NO_MAG;
-    }
-
-    catalog[0].measure[Nmeas].dR_PS       = 0.0;
-    catalog[0].measure[Nmeas].dD_PS       = 0.0;
-    catalog[0].measure[Nmeas].M_PS        = stars[N].M;
-    catalog[0].measure[Nmeas].dM_PS       = stars[N].dM;
-    catalog[0].measure[Nmeas].Mcal_PS  	  = stars[N].Mcal;
-    catalog[0].measure[Nmeas].t        	  = stars[N].t;
-    catalog[0].measure[Nmeas].averef   	  = Nave;           /* XXX EAM : must be absolute Nave if partial read */
-    catalog[0].measure[Nmeas].source   	  = stars[N].code;  /* photcode */
-    catalog[0].measure[Nmeas].dophot   	  = stars[N].dophot;  
-    catalog[0].measure[Nmeas].flags    	  = 0;
-    catalog[0].measure[Nmeas].dt_PS    	  = stars[N].dt;
-    catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
-
-    catalog[0].measure[Nmeas].Mgal_PS  	  = stars[N].Mgal;
-    catalog[0].measure[Nmeas].FWx      	  = MIN (100*stars[N].fx, NO_MAG);
-    catalog[0].measure[Nmeas].FWy      	  = MIN (100*stars[N].fy, NO_MAG);
-    catalog[0].measure[Nmeas].theta    	  = MIN ((255/360)*stars[N].df, NO_ERR);
+      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
+      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
+      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;
+    }
+
+    /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
+    /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
+    catalog[0].measure[Nmeas].Xccd     = stars[N].X;
+    catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
+
+    catalog[0].measure[Nmeas].dR       	= 0.0;
+    catalog[0].measure[Nmeas].dD       	= 0.0;
+    catalog[0].measure[Nmeas].M        	= stars[N].M;
+    catalog[0].measure[Nmeas].dM       	= stars[N].dM;
+    catalog[0].measure[Nmeas].Mcal  	= stars[N].Mcal;
+    catalog[0].measure[Nmeas].t        	= stars[N].t;
+    catalog[0].measure[Nmeas].averef   	= Nave;           /* XXX EAM : must be absolute Nave if partial read */
+    catalog[0].measure[Nmeas].photcode  = stars[N].code;  /* photcode */
+    catalog[0].measure[Nmeas].dophot   	= stars[N].dophot;  
+    catalog[0].measure[Nmeas].flags    	= 0;
+    catalog[0].measure[Nmeas].dt    	= stars[N].dt;
+    catalog[0].measure[Nmeas].airmass   = stars[N].airmass;
+
+    catalog[0].measure[Nmeas].Mgal  	= stars[N].Mgal;
+    catalog[0].measure[Nmeas].FWx      	= MIN (100*stars[N].fx, NO_MAG);
+    catalog[0].measure[Nmeas].FWy      	= MIN (100*stars[N].fy, NO_MAG);
+    catalog[0].measure[Nmeas].theta    	= MIN ((0xffff/360.0)*stars[N].df, NO_MAG);
+    /* XXX replace df here with theta, right? */
 
     Mcat = PhotCat (&catalog[0].measure[Nmeas]);
-    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
+    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M;
     if (*Mval == NO_MAG) *Mval = Mcat;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches_closest.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches_closest.c	(revision 12008)
@@ -160,16 +160,16 @@
     /** add measurements for this star **/
     /** dR,dD now represent arcsec **/
-    catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R - stars[N].R);
-    if (catalog[0].measure[Nmeas].dR_PS > +180.0*3600.0) {
+    catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].R);
+    if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
       // average on high end of boundary, move star up
       stars[N].R += 360.0;
-      catalog[0].measure[Nmeas].dR_PS = 3600.0*(catalog[0].average[n].R - stars[N].R);
-    }
-    if (catalog[0].measure[Nmeas].dR_PS < -180.0*3600.0) {
+      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
+    }
+    if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
       // average on low end of boundary, move star down
       stars[N].R -= 360.0;
-      catalog[0].measure[Nmeas].dR_PS = 3600.0*(catalog[0].average[n].R - stars[N].R);
-    }
-    if (fabs(catalog[0].measure[Nmeas].dR_PS) > 10*RADIUS) {
+      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
+    }
+    if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
       fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 
 	       catalog[0].average[n].R, catalog[0].average[n].D, 
@@ -178,25 +178,31 @@
 	       Y1[i], Y2[Jmin]);
     }
-    catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N].D);
-    catalog[0].measure[Nmeas].M_PS        = stars[N].M;
-    catalog[0].measure[Nmeas].dM_PS       = stars[N].dM;  /* error in input files stored in thousandths of mag */
-    catalog[0].measure[Nmeas].Mcal_PS     = stars[N].Mcal;
-    catalog[0].measure[Nmeas].t           = stars[N].t;
-    catalog[0].measure[Nmeas].averef      = n;
-    catalog[0].measure[Nmeas].source      = stars[N].code;  /* photcode */
-    catalog[0].measure[Nmeas].dophot      = stars[N].dophot;  
-    catalog[0].measure[Nmeas].flags       = 0;
-    catalog[0].measure[Nmeas].dt_PS       = stars[N].dt;
-    catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
-
-    catalog[0].measure[Nmeas].Mgal_PS     = stars[N].Mgal;
-    catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
-    catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
-    catalog[0].measure[Nmeas].theta       = MIN ((255/360)*stars[N].df, NO_ERR);
+    catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].D);
+
+    /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
+    /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
+    catalog[0].measure[Nmeas].Xccd     = stars[N].X;
+    catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
+
+    catalog[0].measure[Nmeas].M        = stars[N].M;
+    catalog[0].measure[Nmeas].dM       = stars[N].dM;  /* error in input files stored in thousandths of mag */
+    catalog[0].measure[Nmeas].Mcal     = stars[N].Mcal;
+    catalog[0].measure[Nmeas].t        = stars[N].t;
+    catalog[0].measure[Nmeas].averef   = n;
+    catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
+    catalog[0].measure[Nmeas].dophot   = stars[N].dophot;  
+    catalog[0].measure[Nmeas].flags    = 0;
+    catalog[0].measure[Nmeas].dt       = stars[N].dt;
+    catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
+
+    catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
+    catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
+    catalog[0].measure[Nmeas].FWy      = MIN (100*stars[N].fy, NO_MAG);
+    catalog[0].measure[Nmeas].theta    = MIN ((0xffff/360.0)*stars[N].df, NO_MAG);
 	
     /* it is not valid to pass PRI/SEC/REF photcodes to this routine */
     /* check for entries in the secfilt lists */
     Mcat = PhotCat (&catalog[0].measure[Nmeas]);
-    Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
+    Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M;
     if (*Mval == NO_MAG) *Mval = Mcat;
     /* in UPDATE mode, this value is not saved; use relphot to recalculate */
@@ -261,29 +267,34 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      catalog[0].secfilt[Nave*Nsecfilt+j].M_PS  = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG;
+      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
+      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
       catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NO_MAG;
     }
 
-    catalog[0].measure[Nmeas].dR_PS       = 0.0;
-    catalog[0].measure[Nmeas].dD_PS       = 0.0;
-    catalog[0].measure[Nmeas].M_PS        = stars[N].M;
-    catalog[0].measure[Nmeas].dM_PS       = stars[N].dM;
-    catalog[0].measure[Nmeas].Mcal_PS  	  = stars[N].Mcal;
-    catalog[0].measure[Nmeas].t        	  = stars[N].t;
-    catalog[0].measure[Nmeas].averef   	  = Nave;
-    catalog[0].measure[Nmeas].source   	  = stars[N].code;  /* photcode */
-    catalog[0].measure[Nmeas].dophot   	  = stars[N].dophot;  
-    catalog[0].measure[Nmeas].flags    	  = 0;
-    catalog[0].measure[Nmeas].dt_PS    	  = stars[N].dt;
-    catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
-
-    catalog[0].measure[Nmeas].Mgal_PS  	  = stars[N].Mgal;
-    catalog[0].measure[Nmeas].FWx      	  = MIN (100*stars[N].fx, NO_MAG);
-    catalog[0].measure[Nmeas].FWy      	  = MIN (100*stars[N].fy, NO_MAG);
-    catalog[0].measure[Nmeas].theta    	  = MIN ((255/360)*stars[N].df, NO_ERR);
+    /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
+    /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
+    catalog[0].measure[Nmeas].Xccd     = stars[N].X;
+    catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
+
+    catalog[0].measure[Nmeas].dR       = 0.0;
+    catalog[0].measure[Nmeas].dD       = 0.0;
+    catalog[0].measure[Nmeas].M        = stars[N].M;
+    catalog[0].measure[Nmeas].dM       = stars[N].dM;
+    catalog[0].measure[Nmeas].Mcal     = stars[N].Mcal;
+    catalog[0].measure[Nmeas].t        = stars[N].t;
+    catalog[0].measure[Nmeas].averef   = Nave;
+    catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
+    catalog[0].measure[Nmeas].dophot   = stars[N].dophot;  
+    catalog[0].measure[Nmeas].flags    = 0;
+    catalog[0].measure[Nmeas].dt       = stars[N].dt;
+    catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
+
+    catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
+    catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
+    catalog[0].measure[Nmeas].FWy      = MIN (100*stars[N].fy, NO_MAG);
+    catalog[0].measure[Nmeas].theta    = MIN ((0xffff/360.0)*stars[N].df, NO_ERR);
 
     Mcat = PhotCat (&catalog[0].measure[Nmeas]);
-    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
+    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M;
     if (*Mval == NO_MAG) *Mval = Mcat;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches_refstars.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_matches_refstars.c	(revision 12008)
@@ -131,29 +131,34 @@
       /** add measurements for this star **/
       /** *** dR,dD now in arcsec *** **/
-      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R - stars[N][0].R);
-      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N][0].D);
-      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N][0].M,  NO_MAG);
-      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N][0].dM, NO_ERR);
-      catalog[0].measure[Nmeas].Mcal_PS     = 0;
-      catalog[0].measure[Nmeas].t           = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
-      catalog[0].measure[Nmeas].averef      = n;
-      catalog[0].measure[Nmeas].source      = stars[N][0].code;
-      catalog[0].measure[Nmeas].dophot      = 0;
-      catalog[0].measure[Nmeas].flags       = 0;
-      catalog[0].measure[Nmeas].dt_PS       = 0xffff;
-
-      catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
-      catalog[0].measure[Nmeas].airmass_PS  = 0;
-      catalog[0].measure[Nmeas].FWx         = NO_MAG;
-      catalog[0].measure[Nmeas].FWy         = NO_MAG;
-      catalog[0].measure[Nmeas].theta       = NO_ERR;
+      catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].R);
+      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].D);
+      catalog[0].measure[Nmeas].M        = MIN (stars[N][0].M,  NO_MAG);
+      catalog[0].measure[Nmeas].dM       = MIN (stars[N][0].dM, NO_ERR);
+      catalog[0].measure[Nmeas].Mcal     = 0;
+      catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
+      catalog[0].measure[Nmeas].averef   = n;
+      catalog[0].measure[Nmeas].photcode = stars[N][0].code;
+      catalog[0].measure[Nmeas].dophot   = 0;
+      catalog[0].measure[Nmeas].flags    = 0;
+      catalog[0].measure[Nmeas].dt       = 0xffff;
+
+      catalog[0].measure[Nmeas].Mgal     = NO_MAG;
+      catalog[0].measure[Nmeas].airmass  = 0;
+      catalog[0].measure[Nmeas].FWx      = NO_MAG;
+      catalog[0].measure[Nmeas].FWy      = NO_MAG;
+      catalog[0].measure[Nmeas].theta    = NO_MAG;
 	
+      /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
+      /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
+      catalog[0].measure[Nmeas].Xccd     = 0.0;
+      catalog[0].measure[Nmeas].Yccd     = 0.0;
+
       if (ACCEPT_MOTION) {
-	catalog[0].average[n].uR          = stars[N][0].uR;
-	catalog[0].average[n].uD          = stars[N][0].uD;
-	catalog[0].average[n].duR         = stars[N][0].duR;
-	catalog[0].average[n].duD         = stars[N][0].duD;
-	catalog[0].average[n].P           = stars[N][0].P;
-	catalog[0].average[n].dP          = stars[N][0].dP;
+	catalog[0].average[n].uR         = stars[N][0].uR;
+	catalog[0].average[n].uD         = stars[N][0].uD;
+	catalog[0].average[n].duR        = stars[N][0].duR;
+	catalog[0].average[n].duD        = stars[N][0].duD;
+	catalog[0].average[n].P          = stars[N][0].P;
+	catalog[0].average[n].dP         = stars[N][0].dP;
       }
 
@@ -240,26 +245,31 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      catalog[0].secfilt[Nave*Nsecfilt+j].M_PS  = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NO_MAG;
-    }
-
-    catalog[0].measure[Nmeas].dR_PS       = 0.0;
-    catalog[0].measure[Nmeas].dD_PS       = 0.0;
-    catalog[0].measure[Nmeas].M_PS        = MIN (stars[N][0].M,  NO_MAG);
-    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N][0].dM, NO_ERR);
-    catalog[0].measure[Nmeas].Mcal_PS     = 0;
-    catalog[0].measure[Nmeas].t        	  = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/
-    catalog[0].measure[Nmeas].averef   	  = Nave;
-    catalog[0].measure[Nmeas].source   	  = stars[N][0].code;
-    catalog[0].measure[Nmeas].dophot   	  = 0;
-    catalog[0].measure[Nmeas].flags    	  = 0;
-    catalog[0].measure[Nmeas].dt_PS       = 0xffff;
-
-    catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
-    catalog[0].measure[Nmeas].airmass_PS  = 0;
-    catalog[0].measure[Nmeas].FWx      	  = NO_MAG;
-    catalog[0].measure[Nmeas].FWy      	  = NO_ERR;
-    catalog[0].measure[Nmeas].theta    	  = NO_ERR;
+      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
+      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
+      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;
+    }
+
+    catalog[0].measure[Nmeas].dR       = 0.0;
+    catalog[0].measure[Nmeas].dD       = 0.0;
+    catalog[0].measure[Nmeas].M        = MIN (stars[N][0].M,  NO_MAG);
+    catalog[0].measure[Nmeas].dM       = MIN (stars[N][0].dM, NO_ERR);
+    catalog[0].measure[Nmeas].Mcal     = 0;
+    catalog[0].measure[Nmeas].t        = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/
+    catalog[0].measure[Nmeas].averef   = Nave;
+    catalog[0].measure[Nmeas].photcode = stars[N][0].code;
+    catalog[0].measure[Nmeas].dophot   = 0;
+    catalog[0].measure[Nmeas].flags    = 0;
+    catalog[0].measure[Nmeas].dt       = 0xffff;
+
+    catalog[0].measure[Nmeas].airmass  = 0;
+    catalog[0].measure[Nmeas].Mgal     = NO_MAG;
+    catalog[0].measure[Nmeas].FWx      = NO_MAG;
+    catalog[0].measure[Nmeas].FWy      = NO_MAG;
+    catalog[0].measure[Nmeas].theta    = NO_MAG;
+
+    /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
+    /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
+    catalog[0].measure[Nmeas].Xccd     = 0.0;
+    catalog[0].measure[Nmeas].Yccd     = 0.0;
 
     stars[N][0].found = Nmeas;
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_proper.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_proper.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/find_proper.c	(revision 12008)
@@ -111,5 +111,5 @@
 	catalog[0].measure[Nmeas].t   = 0;    /* a flag: if 0, image is not in database */
 	catalog[0].measure[Nmeas].averef  = n;
-	catalog[0].measure[Nmeas].source = USNO_RED; 
+	catalog[0].measure[Nmeas].photcode = USNO_RED; 
 	catalog[0].measure[Nmeas+1].dR  = catalog[0].measure[Nmeas].dR;
 	catalog[0].measure[Nmeas+1].dD  = catalog[0].measure[Nmeas].dD;
@@ -119,5 +119,5 @@
 	catalog[0].measure[Nmeas+1].t   = 0;    /* a flag: if 0, image is not in database */
 	catalog[0].measure[Nmeas+1].averef  = n;
-	catalog[0].measure[Nmeas+1].source = USNO_BLUE; 
+	catalog[0].measure[Nmeas+1].photcode = USNO_BLUE; 
 	/* add flag in average to mark as matched with the USNO catalog */
 	catalog[0].average[n].code |= (ID_PROPER | ID_USNO);
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/load2mass_catalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/load2mass_catalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/load2mass_catalog.c	(revision 12008)
@@ -44,6 +44,6 @@
 
     for (j = 0; j < Nsec; j++) {
-      catalog[0].secfilt[Nave*Nsec+j].M_PS  = NO_MAG;
-      catalog[0].secfilt[Nave*Nsec+j].dM_PS = NO_MAG;
+      catalog[0].secfilt[Nave*Nsec+j].M  = NO_MAG;
+      catalog[0].secfilt[Nave*Nsec+j].dM = NO_MAG;
       catalog[0].secfilt[Nave*Nsec+j].Xm    = NO_MAG;
     }
@@ -51,18 +51,18 @@
     // we now have the min chisq row. use this to supply the other filter values....
     for (j = 0; j < 3; j++) {
-      catalog[0].measure[Nmeas].dR_PS       = 0.0;
-      catalog[0].measure[Nmeas].dD_PS       = 0.0;
-      catalog[0].measure[Nmeas].M_PS        = MIN (stars[i+j].M,  NO_MAG);
-      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[i+j].dM,  NO_ERR);
-      catalog[0].measure[Nmeas].Mcal_PS     = 0;
+      catalog[0].measure[Nmeas].dR       = 0.0;
+      catalog[0].measure[Nmeas].dD       = 0.0;
+      catalog[0].measure[Nmeas].M        = MIN (stars[i+j].M,  NO_MAG);
+      catalog[0].measure[Nmeas].dM       = MIN (stars[i+j].dM,  NO_ERR);
+      catalog[0].measure[Nmeas].Mcal     = 0;
       catalog[0].measure[Nmeas].t           = stars[i+j].t;
       catalog[0].measure[Nmeas].averef      = Nave;
-      catalog[0].measure[Nmeas].source      = stars[i+j].code;
+      catalog[0].measure[Nmeas].photcode      = stars[i+j].code;
       catalog[0].measure[Nmeas].dophot      = 0;
       catalog[0].measure[Nmeas].flags       = 0;
-      catalog[0].measure[Nmeas].dt_PS       = 0xffff;
+      catalog[0].measure[Nmeas].dt       = 0xffff;
 
-      catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
-      catalog[0].measure[Nmeas].airmass_PS  = 0;
+      catalog[0].measure[Nmeas].Mgal     = NO_MAG;
+      catalog[0].measure[Nmeas].airmass  = 0;
       catalog[0].measure[Nmeas].FWx         = NO_MAG;
       catalog[0].measure[Nmeas].FWy         = NO_ERR;
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/replace_match.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/replace_match.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/replace_match.c	(revision 12008)
@@ -7,9 +7,9 @@
   /* search for entry and replace values M, dM, R, D */
   for (i = 0; i < average[0].Nm; i++) {
-    if (measure[i].source != star[0].code) continue;
-    measure[i].dR_PS       = 3600.0*(average[0].R - star[0].R);
-    measure[i].dD_PS       = 3600.0*(average[0].D - star[0].D);
-    measure[i].M_PS        = MIN (star[0].M,  NO_MAG);
-    measure[i].dM_PS       = MIN (star[0].dM, NO_ERR);
+    if (measure[i].photcode != star[0].code) continue;
+    measure[i].dR       = 3600.0*(average[0].R - star[0].R);
+    measure[i].dD       = 3600.0*(average[0].D - star[0].D);
+    measure[i].M        = MIN (star[0].M,  NO_MAG);
+    measure[i].dM       = MIN (star[0].dM, NO_ERR);
     star[0].found          = average[0].offset + i;
     return (TRUE);
Index: /branches/dvo-mods-2007-02/Ohana/src/addstar/src/update_coords.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/addstar/src/update_coords.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/addstar/src/update_coords.c	(revision 12008)
@@ -19,6 +19,6 @@
       continue;
     }
-    R = measure[m].dR_PS;
-    D = measure[m].dD_PS;
+    R = measure[m].dR;
+    D = measure[m].dD;
     r += R;
     d += D;
@@ -37,6 +37,6 @@
   m = average[0].offset;  /* first measurement of this star */
   for (i = 0; i < average[0].Nm; i++) {
-    measure[m].dR_PS -= r;
-    measure[m].dD_PS -= d;
+    measure[m].dR -= r;
+    measure[m].dD -= d;
     m = next[m];
   }
Index: /branches/dvo-mods-2007-02/Ohana/src/delstar/src/delete_imagefile.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/delstar/src/delete_imagefile.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/delstar/src/delete_imagefile.c	(revision 12008)
@@ -45,5 +45,5 @@
     start = image[0].tzero;
     stop  = image[0].tzero + trange;
-    find_matches (&catalog, image[0].source, start, stop);
+    find_matches (&catalog, image[0].photcode, start, stop);
 
     dvo_catalog_save (&catalog, VERBOSE);
Index: /branches/dvo-mods-2007-02/Ohana/src/delstar/src/delete_imagename.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/delstar/src/delete_imagename.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/delstar/src/delete_imagename.c	(revision 12008)
@@ -54,5 +54,5 @@
       start = image[j].tzero;
       stop  = image[j].tzero + trange;
-      find_matches (&catalog, image[j].source, start, stop);
+      find_matches (&catalog, image[j].photcode, start, stop);
 
       dvo_catalog_save (&catalog, VERBOSE);
Index: /branches/dvo-mods-2007-02/Ohana/src/delstar/src/find_image_db.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/delstar/src/find_image_db.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/delstar/src/find_image_db.c	(revision 12008)
@@ -46,5 +46,5 @@
   start = timage[0].tzero - MAX(0.05*timage[0].trate*timage[0].NY, 1);
   stop  = timage[0].tzero + MAX(1.05*timage[0].trate*timage[0].NY, 1);
-  code  = timage[0].source;
+  code  = timage[0].photcode;
 
   Nlist = 0;
@@ -55,5 +55,5 @@
     if (image[i].tzero < start) continue;
     if (image[i].tzero > stop) continue;
-    if (image[i].source != code) continue;
+    if (image[i].photcode != code) continue;
     list[Nlist] = i;
     Nlist ++;
@@ -82,5 +82,5 @@
     if (image[i].tzero > END) continue;
     if (code != NULL) {
-      if (image[i].source != code[0].code) continue;
+      if (image[i].photcode != code[0].code) continue;
     }
     list[Nlist] = i;
Index: /branches/dvo-mods-2007-02/Ohana/src/delstar/src/find_matches.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/delstar/src/find_matches.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/delstar/src/find_matches.c	(revision 12008)
@@ -55,5 +55,5 @@
     drop &= (catalog[0].measure[i].t >= start);
     drop &= (catalog[0].measure[i].t <= end);
-    drop &= ((photcode == -1) || (photcode == catalog[0].measure[i].source));
+    drop &= ((photcode == -1) || (photcode == catalog[0].measure[i].photcode));
     if (!drop) {
       prev = i;
Index: /branches/dvo-mods-2007-02/Ohana/src/delstar/src/gimages.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/delstar/src/gimages.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/delstar/src/gimages.c	(revision 12008)
@@ -56,5 +56,5 @@
     Shutdown ("ERROR: photcode %s not found in photcode table", photcode);
   }
-  image[0].source = Nc;
+  image[0].photcode = Nc;
 
   tmp = 0;
@@ -76,8 +76,8 @@
   tmp = 0;
   gfits_scan (&header, "AIRMASS", "%lf", 1, &tmp);
-  image[0].secz_PS = tmp;
+  image[0].secz = tmp;
 
   /* secz is in units milli-airmass */
-  image[0].Mcal_PS =  ALPHA*(image[0].secz_PS - 1.000);
+  image[0].Mcal =  ALPHA*(image[0].secz - 1.000);
   image[0].Xm   = NO_MAG;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/elixir/src/DefineProcesses.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/elixir/src/DefineProcesses.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/elixir/src/DefineProcesses.c	(revision 12008)
@@ -27,5 +27,5 @@
   GetConfig (config, "global.pending", "%s",  0, global[0].argv[2]);
   GetConfig (config, "global.logfile", "%s",  0, global[0].argv[3]);
-  GetConfig (config, "global.source",  "%s",  0, global[0].argv[4]);
+  GetConfig (config, "global.photcode",  "%s",  0, global[0].argv[4]);
   GetConfig (config, "global.msg",     "%s",  0, global[0].argv[5]);
   GetConfig (config, "global.end",     "%s",  0, global[0].argv[6]);
Index: /branches/dvo-mods-2007-02/Ohana/src/gastro/src/getptolemy.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/gastro/src/getptolemy.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/gastro/src/getptolemy.c	(revision 12008)
@@ -50,5 +50,5 @@
       stars[k].X = catalog.average[j].R;
       stars[k].Y = catalog.average[j].D;
-      stars[k].mag = catalog.measure[catalog.average[j].offset].M_PS;
+      stars[k].mag = catalog.measure[catalog.average[j].offset].M;
     }      
     dvo_catalog_free (&catalog);
Index: /branches/dvo-mods-2007-02/Ohana/src/gastro2/src/getptolemy.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/gastro2/src/getptolemy.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/gastro2/src/getptolemy.c	(revision 12008)
@@ -61,5 +61,5 @@
       Ref[0].stars[k].R = catalog.average[j].R;
       Ref[0].stars[k].D = catalog.average[j].D;
-      Ref[0].stars[k].M = catalog.measure[catalog.average[j].offset].M_PS;
+      Ref[0].stars[k].M = catalog.measure[catalog.average[j].offset].M;
     }      
     dvo_catalog_free (&catalog);
Index: /branches/dvo-mods-2007-02/Ohana/src/getstar/src/select_by_image.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/getstar/src/select_by_image.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/getstar/src/select_by_image.c	(revision 12008)
@@ -21,5 +21,5 @@
     start = image[0].tzero;
     end   = image[0].tzero + 1e-4*image[0].NY*image[0].trate;  /* trate is in 0.1 msec / row */
-    photcode = image[0].source;
+    photcode = image[0].photcode;
   }
   if (VERBOSE) fprintf (stderr, "extracting for range %d to %d (photcode %s)\n", start, end, photcode);
@@ -27,5 +27,5 @@
   for (i = 0; (i < catalog[0].Nmeasure); i++) {
     if ((i % 10000) == 0) fprintf (stderr, ". ");
-    if ((catalog[0].measure[i].t >= start) && (catalog[0].measure[i].t <= end) && (photcode == catalog[0].measure[i].source)) { 
+    if ((catalog[0].measure[i].t >= start) && (catalog[0].measure[i].t <= end) && (photcode == catalog[0].measure[i].photcode)) { 
       n = catalog[0].measure[i].averef;
       stars[N].R      = catalog[0].average[n].R - catalog[0].measure[i].dR / 360000.0;
Index: /branches/dvo-mods-2007-02/Ohana/src/imclean/src/ConfigInit.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imclean/src/ConfigInit.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imclean/src/ConfigInit.c	(revision 12008)
@@ -20,5 +20,5 @@
   ScanConfig (config, "DOPHOT_CHAR_LINE",  "%d", 0, &CHAR_LINE);
   ScanConfig (config, "DOPHOT_TYPE_FIELD", "%d", 0, &TYPE_FIELD);
-  ScanConfig (config, "DOPHOT_PSF_FIELD",  "%d", 0, &PSF_FIELD);
+  ScanConfig (config, "DOPHOTF_FIELD",  "%d", 0, &PSF_FIELD);
   ScanConfig (config, "DOPHOT_AP_FIELD",   "%d", 0, &AP_FIELD);
   ScanConfig (config, "PHOTCODE_FILE",     "%s", 0, PhotCodeFile);
Index: /branches/dvo-mods-2007-02/Ohana/src/imregister/base/ConfigInit.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imregister/base/ConfigInit.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imregister/base/ConfigInit.c	(revision 12008)
@@ -73,7 +73,7 @@
 						   
   WarnConfig (config, "imstats",                     "%s", 0, ElixirBase);
-  sprintf (ImstatFifo, "%s.source", ElixirBase);   
+  sprintf (ImstatFifo, "%s.photcode", ElixirBase);   
   WarnConfig (config, "ptolemy",                     "%s", 0, ElixirBase);
-  sprintf (PtolemyFifo, "%s.source", ElixirBase);
+  sprintf (PtolemyFifo, "%s.photcode", ElixirBase);
 
   if (!ScanConfig (config, "CONNECT", "%s",  0, CONNECT)) {
Index: /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/ConfigInit.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/ConfigInit.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/ConfigInit.c	(revision 12008)
@@ -69,7 +69,7 @@
 						   
   WarnConfig (config, "imstats",                     "%s", 0, ElixirBase);
-  sprintf (ImstatFifo, "%s.source", ElixirBase);   
+  sprintf (ImstatFifo, "%s.photcode", ElixirBase);   
   WarnConfig (config, "ptolemy",                     "%s", 0, ElixirBase);
-  sprintf (PtolemyFifo, "%s.source", ElixirBase);
+  sprintf (PtolemyFifo, "%s.photcode", ElixirBase);
 
   if (!ScanConfig (config, "CONNECT", "%s",  0, CONNECT)) {
Index: /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/dumpfits.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/dumpfits.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/dumpfits.c	(revision 12008)
@@ -113,9 +113,9 @@
     subset   = &image[match[i]];
     startstr = sec_to_date (subset[0].tzero);
-    filtstr  = GetPhotcodeNamebyCode (subset[0].source);
-    zp       = subset[0].Mcal_PS;
-    dzp      = subset[0].dMcal_PS;
+    filtstr  = GetPhotcodeNamebyCode (subset[0].photcode);
+    zp       = subset[0].Mcal;
+    dzp      = subset[0].dMcal;
     XY_to_RD (&ra, &dec, 0.0, 0.0, &subset[0].coords);
-    airmass  = subset[0].secz_PS;
+    airmass  = subset[0].secz;
     sky      = subset[0].Myyyy + 0x8000;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/output.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/output.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/output.c	(revision 12008)
@@ -35,9 +35,9 @@
       
     /* convert photcode to filter name */
-    photstr = GetPhotcodeNamebyCode (image[i].source);
+    photstr = GetPhotcodeNamebyCode (image[i].photcode);
     if (photstr == (char *) NULL) photstr = PhotError;
       
     fprintf (stdout, "%s %s %s  %7.4f %7.4f  %7.4f %5d %02x\n", image[i].name, photstr, timestr, 
-	     image[i].Mcal_PS, image[i].dMcal_PS, image[i].secz_PS, image[i].nstar, image[i].code); 
+	     image[i].Mcal, image[i].dMcal, image[i].secz, image[i].nstar, image[i].code); 
     free (timestr);
   }
Index: /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/subset.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/subset.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/subset.c	(revision 12008)
@@ -23,5 +23,5 @@
     }
     if (!status && criteria.Ntimes) continue;
-    if (criteria.PhotcodeSelect && (image[i].source != criteria.photcode)) continue;
+    if (criteria.PhotcodeSelect && (image[i].photcode != criteria.photcode)) continue;
     if (criteria.CodeSelect     && (image[i].code != criteria.Code)) continue;
     if (criteria.NameSelect     && strncasecmp (image[i].name, criteria.Name, NameSelectLength)) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/imregister/src/imphotmerge.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/imregister/src/imphotmerge.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/imregister/src/imphotmerge.c	(revision 12008)
@@ -4,5 +4,5 @@
 
 Image *LoadImageTable (FILE *f, Header *header, int *nimage);
-static char *version = "imphotcopy $Revision: 1.5 $";
+static char *version = "imphotcopy $Revision: 1.5.4.1 $";
 
 int main (int argc, char **argv) {
@@ -105,5 +105,5 @@
     }
     if (!status && Ntimes) continue;
-    if (PhotCodeSelect && (input[i].source != PHOTCODE)) continue;
+    if (PhotCodeSelect && (input[i].photcode != PHOTCODE)) continue;
     if ((NameSelect != (char *) NULL) && (strncasecmp (input[i].name, NameSelect, NameSelectLength))) continue;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/average.d
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/average.d	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/average.d	(revision 12008)
@@ -2,5 +2,5 @@
 EXTNAME      DVO_AVERAGE
 TYPE         BINTABLE
-SIZE         76
+SIZE         84
 DESCRIPTION  DVO Average Object Table
 
@@ -30,6 +30,15 @@
 FIELD missing,        missing,    int,     	    offset to first missing obs
 
+# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+FIELD objID_hi,       OBJ_ID_HI,    unsigned int,   ID upper bytes
+FIELD objID_lo,       OBJ_ID_LO,    unsigned int,   ID lower bytes
+
 # this structure should only be used for internal representations
 # the average-FORMAT structures should be used for external representations
 # note that the average magnitudes are stored in the 'secfilt' table (change this name??)
 # the index for the secfilt table is just Nsecfilt times the index for the average table.
+
+# XXX after the rest of the DVO re-org work, remove the magnitude based values from this table
+# and move them to the secfilt table.
+
+# the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs
Index: /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/image.d
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/image.d	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/image.d	(revision 12008)
@@ -25,13 +25,13 @@
 FIELD 	  tzero,            TZERO,                e_time,         readout time (row 0)
 FIELD 	  nstar,            NSTAR,                unsigned int,   number of stars on image
-FIELD 	  secz_PS,          SECZ,                 float,      	  airmass,                   mag
+FIELD 	  secz,             SECZ,                 float,      	  airmass,                   mag
 FIELD 	  NX,               NX,                   short,      	  image width
 FIELD 	  NY,               NY,                   short,      	  image height
-FIELD 	  apmifit_PS,       APMIFIT,              float,      	  aperture correction,       mag
-FIELD 	  dapmifit_PS,      DAPMIFIT,             float,      	  apmifit error,             mag
-FIELD 	  Mcal_PS,          MCAL,                 float,      	  calibration mag,           mag
-FIELD 	  dMcal_PS,         DMCAL,                float,      	  error on Mcal,             mag
+FIELD 	  apmifit,          APMIFIT,              float,      	  aperture correction,       mag
+FIELD 	  dapmifit,         DAPMIFIT,             float,      	  apmifit error,             mag
+FIELD 	  Mcal,             MCAL,                 float,      	  calibration mag,           mag
+FIELD 	  dMcal,            DMCAL,                float,      	  error on Mcal,             mag
 FIELD 	  Xm,               XM,                   short,      	  image chisq,               10*log(value)
-FIELD 	  source,           SOURCE,               short,      	  identifier for CCD,
+FIELD 	  photcode,         PHOTCODE,             short,      	  identifier for CCD,
 FIELD 	  exptime,          EXPTIME,              float,          exposure time,             seconds
 FIELD     sidtime,          ST,			  float,          sidereal time of exposure
@@ -48,7 +48,9 @@
 FIELD 	  code,             CODE,                 char,           image quality flag
 FIELD 	  ccdnum,           CCDNUM,               unsigned char,  CCD ID number
-# 40 bytes 
+FIELD 	  imageID_hi,       IMAGE_ID_HI,          unsigned int,   ID upper bytes
+FIELD 	  imageID_lo,       IMAGE_ID_LO,          unsigned int,   ID lower bytes
+# 48 bytes 
 
-FIELD 	  dummy,            DUMMY,                char[18],       unused
+FIELD 	  dummy,            DUMMY,                char[10],       unused
 FIELD 	  order,            ORDER,                short,      	  Mrel 2D polynomical order 
 FIELD 	  Mx,               MX,                   short,      	  Mrel polyterm
@@ -66,3 +68,3 @@
 FIELD 	  Mxyyy,            MXYYY,                short,      	  Mrel polyterm
 FIELD 	  Myyyy,            MYYYY,                short,      	  Mrel polyterm
-# 48 bytes
+# 40 bytes
Index: /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/measure.d
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/measure.d	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/measure.d	(revision 12008)
@@ -2,21 +2,49 @@
 EXTNAME      DVO_MEASURE
 TYPE         BINTABLE
-SIZE         50
+SIZE         96
 DESCRIPTION  DVO Detection Measurement Table 
 
-FIELD dR_PS,          D_RA,       float,          RA offset,                	  arcsec
-FIELD dD_PS,          D_DEC,      float,          DEC offset,               	  arcsec
-FIELD M_PS,           MAG,        float,          catalog mag,       	       	  mag
-FIELD Mcal_PS,        Mcal,       float,          image cal mag,	          mag
-FIELD Mgal_PS,        Mgal,       float,          galaxy mag,			  mag
-FIELD dM_PS,          dM,         float,          mag error,                      mag
-FIELD airmass_PS,     airmass,    float,          (airmass - 1),		  airmass
-FIELD dt_PS,          dt,         float,          exposure time,                  2.5*log(exptime)
-FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec 
-FIELD FWy,            FWy,        short,          object fwhm minor axis,         1/100 of arcsec 
-FIELD theta,          theta,      unsigned char,  angle wrt ccd X dir,            (0xff/360) deg
-FIELD dophot,         dophot,     char,           dophot type
-FIELD source,         source,     unsigned short, photcode
-FIELD flags,          flags,      unsigned short, flags for various uses  
-FIELD t,              t,          unsigned int,   time in seconds (UNIX)
-FIELD averef,         averef,     unsigned int,   reference to average entry      
+FIELD dR,             D_RA,         float,          RA offset,                	  arcsec
+FIELD dD,             D_DEC,        float,          DEC offset,               	  arcsec
+FIELD M,              MAG,          float,          catalog mag,       	       	  mag
+FIELD Mcal,           Mcal,         float,          image cal mag,	          mag
+FIELD Mgal,           Mgal,         float,          galaxy mag,			  mag
+FIELD dM,             dM,           float,          mag error,                    mag
+FIELD airmass,        airmass,      float,          (airmass - 1),		  airmass
+FIELD dt,             dt,           float,          exposure time,                2.5*log(exptime)
+
+FIELD t,              t,            unsigned int,   time in seconds (UNIX)
+FIELD averef,         averef,       unsigned int,   reference to average entry      
+
+FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec 
+FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec 
+FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
+FIELD photcode,       photcode,     unsigned short, photcode
+
+FIELD flags,          flags,        unsigned short, flags for various uses  
+FIELD dophot,         dophot,       char,           dophot type
+FIELD stargal,        stargal,      char,           star-galaxy separator
+
+# new field elements needed for Pan-STARRS:
+FIELD Xccd,           X_CCD,        float,          X coord on chip,               pixels
+FIELD Yccd,           Y_CCD,        float,          Y coord on chip,               pixels
+
+# could these be packed into fewer bits?
+FIELD Sky,            SKY_FLUX,     float,          local estimate of sky flux,    counts/sec
+FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
+
+FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
+FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
+
+# do we need more resolution than a short? should this be a log?
+FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
+
+# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+FIELD detID_hi,       DET_ID_HI,    unsigned int,   ID upper bytes
+FIELD detID_lo,       DET_ID_LO,    unsigned int,   ID lower bytes
+
+FIELD imageID_hi,     IMAGE_ID_HI,  unsigned int,   reference to image
+FIELD imageID_lo,     IMAGE_ID_LO,  unsigned int,   reference to image
+
+# we may need 2 extra bytes for padding purposes...
+FIELD dummy,          dummy,        char[6],        padding
Index: /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/secfilt.d
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/secfilt.d	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libautocode/def/secfilt.d	(revision 12008)
@@ -2,10 +2,12 @@
 EXTNAME      DVO_SECFILT
 TYPE         BINTABLE
-SIZE         12
+SIZE         16
 DESCRIPTION  DVO SecFilt : Secondary Filter Data 
 
 # elements of data structure / FITS table
-FIELD  M_PS,  MAG,      float,                other mags,       mags
-FIELD  dM_PS, MAG_ERR,  float,                scatter on mag,   mags
+FIELD  M,     MAG,      float,                other mags,       mags
+FIELD  dM,    MAG_ERR,  float,                scatter on mag,   mags
 FIELD  Xm,    MAG_CHI,  short,                chisq on mag,     [100*log(value)]
+FIELD  Ncode, NCODE,    short,                number of detections in band
+FIELD  Nused, NUSED,    short,                number of detections used in average
 FIELD  dummy, JUNK,     short,                place holder
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/Makefile
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/Makefile	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/Makefile	(revision 12008)
@@ -41,12 +41,14 @@
 $(SRC)/dvo_catalog_split.$(ARCH).o     \
 $(SRC)/dvo_catalog_create.$(ARCH).o    \
+$(SRC)/dvo_catalog_chipcoords.$(ARCH).o \
 $(SRC)/dvo_convert.$(ARCH).o           \
 $(SRC)/dvo_convert_elixir.$(ARCH).o    \
 $(SRC)/dvo_convert_loneos.$(ARCH).o    \
-$(SRC)/dvo_convert_panstarrs.$(ARCH).o \
-$(SRC)/dvo_convert_pmtest.$(ARCH).o \
 $(SRC)/skyregion_io.$(ARCH).o    \
 $(SRC)/skyregion_gsc.$(ARCH).o    \
 $(SRC)/skyregion_ops.$(ARCH).o
+
+# $(SRC)/dvo_convert_panstarrs.$(ARCH).o \
+# $(SRC)/dvo_convert_pmtest.$(ARCH).o \
 
 include ../libautocode/Makefile.Targets
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/doc/dvo-structures.txt
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/doc/dvo-structures.txt	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/doc/dvo-structures.txt	(revision 12008)
@@ -1,2 +1,76 @@
+
+2007.02.22
+
+I have several DVO improvements to implement.  I need to plan them a
+bit carefully.  Here are my thoughts on these updates.
+
+- add chip X,Y to measure table
+
+  this is a fairly simple addition.  In addstar/find_matches, I just need
+  to assign the X,Y value from the incoming star data.  For loading
+  old catalogs which don't include X,Y in the table, I need to
+  calculate the X,Y position based on the R,D after finding the
+  matching image.  I have code to do this calculation currently in
+  dvo/photometry.c for looking up X,Y on the fly.  once this is moved
+  into the load functions, it will not be needed in photometry.c
+
+- remove PRI/SEC and only use secfilt table for mags
+
+  this is not a very difficult change, conceptually, but it may be a
+  fair amount of work.  all of the functions which currently switch on
+  the case of PRI/SEC just need to look in the secfilt location.  the
+  value of Nsec needs to increase by 1.  the load from tables which
+  used PRI/SEC need to move the PRI values to the correct location in
+  secfilt
+
+  eventually, rename 'secfilt' to a better name choice
+
+- add image, average, measure IDs
+
+  for PS1, the image and measure need to be generated by the external
+  software.  they would just be part of the input stream.  for the
+  case were the IDs are not supplied, DVO needs to generate them in a
+  unique way.  I probably need to understand / define that mechanism
+  before tackling this problem.
+
+  one point: I need to keep the old averef index.  how do this index
+  and the objID work together?
+
+- link measure to image
+
+  temporariliy use an index like averef?
+
+- move photcode table to catdir (also zero points)
+
+  should be fairly easy: just like the SkyTable, look in the catdir
+  first, then generate from the default text table if it is missing.
+
+- color term as a function of mosaic position
+ 
+- mextract field,field,field 
+
+  this should not be a very difficult job.  just add a loop to the
+  avextract / mextract functions.
+
+- mextract field(s) where condition
+
+  this is a bit trickier, and could make use of the code in the dvo
+  math functions
+
+- dvo select from mysql
+
+  not very difficult: need to define the commands to select the
+  database and set up a connection, then parse the select line into
+  the appropriate format.  just need to as the db for the type of the
+  fields that are requested: must be numerical.
+
+  select field,field,field from table where condition
+
+- change vectors to doubles
+
+  probably not a terrible job.  this will depend on how the union is
+  defined.  I don't want this to explode the size of an image!
+
+---------
 
 I now have the ability to load and save DVO databases in old formats,
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/LoadPhotcodes.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/LoadPhotcodes.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/LoadPhotcodes.c	(revision 12008)
@@ -2,6 +2,6 @@
 
 # define NCTERMS 4
-# define F_PS 0.001
-# define NO_MAG_PS 100.0
+# define F 0.001
+# define NO_MAG 100.0
 
 static PhotCodeData *photcodes = NULL;
@@ -489,13 +489,13 @@
   float M;
 
-  Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG_PS);
+  Np = photcodes[0].hashcode[measure[0].photcode];
+  if (Np == -1) return (NO_MAG);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    M = measure[0].M_PS;
+    M = measure[0].M;
     return (M);
   }
 
-  M = measure[0].M_PS - measure[0].dt_PS - ZERO_POINT;
+  M = measure[0].M - measure[0].dt - ZERO_POINT;
 	  
   return (M);
@@ -509,13 +509,13 @@
   PhotCode *code;
 
-  Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG_PS);
+  Np = photcodes[0].hashcode[measure[0].photcode];
+  if (Np == -1) return (NO_MAG);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Mcat = measure[0].M_PS;
+    Mcat = measure[0].M;
     return (Mcat);
   }
   code = &photcodes[0].code[Np];
-  Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;
+  Mcat = measure[0].M - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + F*code[0].C;
   
   return (Mcat);
@@ -528,18 +528,18 @@
   PhotCode *code;
 
-  Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG_PS);
+  Np = photcodes[0].hashcode[measure[0].photcode];
+  if (Np == -1) return (NO_MAG);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Msys = measure[0].M_PS;
+    Msys = measure[0].M;
     return (Msys);
   }
   code = &photcodes[0].code[Np];
-  Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;
+  Mcat = measure[0].M - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + F*code[0].C;
 
   /* for DEP, color must be made of PRI/SEC */
   mc = iPhotColor (average, secfilt, NULL, code);
-  if (mc == NO_MAG_PS) return (Mcat);
-  mc = mc - F_PS*code[0].dX;
+  if (mc == NO_MAG) return (Mcat);
+  mc = mc - F*code[0].dX;
 
   Mc = mc;
@@ -559,18 +559,18 @@
   PhotCode *code;
 
-  Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG_PS);
+  Np = photcodes[0].hashcode[measure[0].photcode];
+  if (Np == -1) return (NO_MAG);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Mcat = measure[0].M_PS;
+    Mcat = measure[0].M;
     return (Mcat);
   }
   code = &photcodes[0].code[Np];
-  Mrel = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C - measure[0].Mcal_PS;
+  Mrel = measure[0].M - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + F*code[0].C - measure[0].Mcal;
 
   /* for DEP, color must be made of PRI/SEC */
   mc = iPhotColor (average, secfilt, NULL, code);
-  if (mc == NO_MAG_PS) return (Mrel);
-  mc = mc - F_PS*code[0].dX;
+  if (mc == NO_MAG) return (Mrel);
+  mc = mc - F*code[0].dX;
 
   Mc = mc;
@@ -591,22 +591,22 @@
 
   /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */
-  Np = photcodes[0].hashcode[thisone[0].source];
+  Np = photcodes[0].hashcode[thisone[0].photcode];
   if (Np == -1) {
-    return (NO_MAG_PS);
+    return (NO_MAG);
   }
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Mrel = thisone[0].M_PS;
+    Mrel = thisone[0].M;
     return (Mrel);
   }
   if (code[0].code != photcodes[0].code[Np].equiv) {
-    return (NO_MAG_PS);
-  }
-
-  Mcal = PhotRel (thisone, average, secfilt) + F_PS*code[0].C;
+    return (NO_MAG);
+  }
+
+  Mcal = PhotRel (thisone, average, secfilt) + F*code[0].C;
 
   mc = iPhotColor (average, secfilt, measure, code);
-  if (mc == NO_MAG_PS) return (Mcal);
-  mc = mc - F_PS*code[0].dX;
+  if (mc == NO_MAG) return (Mcal);
+  mc = mc - F*code[0].dX;
 
   Mc = mc;
@@ -627,5 +627,5 @@
   PhotCode *color;
 
-  m1 = m2 = NO_MAG_PS;
+  m1 = m2 = NO_MAG;
 
   if (measure == NULL) {
@@ -633,7 +633,7 @@
     Ns2 = photcodes[0].hashNsec[code[0].c2];
   
-    m1 = (Ns1 == -1) ? average[0].M : secfilt[Ns1].M_PS;
-    m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M_PS;
-    mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);
+    m1 = (Ns1 == -1) ? average[0].M : secfilt[Ns1].M;
+    m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M;
+    mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);
     return (mc);
   }
@@ -641,30 +641,30 @@
   /* find magnitude matching first color term */
   color = GetPhotcodebyCode (code[0].c1);
-  if (color == NULL) return (NO_MAG_PS);
+  if (color == NULL) return (NO_MAG);
   if (color[0].type == PHOT_REF) {
-    for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG_PS); i++) {
-      if (measure[i].source == color[0].code) {
-	m1 = measure[i].M_PS;
+    for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG); i++) {
+      if (measure[i].photcode == color[0].code) {
+	m1 = measure[i].M;
       }
     }
   } else {
     Ns = photcodes[0].hashNsec[color[0].code];
-    m1 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;
+    m1 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
   }	
 
   /* find magnitude matching second color term */
   color = GetPhotcodebyCode (code[0].c2);
-  if (color == NULL) return (NO_MAG_PS);
+  if (color == NULL) return (NO_MAG);
   if (color[0].type == PHOT_REF) {
-    for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG_PS); i++) {
-      if (measure[i].source == color[0].code) {
-	m2 = measure[i].M_PS;
+    for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG); i++) {
+      if (measure[i].photcode == color[0].code) {
+	m2 = measure[i].M;
       }
     }
   } else {
     Ns = photcodes[0].hashNsec[color[0].code];
-    m2 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;
+    m2 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
   }	
-  mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);
+  mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);
   return (mc);
 }
@@ -678,10 +678,10 @@
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;
-  Mref = Mave + F_PS*code[0].C;
+  Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M;
+  Mref = Mave + F*code[0].C;
 
   mc = iPhotColor (average, secfilt, measure, code);
-  if (mc == NO_MAG_PS) return (Mref);
-  mc = mc - F_PS*code[0].dX;
+  if (mc == NO_MAG) return (Mref);
+  mc = mc - F*code[0].dX;
 
   Mc = mc;
@@ -702,5 +702,5 @@
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;
+  Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M;
   return (Mave);
 }
@@ -713,5 +713,5 @@
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  dM  = (Ns == -1) ? average[0].dM : secfilt[Ns].dM_PS;
+  dM  = (Ns == -1) ? average[0].dM : secfilt[Ns].dM;
   return (dM);
 }
@@ -726,5 +726,5 @@
   Ns = photcodes[0].hashNsec[code[0].code];
   Mi = (Ns == -1) ? average[0].Xm : secfilt[Ns].Xm;
-  Xm = (Mi == NO_MAG_PS) ? -1.0 : pow (10.0, 0.01*Mi);
+  Xm = (Mi == NO_MAG) ? -1.0 : pow (10.0, 0.01*Mi);
   return (Xm);
 }
@@ -741,6 +741,6 @@
   if (code[0].type == PHOT_REF) {
     for (i = 0; i < average[0].Nm; i++) {
-      if (measure[i].source == c1) {
-	M1 = measure[i].M_PS;
+      if (measure[i].photcode == c1) {
+	M1 = measure[i].M;
 	goto filter1;
       }
@@ -749,5 +749,5 @@
   } else {
     Ns = photcodes[0].hashNsec[code[0].code];
-    M1 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;
+    M1 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
   }	
 
@@ -757,6 +757,6 @@
   if (code[0].type == PHOT_REF) {
     for (i = 0; i < average[0].Nm; i++) {
-      if (measure[i].source == c2) {
-	M2 = measure[i].M_PS;
+      if (measure[i].photcode == c2) {
+	M2 = measure[i].M;
 	goto filter2;
       }
@@ -765,5 +765,5 @@
   } else {
     Ns = photcodes[0].hashNsec[code[0].code];
-    M2 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;
+    M2 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
   }	
   
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/coordops.update.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/coordops.update.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/coordops.update.c	(revision 12008)
@@ -651,5 +651,5 @@
     case PROJ_GLS:
     case PROJ_PAR:
-      return PROJ_MODE_PSEUDOCLY;
+      return PROJ_MODEEUDOCLY;
   }
   return PROJ_MODE_NONE;
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_catalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_catalog.c	(revision 12008)
@@ -340,11 +340,11 @@
     for (in = out = i = 0; i < catalog[0].Naverage; i++) {
       for (j = 0; j < catalog[0].Nsecfilt; j++, in++, out++) {
-	outsec[out].M_PS  = insec[in].M_PS;
-	outsec[out].dM_PS = insec[in].dM_PS;
+	outsec[out].M  = insec[in].M;
+	outsec[out].dM = insec[in].dM;
 	outsec[out].Xm = insec[in].Xm;
       }
       for (j = 0; j < Nextra; j++, out++) {
-	outsec[out].M_PS  = NO_MAG;
-	outsec[out].dM_PS = NO_MAG;
+	outsec[out].M  = NO_MAG;
+	outsec[out].dM = NO_MAG;
 	outsec[out].Xm    = NO_MAG;
       }
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 12008)
@@ -31,6 +31,6 @@
     if (!strcmp (format, "LONEOS")) catalog[0].catformat = DVO_FORMAT_LONEOS;
     if (!strcmp (format, "ELIXIR")) catalog[0].catformat = DVO_FORMAT_ELIXIR;
-    if (!strcmp (format, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS;
-    if (!strcmp (format, "PMTEST")) catalog[0].catformat = DVO_FORMAT_PMTEST;
+    // if (!strcmp (format, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS;
+    // if (!strcmp (format, "PMTEST")) catalog[0].catformat = DVO_FORMAT_PMTEST;
     if (catalog[0].catformat != DVO_FORMAT_UNDEF) goto got_format;
   }
@@ -71,4 +71,5 @@
       SecFiltSize = sizeof (SecFiltElixir);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
       AverageSize = sizeof(AveragePanstarrs);
@@ -81,4 +82,5 @@
       SecFiltSize = sizeof (SecFiltPanstarrs);
       break;
+# endif
     default:
       fprintf (stderr, "programming error in phot_catalog_raw\n");
@@ -210,6 +212,6 @@
   if (catalog[0].catformat == DVO_FORMAT_LONEOS)    gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "LONEOS");
   if (catalog[0].catformat == DVO_FORMAT_ELIXIR)    gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "ELIXIR");
-  if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS");
-  if (catalog[0].catformat == DVO_FORMAT_PMTEST)    gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST");
+  // if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS");
+  // if (catalog[0].catformat == DVO_FORMAT_PMTEST)    gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST");
 
   /* rewind file pointers and truncate file */
@@ -256,6 +258,6 @@
   AverageElixir *tmpAverageElixir;
   AverageLoneos *tmpAverageLoneos;
-  AveragePanstarrs *tmpAveragePanstarrs;
-  AveragePMtest *tmpAveragePMtest;
+  // AveragePanstarrs *tmpAveragePanstarrs;
+  // AveragePMtest *tmpAveragePMtest;
 
   switch (format) {
@@ -291,4 +293,5 @@
       free (tmpAverageLoneos);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
       ALLOCATE (tmpAveragePanstarrs, AveragePanstarrs, MAX (Naverage, 1));
@@ -313,4 +316,5 @@
       free (tmpAveragePMtest);
       break;
+# endif
     default:
       fprintf (stderr, "error reading measures\n");
@@ -327,6 +331,6 @@
   AverageElixir *tmpAverageElixir;
   AverageLoneos *tmpAverageLoneos;
-  AveragePanstarrs *tmpAveragePanstarrs;
-  AveragePMtest *tmpAveragePMtest;
+  // AveragePanstarrs *tmpAveragePanstarrs;
+  // AveragePMtest *tmpAveragePMtest;
 
   switch (format) {
@@ -359,4 +363,5 @@
       }
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
       tmpAveragePanstarrs = AverageInternalToPanstarrs (average, Naverage);
@@ -379,4 +384,5 @@
       }
       break;
+# endif
     default:
       fprintf (stderr, "error writing averages\n");
@@ -394,5 +400,5 @@
   MeasureElixir *tmpMeasureElixir;
   MeasureLoneos *tmpMeasureLoneos;
-  MeasurePanstarrs *tmpMeasurePanstarrs;
+  // MeasurePanstarrs *tmpMeasurePanstarrs;
 
   switch (format) {
@@ -428,4 +434,5 @@
       free (tmpMeasureLoneos);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -440,4 +447,5 @@
       free (tmpMeasurePanstarrs);
       break;
+# endif
     default:
       fprintf (stderr, "error reading measures\n");
@@ -454,5 +462,5 @@
   MeasureElixir *tmpMeasureElixir;
   MeasureLoneos *tmpMeasureLoneos;
-  MeasurePanstarrs *tmpMeasurePanstarrs;
+  // MeasurePanstarrs *tmpMeasurePanstarrs;
 
   switch (format) {
@@ -485,4 +493,5 @@
       }
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -496,4 +505,5 @@
       }
       break;
+# endif
     default:
       fprintf (stderr, "error writing measures\n");
@@ -511,5 +521,5 @@
   SecFiltElixir *tmpSecFiltElixir;
   SecFiltLoneos *tmpSecFiltLoneos;
-  SecFiltPanstarrs *tmpSecFiltPanstarrs;
+  // SecFiltPanstarrs *tmpSecFiltPanstarrs;
 
   switch (format) {
@@ -545,4 +555,5 @@
       free (tmpSecFiltLoneos);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -557,4 +568,5 @@
       free (tmpSecFiltPanstarrs);
       break;
+# endif
     default:
       fprintf (stderr, "error reading measures\n");
@@ -571,5 +583,5 @@
   SecFiltElixir *tmpSecFiltElixir;
   SecFiltLoneos *tmpSecFiltLoneos;
-  SecFiltPanstarrs *tmpSecFiltPanstarrs;
+  // SecFiltPanstarrs *tmpSecFiltPanstarrs;
 
   switch (format) {
@@ -602,4 +614,5 @@
       }
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -613,4 +626,5 @@
       }
       break;
+# endif
     default:
       fprintf (stderr, "error writing secfilts\n");
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert.c	(revision 12008)
@@ -44,4 +44,8 @@
     return (average);
   }
+/* disable the new and minimally-used versions for now.  
+   put them back in after dev work is further along
+   OR replace with other output formats */
+# if 0
   if (!strcmp (extname, "DVO_AVERAGE_PANSTARRS")) {
     AveragePanstarrs *tmpAverage;
@@ -60,4 +64,5 @@
     return (average);
   }
+# endif
 
   fprintf (stderr, "table format unknown: %s\n", extname);
@@ -71,6 +76,6 @@
   AverageElixir *tmpAverageElixir;
   AverageLoneos *tmpAverageLoneos ;
-  AveragePanstarrs *tmpAveragePanstarrs;
-  AveragePMtest *tmpAveragePMtest;
+  // AveragePanstarrs *tmpAveragePanstarrs;
+  // AveragePMtest *tmpAveragePMtest;
 
   /* convert from the internal format */
@@ -89,4 +94,5 @@
       free (tmpAverageLoneos );
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
       tmpAveragePanstarrs = AverageInternalToPanstarrs (average, Naverage);
@@ -99,4 +105,5 @@
       free (tmpAveragePMtest);
       break;
+# endif
     default:
       fprintf (stderr, "table format unknown (average)\n");
@@ -139,4 +146,5 @@
     return (measure);
   }
+# if 0
   if (!strcmp (extname, "DVO_MEASURE_PANSTARRS") || !strcmp (extname, "DVO_MEASURE_PMTEST")) {
     MeasurePanstarrs *tmpMeasure;
@@ -147,4 +155,5 @@
     return (measure);
   }
+# endif
 
   fprintf (stderr, "table format unknown: %s\n", extname);
@@ -158,5 +167,5 @@
   MeasureElixir *tmpMeasureElixir;
   MeasureLoneos *tmpMeasureLoneos;
-  MeasurePanstarrs *tmpMeasurePanstarrs;
+  // MeasurePanstarrs *tmpMeasurePanstarrs;
 
   /* convert from the internal format */
@@ -175,4 +184,5 @@
       free (tmpMeasureLoneos);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -181,4 +191,5 @@
       free (tmpMeasurePanstarrs);
       break;
+# endif
     default:
       fprintf (stderr, "table format unknown (measure)\n");
@@ -221,4 +232,5 @@
     return (secfilt);
   }
+# if 0
   if (!strcmp (extname, "DVO_SECFILT_PANSTARRS") || !strcmp (extname, "DVO_SECFILT_PMTEST")) {
     SecFiltPanstarrs *tmpSecFilt;
@@ -229,4 +241,5 @@
     return (secfilt);
   }
+# endif
 
   fprintf (stderr, "table format unknown: %s\n", extname);
@@ -240,5 +253,5 @@
   SecFiltElixir *tmpSecFiltElixir;
   SecFiltLoneos *tmpSecFiltLoneos;
-  SecFiltPanstarrs *tmpSecFiltPanstarrs;
+  // SecFiltPanstarrs *tmpSecFiltPanstarrs;
 
   /* convert from the internal format */
@@ -257,4 +270,5 @@
       free (tmpSecFiltLoneos);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -263,4 +277,5 @@
       free (tmpSecFiltPanstarrs);
       break;
+# endif
     default:
       fprintf (stderr, "table format unknown (secfilt)\n");
@@ -313,4 +328,5 @@
     goto set_header;
   }
+# if 0
   if (!strcmp (extname, "DVO_IMAGE_PANSTARRS") || !strcmp (extname, "DVO_IMAGE_PMTEST")) {
     ImagePanstarrs *tmpimage;
@@ -321,4 +337,5 @@
     goto set_header;
   }
+# endif
   fprintf (stderr, "table format unknown: %s\n", extname);
   return (FALSE);
@@ -338,5 +355,5 @@
   ImageElixir *tmpImageElixir;
   ImageLoneos *tmpImageLoneos;
-  ImagePanstarrs *tmpImagePanstarrs;
+  // ImagePanstarrs *tmpImagePanstarrs;
 
   Nimage = theader[0].Naxis[1];
@@ -359,4 +376,5 @@
       free (tmpImageLoneos);
       break;
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -366,4 +384,5 @@
       free (tmpImagePanstarrs);
       break;
+# endif
     default:
       fprintf (stderr, "table format unknown (image ftable)\n");
@@ -377,5 +396,5 @@
   ImageElixir *tmpImageElixir;
   ImageLoneos *tmpImageLoneos;
-  ImagePanstarrs *tmpImagePanstarrs;
+  // ImagePanstarrs *tmpImagePanstarrs;
   int i, Nrow, Nimage;
 
@@ -427,4 +446,5 @@
       vtable[0].size = gfits_matrix_size (theader);
       return (TRUE);
+# if 0
     case DVO_FORMAT_PANSTARRS:
     case DVO_FORMAT_PMTEST:
@@ -436,4 +456,5 @@
 	vtable[0].buffer[i] = (char *) tmpImagePanstarrs;
       }
+# endif
 
       /* convert header from old format to new format */
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_elixir.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 12008)
@@ -10,20 +10,38 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR_PS   = in[i].dR * 0.01;
-    out[i].dD_PS   = in[i].dD * 0.01;
-    out[i].M_PS    = in[i].M  * 0.001;
-    out[i].dM_PS   = in[i].dM * 0.001;
-    out[i].dt_PS      = in[i].dt * 0.001;
-    out[i].Mcal_PS    = in[i].Mcal * 0.001;
-    out[i].Mgal_PS    = in[i].Mgal * 0.001;
-    out[i].airmass_PS = in[i].airmass * 0.001;
-    out[i].FWx 	   = in[i].FWx;
-    out[i].FWy 	   = in[i].fwy * in[i].FWx * 0.01;
-    out[i].theta   = in[i].theta;
-    out[i].dophot  = in[i].dophot;
-    out[i].source  = in[i].source;
-    out[i].t       = in[i].t;
-    out[i].averef  = in[i].averef;
-    out[i].flags   = in[i].flags;
+    out[i].dR       = in[i].dR * 0.01;
+    out[i].dD       = in[i].dD * 0.01;
+    out[i].M        = in[i].M  * 0.001;
+    out[i].dM       = in[i].dM * 0.001;
+    out[i].dt       = in[i].dt * 0.001;
+    out[i].Mcal     = in[i].Mcal * 0.001;
+    out[i].Mgal     = in[i].Mgal * 0.001;
+    out[i].airmass  = in[i].airmass * 0.001;
+    out[i].FWx 	    = in[i].FWx;
+    out[i].FWy 	    = in[i].fwy * in[i].FWx * 0.01;
+    out[i].theta    = in[i].theta*(0x10000 / 0x100);
+    out[i].dophot   = in[i].dophot;
+    out[i].photcode = in[i].source;
+    out[i].t        = in[i].t;
+    out[i].averef   = in[i].averef;
+    out[i].flags    = in[i].flags;
+    
+    /* these can be determined if needed / desired */
+    out[i].Xccd     = 0;
+    out[i].Yccd     = 0;
+    out[i].dXccd    = 0;
+    out[i].dYccd    = 0;
+
+    /* these do not have a corresponding value */
+    out[i].stargal  = 0;
+    out[i].Sky      = 0;
+    out[i].dSky     = 0;
+    out[i].qPSF     = 0;
+
+    /* XXX add these later */
+    out[i].detID_hi = 0;
+    out[i].detID_lo = 0;
+    out[i].imageID_hi = 0;
+    out[i].imageID_lo = 0;
   }
   return (out);
@@ -39,17 +57,17 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR      = in[i].dR_PS * 100.0;
-    out[i].dD 	   = in[i].dD_PS * 100.0;
-    out[i].M       = in[i].M_PS  * 1000.0;
-    out[i].dM      = in[i].dM_PS * 1000.0;
-    out[i].dt      = in[i].dt_PS * 1000.0;
-    out[i].Mcal    = in[i].Mcal_PS * 1000.0;
-    out[i].Mgal    = in[i].Mgal_PS * 1000.0;
-    out[i].airmass = in[i].airmass_PS * 1000.0;
+    out[i].dR      = in[i].dR * 100.0;
+    out[i].dD 	   = in[i].dD * 100.0;
+    out[i].M       = in[i].M  * 1000.0;
+    out[i].dM      = in[i].dM * 1000.0;
+    out[i].dt      = in[i].dt * 1000.0;
+    out[i].Mcal    = in[i].Mcal * 1000.0;
+    out[i].Mgal    = in[i].Mgal * 1000.0;
+    out[i].airmass = in[i].airmass * 1000.0;
     out[i].FWx 	   = in[i].FWx;
-    out[i].fwy 	   = 100.0 * in[i].FWy / in[i].FWx;
-    out[i].theta   = in[i].theta;
+    out[i].fwy 	   = in[i].FWy * 100.0 / in[i].FWx;
+    out[i].theta   = in[i].theta*(0x100/ 0x10000);
     out[i].dophot  = in[i].dophot;
-    out[i].source  = in[i].source;
+    out[i].source  = in[i].photcode;
     out[i].t       = in[i].t;
     out[i].averef  = in[i].averef;
@@ -90,4 +108,8 @@
     out[i].P       = 0;
     out[i].dP      = 0;
+
+    /* XXX add these later */
+    out[i].objID_hi = 0;
+    out[i].objID_lo = 0;
   }
   return (out);
@@ -128,7 +150,9 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].M_PS    = in[i].M  * 0.001;      
-    out[i].dM_PS   = in[i].dM * 0.001;      
-    out[i].Xm      = in[i].Xm;     
+    out[i].M     = in[i].M  * 0.001;      
+    out[i].dM    = in[i].dM * 0.001;      
+    out[i].Xm    = in[i].Xm;     
+    out[i].Ncode = 0;
+    out[i].Nused = 0;
   }
   return (out);
@@ -144,6 +168,6 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].M       = in[i].M_PS  * 1000.0;      
-    out[i].dM      = in[i].dM_PS * 1000.0;
+    out[i].M       = in[i].M  * 1000.0;      
+    out[i].dM      = in[i].dM * 1000.0;
     out[i].Xm      = in[i].Xm;     
   }
@@ -166,13 +190,13 @@
     out[i].tzero    	    = in[i].tzero;
     out[i].nstar    	    = in[i].nstar;
-    out[i].secz_PS    	    = in[i].secz * 0.001;
+    out[i].secz    	    = in[i].secz * 0.001;
     out[i].NX	    	    = in[i].NX;
     out[i].NY	    	    = in[i].NY;
-    out[i].apmifit_PS  	    = in[i].apmifit * 0.001;
-    out[i].dapmifit_PS 	    = in[i].dapmifit * 0.001;
-    out[i].Mcal_PS   	    = in[i].Mcal * 0.001;
-    out[i].dMcal_PS   	    = in[i].dMcal * 0.001;
+    out[i].apmifit  	    = in[i].apmifit * 0.001;
+    out[i].dapmifit 	    = in[i].dapmifit * 0.001;
+    out[i].Mcal   	    = in[i].Mcal * 0.001;
+    out[i].dMcal   	    = in[i].dMcal * 0.001;
     out[i].Xm	    	    = in[i].Xm;
-    out[i].source   	    = in[i].source;
+    out[i].photcode   	    = in[i].source;
     out[i].exptime  	    = in[i].exptime;
     out[i].detection_limit  = in[i].detection_limit;
@@ -199,4 +223,8 @@
     out[i].Mxyyy	    = in[i].Mxyyy;
     out[i].Myyyy	    = in[i].Myyyy;
+
+    /* XXX add these later */
+    out[i].imageID_hi = 0;
+    out[i].imageID_lo = 0;
   }
   return (out);
@@ -218,13 +246,13 @@
     out[i].tzero    	    = in[i].tzero;
     out[i].nstar    	    = in[i].nstar;
-    out[i].secz	    	    = in[i].secz_PS * 1000.0;
+    out[i].secz	    	    = in[i].secz * 1000.0;
     out[i].NX	    	    = in[i].NX;
     out[i].NY	    	    = in[i].NY;
-    out[i].apmifit  	    = in[i].apmifit_PS * 1000.0;
-    out[i].dapmifit 	    = in[i].dapmifit_PS * 1000.0;
-    out[i].Mcal	    	    = in[i].Mcal_PS * 1000.0;
-    out[i].dMcal    	    = in[i].dMcal_PS * 1000.0;
+    out[i].apmifit  	    = in[i].apmifit * 1000.0;
+    out[i].dapmifit 	    = in[i].dapmifit * 1000.0;
+    out[i].Mcal	    	    = in[i].Mcal * 1000.0;
+    out[i].dMcal    	    = in[i].dMcal * 1000.0;
     out[i].Xm	    	    = in[i].Xm;
-    out[i].source   	    = in[i].source;
+    out[i].source   	    = in[i].photcode;
     out[i].exptime  	    = in[i].exptime;
     out[i].detection_limit  = in[i].detection_limit;
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_loneos.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 12008)
@@ -10,11 +10,11 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR_PS   = in[i].dR * 0.01;
-    out[i].dD_PS   = in[i].dD * 0.01;
-    out[i].M_PS    = in[i].M  * 0.001;
-    out[i].dM_PS   = in[i].dM * 0.001;
-    out[i].Mcal_PS = in[i].Mcal * 0.001;
+    out[i].dR   = in[i].dR * 0.01;
+    out[i].dD   = in[i].dD * 0.01;
+    out[i].M    = in[i].M  * 0.001;
+    out[i].dM   = in[i].dM * 0.001;
+    out[i].Mcal = in[i].Mcal * 0.001;
     out[i].dophot  = in[i].dophot;
-    out[i].source  = in[i].source;
+    out[i].photcode  = in[i].source;
     out[i].t       = in[i].t;
 
@@ -24,10 +24,26 @@
 
     /* these values don't exist in the Loneos format */
-    out[i].Mgal_PS    = in[i].M;
-    out[i].dt_PS      = 0;
-    out[i].airmass_PS = 0;
+    out[i].Mgal    = in[i].M;
+    out[i].dt      = 0;
+    out[i].airmass = 0;
     out[i].FWx 	      = 0;
     out[i].FWy 	      = 0;
     out[i].theta      = 0;
+    out[i].stargal  = 0;
+    out[i].Sky      = 0;
+    out[i].dSky     = 0;
+    out[i].qPSF     = 0;
+
+    /* these can be determined if needed / desired */
+    out[i].Xccd     = 0;
+    out[i].Yccd     = 0;
+    out[i].dXccd    = 0;
+    out[i].dYccd    = 0;
+
+    /* XXX add these later */
+    out[i].detID_hi = 0;
+    out[i].detID_lo = 0;
+    out[i].imageID_hi = 0;
+    out[i].imageID_lo = 0;
   }
   return (out);
@@ -43,11 +59,11 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR 	  = in[i].dR_PS * 100.0;
-    out[i].dD 	  = in[i].dD_PS * 100.0;
-    out[i].M  	  = in[i].M_PS  * 1000.0;
-    out[i].dM 	  = in[i].dM_PS * 1000.0;
-    out[i].Mcal   = in[i].Mcal_PS * 1000.0;
+    out[i].dR 	  = in[i].dR * 100.0;
+    out[i].dD 	  = in[i].dD * 100.0;
+    out[i].M  	  = in[i].M  * 1000.0;
+    out[i].dM 	  = in[i].dM * 1000.0;
+    out[i].Mcal   = in[i].Mcal * 1000.0;
     out[i].dophot = in[i].dophot;
-    out[i].source = in[i].source;
+    out[i].source = in[i].photcode;
     out[i].t      = in[i].t;
 
@@ -89,4 +105,8 @@
     out[i].dM      = 0xffff;
     out[i].Xg      = 0xffff;
+
+    /* XXX add these later */
+    out[i].objID_hi = 0;
+    out[i].objID_lo = 0;
   }
   return (out);
@@ -125,7 +145,9 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].M_PS  = in[i].M*0.001;      
-    out[i].dM_PS = 0xffff;
+    out[i].M     = in[i].M*0.001;      
     out[i].Xm    = in[i].Xm;      
+    out[i].dM    = 0xffff;
+    out[i].Ncode = 0;
+    out[i].Nused = 0;
   }
   return (out);
@@ -141,5 +163,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].M    = in[i].M_PS*1000.0;      
+    out[i].M    = in[i].M*1000.0;      
     out[i].Xm   = in[i].Xm;      
   }
@@ -162,13 +184,13 @@
     out[i].tzero    	    = in[i].tzero;
     out[i].nstar    	    = in[i].nstar;
-    out[i].secz_PS    	    = in[i].secz * 0.001;
+    out[i].secz    	    = in[i].secz * 0.001;
     out[i].NX	    	    = in[i].NX;
     out[i].NY	    	    = in[i].NY;
-    out[i].apmifit_PS  	    = in[i].apmifit * 0.001;
-    out[i].dapmifit_PS 	    = in[i].dapmifit * 0.001;
-    out[i].Mcal_PS	    = in[i].Mcal * 0.001;
-    out[i].dMcal_PS    	    = in[i].dMcal * 0.001;
+    out[i].apmifit  	    = in[i].apmifit * 0.001;
+    out[i].dapmifit 	    = in[i].dapmifit * 0.001;
+    out[i].Mcal	    = in[i].Mcal * 0.001;
+    out[i].dMcal    	    = in[i].dMcal * 0.001;
     out[i].Xm	    	    = in[i].Xm;
-    out[i].source   	    = in[i].source;
+    out[i].photcode   	    = in[i].source;
     out[i].exptime  	    = in[i].exptime;
     out[i].detection_limit  = in[i].detection_limit;
@@ -195,4 +217,8 @@
     out[i].Mxyyy	    = in[i].Mxyyy;
     out[i].Myyyy	    = in[i].Myyyy;
+
+    /* XXX add these later */
+    out[i].imageID_hi = 0;
+    out[i].imageID_lo = 0;
   }
   return (out);
@@ -214,13 +240,13 @@
     out[i].tzero    	    = in[i].tzero;
     out[i].nstar    	    = in[i].nstar;
-    out[i].secz	    	    = in[i].secz_PS * 1000.0;
+    out[i].secz	    	    = in[i].secz * 1000.0;
     out[i].NX	    	    = in[i].NX;
     out[i].NY	    	    = in[i].NY;
-    out[i].apmifit  	    = in[i].apmifit_PS * 1000.0;
-    out[i].dapmifit 	    = in[i].dapmifit_PS * 1000.0;
-    out[i].Mcal	    	    = in[i].Mcal_PS * 1000.0;
-    out[i].dMcal    	    = in[i].dMcal_PS * 1000.0;
+    out[i].apmifit  	    = in[i].apmifit * 1000.0;
+    out[i].dapmifit 	    = in[i].dapmifit * 1000.0;
+    out[i].Mcal	    	    = in[i].Mcal * 1000.0;
+    out[i].dMcal    	    = in[i].dMcal * 1000.0;
     out[i].Xm	    	    = in[i].Xm;
-    out[i].source   	    = in[i].source;
+    out[i].source   	    = in[i].photcode;
     out[i].exptime  	    = in[i].exptime;
     out[i].detection_limit  = in[i].detection_limit;
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_panstarrs.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_panstarrs.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_panstarrs.c	(revision 12008)
@@ -1,5 +1,5 @@
 # include <dvo.h>
 
-/*** note that these structures are identical ***/
+/*** XXX is this format actually used by anyone?? ***/
 
 /* convert panstarrs-format measures to internal measures */
@@ -12,20 +12,38 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR_PS      = in[i].dR;
-    out[i].dD_PS      = in[i].dD;
-    out[i].M_PS       = in[i].M;
-    out[i].dM_PS      = in[i].dM;
-    out[i].Mcal_PS    = in[i].Mcal;
-    out[i].Mgal_PS    = in[i].Mgal;
-    out[i].airmass_PS = in[i].airmass;
-    out[i].dt_PS      = in[i].dt;
+    out[i].dR         = in[i].dR;
+    out[i].dD         = in[i].dD;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].Mgal       = in[i].Mgal;
+    out[i].airmass    = in[i].airmass;
+    out[i].dt         = in[i].dt;
     out[i].FWx 	      = in[i].FWx;
     out[i].FWy 	      = in[i].FWy;
     out[i].theta      = in[i].theta;
     out[i].dophot     = in[i].dophot;
-    out[i].source     = in[i].source;
+    out[i].photcode   = in[i].source;
     out[i].t          = in[i].t;
     out[i].averef     = in[i].averef;
     out[i].flags      = in[i].flags;
+    
+    /* these can be determined if needed / desired */
+    out[i].Xccd     = 0;
+    out[i].Yccd     = 0;
+    out[i].dXccd    = 0;
+    out[i].dYccd    = 0;
+
+    /* these do not have a corresponding value */
+    out[i].stargal  = 0;
+    out[i].Sky      = 0;
+    out[i].dSky     = 0;
+    out[i].qPSF     = 0;
+
+    /* XXX add these later */
+    out[i].detID_hi = 0;
+    out[i].detID_lo = 0;
+    out[i].imageID_hi = 0;
+    out[i].imageID_lo = 0;
   }
   return (out);
@@ -41,17 +59,17 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR 	   = in[i].dR_PS;
-    out[i].dD 	   = in[i].dD_PS;
-    out[i].M       = in[i].M_PS;
-    out[i].dM      = in[i].dM_PS;
-    out[i].Mcal    = in[i].Mcal_PS;
-    out[i].Mgal    = in[i].Mgal_PS;
-    out[i].airmass = in[i].airmass_PS;
-    out[i].dt      = in[i].dt_PS;
+    out[i].dR 	   = in[i].dR;
+    out[i].dD 	   = in[i].dD;
+    out[i].M       = in[i].M;
+    out[i].dM      = in[i].dM;
+    out[i].Mcal    = in[i].Mcal;
+    out[i].Mgal    = in[i].Mgal;
+    out[i].airmass = in[i].airmass;
+    out[i].dt      = in[i].dt;
     out[i].FWx 	   = in[i].FWx;
     out[i].FWy 	   = in[i].FWy;
     out[i].theta   = in[i].theta;
     out[i].dophot  = in[i].dophot;
-    out[i].source  = in[i].source;
+    out[i].source  = in[i].photcode;
     out[i].t       = in[i].t;
     out[i].averef  = in[i].averef;
@@ -92,4 +110,8 @@
     out[i].P       = 0;
     out[i].dP      = 0;
+
+    /* XXX add these later */
+    out[i].objID_hi = 0;
+    out[i].objID_lo = 0;
   }
   return (out);
@@ -130,8 +152,10 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].M_PS    = in[i].M;      
-    out[i].dM_PS   = in[i].dM;      
-    out[i].Xm      = in[i].Xm;     
-  }
+    out[i].M    = in[i].M;      
+    out[i].dM   = in[i].dM;      
+    out[i].Xm      = in[i].Xm;     
+     out[i].Ncode = 0;
+    out[i].Nused = 0;
+ }
   return (out);
 }
@@ -146,6 +170,6 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].M       = in[i].M_PS;      
-    out[i].dM      = in[i].dM_PS;
+    out[i].M       = in[i].M;      
+    out[i].dM      = in[i].dM;
     out[i].Xm      = in[i].Xm;     
   }
@@ -168,13 +192,13 @@
     out[i].tzero    	    = in[i].tzero;
     out[i].nstar    	    = in[i].nstar;
-    out[i].secz_PS	    	    = in[i].secz;
+    out[i].secz	    	    = in[i].secz;
     out[i].NX	    	    = in[i].NX;
     out[i].NY	    	    = in[i].NY;
-    out[i].apmifit_PS  	    = in[i].apmifit;
-    out[i].dapmifit_PS 	    = in[i].dapmifit;
-    out[i].Mcal_PS	    	    = in[i].Mcal;
-    out[i].dMcal_PS    	    = in[i].dMcal;
+    out[i].apmifit  	    = in[i].apmifit;
+    out[i].dapmifit 	    = in[i].dapmifit;
+    out[i].Mcal	    	    = in[i].Mcal;
+    out[i].dMcal    	    = in[i].dMcal;
     out[i].Xm	    	    = in[i].Xm;
-    out[i].source   	    = in[i].source;
+    out[i].photcode   	    = in[i].source;
     out[i].exptime  	    = in[i].exptime;
     out[i].detection_limit  = in[i].detection_limit;
@@ -201,4 +225,8 @@
     out[i].Mxyyy	    = in[i].Mxyyy;
     out[i].Myyyy	    = in[i].Myyyy;
+
+    /* XXX add these later */
+    out[i].imageID_hi = 0;
+    out[i].imageID_lo = 0;
   }
   return (out);
@@ -220,13 +248,13 @@
     out[i].tzero    	    = in[i].tzero;
     out[i].nstar    	    = in[i].nstar;
-    out[i].secz	    	    = in[i].secz_PS;
+    out[i].secz	    	    = in[i].secz;
     out[i].NX	    	    = in[i].NX;
     out[i].NY	    	    = in[i].NY;
-    out[i].apmifit  	    = in[i].apmifit_PS;
-    out[i].dapmifit 	    = in[i].dapmifit_PS;
-    out[i].Mcal	    	    = in[i].Mcal_PS;
-    out[i].dMcal    	    = in[i].dMcal_PS;
+    out[i].apmifit  	    = in[i].apmifit;
+    out[i].dapmifit 	    = in[i].dapmifit;
+    out[i].Mcal	    	    = in[i].Mcal;
+    out[i].dMcal    	    = in[i].dMcal;
     out[i].Xm	    	    = in[i].Xm;
-    out[i].source   	    = in[i].source;
+    out[i].source   	    = in[i].photcode;
     out[i].exptime  	    = in[i].exptime;
     out[i].detection_limit  = in[i].detection_limit;
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_pmtest.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_pmtest.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/dvo_convert_pmtest.c	(revision 12008)
@@ -1,3 +1,91 @@
 # include <dvo.h>
+
+/* convert elixir-format measures to internal measures */
+Measure *MeasureElixirToInternal (MeasureElixir *in, int Nvalues) {
+
+  int i;
+  Measure *out;
+
+  ALLOCATE (out, Measure, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].dR         = in[i].dR;
+    out[i].dD         = in[i].dD;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].dt         = in[i].dt;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].Mgal       = in[i].Mgal;
+    out[i].airmass    = in[i].airmass;
+    out[i].FWx 	      = in[i].FWx;
+    out[i].FWy 	      = in[i].FWy;
+    out[i].theta      = in[i].theta;
+    out[i].dophot     = in[i].dophot;
+    out[i].photcode   = in[i].source;
+    out[i].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].flags      = in[i].flags;
+
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+					    
+    out[i].stargal    = in[i].stargal;
+    out[i].Sky        = in[i].Sky;
+    out[i].dSky       = in[i].dSky;
+    out[i].qPSF       = in[i].qPSF;
+					    
+    out[i].detID_hi   = in[i].detID_hi;
+    out[i].detID_lo   = in[i].detID_lo;
+    out[i].imageID_hi = in[i].imageID_hi;
+    out[i].imageID_lo = in[i].imageID_lo;
+  }
+  return (out);
+}
+
+/* convert internal measures to elixir-format measures */
+MeasureElixir *MeasureInternalToElixir (Measure *in, int Nvalues) {
+
+  int i;
+  MeasureElixir *out;
+
+  ALLOCATE (out, MeasureElixir, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].dR         = in[i].dR;
+    out[i].dD         = in[i].dD;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].dt         = in[i].dt;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].Mgal       = in[i].Mgal;
+    out[i].airmass    = in[i].airmass;
+    out[i].FWx 	      = in[i].FWx;
+    out[i].FWy 	      = in[i].FWy;
+    out[i].theta      = in[i].theta;
+    out[i].dophot     = in[i].dophot;
+    out[i].photcode   = in[i].source;
+    out[i].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].flags      = in[i].flags;
+
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+					    
+    out[i].stargal    = in[i].stargal;
+    out[i].Sky        = in[i].Sky;
+    out[i].dSky       = in[i].dSky;
+    out[i].qPSF       = in[i].qPSF;
+					    
+    out[i].detID_hi   = in[i].detID_hi;
+    out[i].detID_lo   = in[i].detID_lo;
+    out[i].imageID_hi = in[i].imageID_hi;
+    out[i].imageID_lo = in[i].imageID_lo;
+  }
+  return (out);
+}
 
 /* convert panstarrs-format averages to internal averages */
Index: /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/photfits.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/photfits.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/libdvo/src/photfits.c	(revision 12008)
@@ -61,13 +61,13 @@
   switch (image[0].order) {
   case 0:
-    c[0] = image[0].Mcal_PS;
-    return;
-  case 1:
-    c[0] = image[0].Mcal_PS;
+    c[0] = image[0].Mcal;
+    return;
+  case 1:
+    c[0] = image[0].Mcal;
     c[1] = getMi (image[0].Mx);
     c[2] = getMi (image[0].My);
     return;
   case 2:
-    c[0] = image[0].Mcal_PS;
+    c[0] = image[0].Mcal;
     c[1] = getMi (image[0].Mx);
     c[2] = getMi (image[0].Mxx);
@@ -77,5 +77,5 @@
     return;
   case 3:
-    c[0] = image[0].Mcal_PS;
+    c[0] = image[0].Mcal;
     c[1] = getMi (image[0].Mx);
     c[2] = getMi (image[0].Mxx);
@@ -89,5 +89,5 @@
     return;
   case 4:
-    c[0] = image[0].Mcal_PS;
+    c[0] = image[0].Mcal;
     c[1] = getMi (image[0].Mx);
     c[2] = getMi (image[0].Mxx);
@@ -117,13 +117,13 @@
   switch (order) {
   case 0:
-    image[0].Mcal_PS = c[0];
-    return;
-  case 1:
-    image[0].Mcal_PS = c[0];
+    image[0].Mcal = c[0];
+    return;
+  case 1:
+    image[0].Mcal = c[0];
     image[0].Mx    = putMi(c[1]);
     image[0].My    = putMi(c[2]);
     return;
   case 2:
-    image[0].Mcal_PS = c[0];
+    image[0].Mcal = c[0];
     image[0].Mx    = putMi(c[1]);
     image[0].Mxx   = putMi(c[2]);
@@ -133,5 +133,5 @@
     return;
   case 3:
-    image[0].Mcal_PS = c[0];
+    image[0].Mcal = c[0];
     image[0].Mx    = putMi(c[1]);
     image[0].Mxx   = putMi(c[2]);
@@ -145,5 +145,5 @@
     return;
   case 4:
-    image[0].Mcal_PS = c[0];
+    image[0].Mcal = c[0];
     image[0].Mx    = putMi(c[1]);
     image[0].Mxx   = putMi(c[2]);
@@ -162,5 +162,5 @@
     return;
   default:
-    image[0].Mcal_PS = 0.0;
+    image[0].Mcal = 0.0;
     image[0].order = 0;
     return;
Index: /branches/dvo-mods-2007-02/Ohana/src/markstar/src/match_images.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/markstar/src/match_images.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/markstar/src/match_images.c	(revision 12008)
@@ -24,5 +24,5 @@
     start[j] = image[j].tzero - MAX(0.05*image[j].trate*image[j].NY, 1);
     stop[j]  = image[j].tzero + MAX(1.05*image[j].trate*image[j].NY, 1);
-    source[j] = image[j].source;
+    source[j] = image[j].photcode;
   }
 
@@ -36,5 +36,5 @@
       if ((catalog[0].measure[j].t >= start[k]) && 
 	  (catalog[0].measure[j].t <= stop[k])  &&
-	  (catalog[0].measure[j].source == source[k])) {
+	  (catalog[0].measure[j].photcode == source[k])) {
 	catalog[0].image[j] = k;
 	found = TRUE;
@@ -43,5 +43,5 @@
     if (!found) {
       fprintf (stderr, "ERROR: can't find source image for this measurement: %d %d)\n",
-	       catalog[0].measure[j].t, catalog[0].measure[j].source);
+	       catalog[0].measure[j].t, catalog[0].measure[j].photcode);
       exit (0);
     }
Index: /branches/dvo-mods-2007-02/Ohana/src/mosastro/src/getptolemy.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/mosastro/src/getptolemy.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/mosastro/src/getptolemy.c	(revision 12008)
@@ -50,5 +50,5 @@
       stars[k].R = catalog.average[j].R;
       stars[k].D = catalog.average[j].D;
-      stars[k].M = catalog.measure[catalog.average[j].offset].M_PS;
+      stars[k].M = catalog.measure[catalog.average[j].offset].M;
     }      
     dvo_catalog_free (&catalog);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/calextract.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/calextract.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/calextract.c	(revision 12008)
@@ -83,7 +83,7 @@
       dM2 = NO_MAG;
       for (j = 0; j < catalog.average[i].Nm; j++) {
-	if (catalog.measure[m+j].source != code[1][0].code) continue;
+	if (catalog.measure[m+j].photcode != code[1][0].code) continue;
 	M2 = PhotCat  (&catalog.measure[m+j]);
-	dM2 = catalog.measure[m+j].dM_PS;
+	dM2 = catalog.measure[m+j].dM;
       }	
       if (M2 == NO_MAG) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/calmextract.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/calmextract.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/calmextract.c	(revision 12008)
@@ -96,7 +96,7 @@
       dM2 = NO_MAG;
       for (j = 0; j < catalog.average[i].Nm; j++) {
-	if (catalog.measure[m+j].source != code[1][0].code) continue;
+	if (catalog.measure[m+j].photcode != code[1][0].code) continue;
 	M2 = PhotCat  (&catalog.measure[m+j]); 
-	dM2 = catalog.measure[m+j].dM_PS;
+	dM2 = catalog.measure[m+j].dM;
       }	
       if (M2 == NO_MAG) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/catalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/catalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/catalog.c	(revision 12008)
@@ -197,7 +197,7 @@
 	dparse (&D, Ad, tbuffer);
 	dparse (&M, Am, tbuffer);
-	catalog.average[nstar].R_PS = R;
-	catalog.average[nstar].D_PS = D;
-	catalog.average[nstar].M_PS = M;
+	catalog.average[nstar].R = R;
+	catalog.average[nstar].D = D;
+	catalog.average[nstar].M = M;
 	nstar++;
 	if (nstar == NSTARS - 1) {
@@ -239,7 +239,7 @@
 	  dparse (&D, Ad, &tbuffer[i*Bytes_Star]);
 	  dparse (&M, Am, &tbuffer[i*Bytes_Star]);
-	  catalog.average[nstar].R_PS = R;
-	  catalog.average[nstar].D_PS = D;
-	  catalog.average[nstar].M_PS = M;
+	  catalog.average[nstar].R = R;
+	  catalog.average[nstar].D = D;
+	  catalog.average[nstar].M = M;
 	  nstar++;
 	  if (nstar == NSTARS - 1) {
@@ -289,7 +289,7 @@
 	  dparse (&D, 2, &tbuffer[i*BYTES_STAR]);
 	  dparse (&M, 3, &tbuffer[i*BYTES_STAR]);
-	  catalog.average[nstar].R_PS = R;
-	  catalog.average[nstar].D_PS = D;
-	  catalog.average[nstar].M_PS = M;
+	  catalog.average[nstar].R = R;
+	  catalog.average[nstar].D = D;
+	  catalog.average[nstar].M = M;
 	  nstar++;
 	  if (nstar == NSTARS - 1) {
@@ -342,15 +342,15 @@
 	if (IDclip && (catalog.average[i].code != IDchoice))
 	  continue;
-	Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M_PS - Mz) / Mr));
+	Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M - Mz) / Mr));
 	if (LimExclude && (Zvec.elements[N] > 0.99)) continue;
 	if (Zvec.elements[N] < 0.011) continue;
-	while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
-	while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
-	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS, catalog.average[i].D_PS, &graphmode.coords)) N ++;
+	while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
+	while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
+	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N ++;
       }
       break;
     case (NUMSCALE):
       for (N = i = 0; i < catalog.Naverage; i++) {
-	if (clip && ((catalog.average[i].M_PS > Mz) || (catalog.average[i].M_PS < Mr+Mz))) 
+	if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz))) 
 	  continue;
 	if (IDclip && (catalog.average[i].code != IDchoice))
@@ -360,12 +360,12 @@
 	if (Zvec.elements[N] == 0.01) 
 	  continue;
-	while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
-	while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
-	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS, catalog.average[i].D_PS, &graphmode.coords)) N++;
+	while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
+	while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
+	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N++;
       }
       break;
     case (MISSCALE):
       for (N = i = 0; i < catalog.Naverage; i++) {
-	if (clip && ((catalog.average[i].M_PS > Mz) || (catalog.average[i].M_PS < Mr+Mz))) 
+	if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz))) 
 	  continue;
 	if (IDclip && (catalog.average[i].code != IDchoice))
@@ -375,7 +375,7 @@
 	if (Zvec.elements[N] == 0.01) 
 	  continue;
-	while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
-	while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
-	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS, catalog.average[i].D_PS, &graphmode.coords)) N++;
+	while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
+	while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
+	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N++;
       }
       break;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/cmatch.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/cmatch.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/cmatch.c	(revision 12008)
@@ -51,6 +51,6 @@
       dparse (&D, 2, &tbuffer[i*BYTES_STAR]);
       dparse (&M, 3, &tbuffer[i*BYTES_STAR]);
-      catalog2.average[nstar].R_PS = R;
-      catalog2.average[nstar].D_PS = D;
+      catalog2.average[nstar].R = R;
+      catalog2.average[nstar].D = D;
       catalog2.average[nstar].M = M * 1000.0;
       nstar++;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/dmt.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/dmt.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/dmt.c	(revision 12008)
@@ -82,5 +82,5 @@
       if (catalog.average[i].Nm != 3) continue;
       m = catalog.average[i].offset;
-      M0 = (Ns == -1) ? catalog.average[i].M : catalog.secfilt[i*Nsec+Ns].M_PS;
+      M0 = (Ns == -1) ? catalog.average[i].M : catalog.secfilt[i*Nsec+Ns].M;
       M1 = PhotCat (&catalog.measure[m+0]);
       M2 = PhotCat (&catalog.measure[m+1]);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/extract.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/extract.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/extract.c	(revision 12008)
@@ -341,5 +341,5 @@
 	  Ncode = 0;
 	  for (k = 0; k < catalog.average[i].Nm; k++, m++) {
-	    if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].source)) continue;
+	    if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue;
 	    Ncode ++;
 	  }
@@ -357,6 +357,6 @@
 	  Ncode = 0;
 	  for (k = 0; k < catalog.average[i].Nm; k++, m++) {
-	    if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].source)) continue;
-	    if (catalog.measure[m].source & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;
+	    if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue;
+	    if (catalog.measure[m].photcode & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;
 	    Ncode ++;
 	  }
@@ -407,5 +407,5 @@
 	  vec[0].elements[N] = -32;
 	  for (k = 0; k < catalog.average[i].Nm; k++) {
-	    if (catalog.measure[m+k].source == N1) {
+	    if (catalog.measure[m+k].photcode == N1) {
 	      vec[0].elements[N] = PhotCat (&catalog.measure[m+k]);
 	      k = catalog.average[i].Nm;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/fitsed.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/fitsed.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/fitsed.c	(revision 12008)
@@ -203,10 +203,10 @@
       m = catalog.average[i].offset;
       for (j = 0; j < catalog.average[i].Nm; j++) {
-	idx = hashcode[catalog.measure[m+j].source];
+	idx = hashcode[catalog.measure[m+j].photcode];
 	if (idx == -1) continue;
 	// XXX do something more clever if more than one value exists per photcode
-	sourceValue.mags[idx] = catalog.measure[m+j].M_PS + vegaToAB[idx];
-	sourceError.mags[idx] = catalog.measure[m+j].dM_PS;
-	if ((catalog.measure[m+j].source == USNOred) || (catalog.measure[m+j].source == USNOblu)) {
+	sourceValue.mags[idx] = catalog.measure[m+j].M + vegaToAB[idx];
+	sourceError.mags[idx] = catalog.measure[m+j].dM;
+	if ((catalog.measure[m+j].photcode == USNOred) || (catalog.measure[m+j].photcode == USNOblu)) {
 	  sourceError.mags[idx] = 0.3;
 	}
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gimages.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gimages.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gimages.c	(revision 12008)
@@ -81,8 +81,8 @@
     if (PhotCodeSelect) {
       if ((code[0].type == PHOT_REF) || (code[0].type == PHOT_DEP)) {
-	if (code[0].code != image[i].source) continue;
+	if (code[0].code != image[i].photcode) continue;
       } 
       if ((code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {
-	if (code[0].code != GetPhotcodeEquivCodebyCode (image[i].source)) continue;
+	if (code[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue;
       } 
     }      
@@ -104,9 +104,9 @@
     if (PixelCoords) {
       gprint (GP_LOG, "%3d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 
-	       Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS, image[i].exptime, image[i].code);
+	       Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].code);
     } else {
       XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
       gprint (GP_LOG, "%3d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 
-	       Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS, image[i].exptime, image[i].code);
+	       Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].code);
     }
     sprintf (name, "IMAGEx:%d", Nfound);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gstar.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gstar.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gstar.c	(revision 12008)
@@ -170,8 +170,8 @@
 	    date = sec_to_date (catalog.measure[m].t);
 	    gprint (GP_LOG, "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n", 
-		     Mcat, Mrel, catalog.measure[m].dM_PS,
-		     date, catalog.measure[m].dR_PS, catalog.measure[m].dD_PS,
+		     Mcat, Mrel, catalog.measure[m].dM,
+		     date, catalog.measure[m].dR, catalog.measure[m].dD,
 		     catalog.measure[m].dophot, catalog.measure[m].flags,
-		     catalog.measure[m].source, GetPhotcodeNamebyCode (catalog.measure[m].source));
+		     catalog.measure[m].photcode, GetPhotcodeNamebyCode (catalog.measure[m].photcode));
 	    free (date);
 	  }
@@ -180,6 +180,6 @@
 	    vec1[0].elements[N] = Mcat;
 	    vec2[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
-	    vec3[0].elements[N] = catalog.measure[m].airmass_PS;
-	    vec4[0].elements[N] = catalog.measure[m].source;
+	    vec3[0].elements[N] = catalog.measure[m].airmass;
+	    vec4[0].elements[N] = catalog.measure[m].photcode;
 	    N ++;
 	    if (N == NPTS - 1) {
@@ -261,5 +261,5 @@
 	print_value (average[0].M, average[0].M);
       } else {
-	print_value (secfilt[seq].M_PS, secfilt[seq].M_PS);
+	print_value (secfilt[seq].M, secfilt[seq].M);
       }
       break;
@@ -269,5 +269,5 @@
 	print_value (average[0].dM, average[0].dM);
       } else {
-	print_value (secfilt[seq].dM_PS, secfilt[seq].dM_PS);
+	print_value (secfilt[seq].dM, secfilt[seq].dM);
       }
       break;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imdata.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imdata.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imdata.c	(revision 12008)
@@ -137,5 +137,5 @@
 	  if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
 	  n = catalog.measure[i].averef;
-	  vec[0].elements[N] = catalog.average[n].R - catalog.measure[i].dR_PS / 3600.0;
+	  vec[0].elements[N] = catalog.average[n].R - catalog.measure[i].dR / 3600.0;
 	  N++;
 	  CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -146,5 +146,5 @@
 	  if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
 	  n = catalog.measure[i].averef;
-	  vec[0].elements[N] = catalog.average[n].D - catalog.measure[i].dD_PS / 3600.0;
+	  vec[0].elements[N] = catalog.average[n].D - catalog.measure[i].dD / 3600.0;
 	  N++;
 	  CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -154,5 +154,5 @@
 	for (i = 0; i < catalog.Nmeasure; i++) {
 	  if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
-	  vec[0].elements[N] = catalog.measure[i].M_PS;
+	  vec[0].elements[N] = catalog.measure[i].M;
 	  N++;
 	  CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -162,5 +162,5 @@
 	for (i = 0; i < catalog.Nmeasure; i++) {
 	  if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
-	  vec[0].elements[N] = catalog.measure[i].dM_PS;
+	  vec[0].elements[N] = catalog.measure[i].dM;
 	  N++;
 	  CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -170,5 +170,5 @@
 	for (i = 0; i < catalog.Nmeasure; i++) {
 	  if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
-	  vec[0].elements[N] = catalog.measure[i].Mcal_PS;
+	  vec[0].elements[N] = catalog.measure[i].Mcal;
 	  N++;
 	  CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -186,5 +186,5 @@
 	for (i = 0; i < catalog.Nmeasure; i++) {
 	  if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
-	  vec[0].elements[N] = catalog.measure[i].source;
+	  vec[0].elements[N] = catalog.measure[i].photcode;
 	  N++;
 	  CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imextract.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imextract.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imextract.c	(revision 12008)
@@ -114,7 +114,7 @@
     if (PhotcodeSelect) {
       if (code[0].type == PHOT_DEP) {
-	if (code[0].code != image[j].source) continue;
+	if (code[0].code != image[j].photcode) continue;
       } else {
-	if (code[0].code != GetPhotcodeEquivCodebyCode (image[j].source)) continue;
+	if (code[0].code != GetPhotcodeEquivCodebyCode (image[j].photcode)) continue;
       }
     }
@@ -139,14 +139,14 @@
       break;
     case (AIRMASS):
-      vec[0].elements[N] = image[j].secz_PS;
+      vec[0].elements[N] = image[j].secz;
       break;
     case (MCAL):
-      vec[0].elements[N] = image[j].Mcal_PS;
+      vec[0].elements[N] = image[j].Mcal;
       break;
     case (dMCAL):
-      vec[0].elements[N] = image[j].dMcal_PS;
+      vec[0].elements[N] = image[j].dMcal;
       break;
     case (PHOTCODE):
-      vec[0].elements[N] = image[j].source;
+      vec[0].elements[N] = image[j].photcode;
       break;
     case (TIME):
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imlist.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imlist.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imlist.c	(revision 12008)
@@ -77,7 +77,7 @@
     if (PhotcodeSelect) {
       if (PhotcodeValue[0].type == PHOT_DEP) {
-	if (PhotcodeValue[0].code != image[i].source) continue;
+	if (PhotcodeValue[0].code != image[i].photcode) continue;
       } else {
-	if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i].source)) continue;
+	if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue;
       }
     }
@@ -90,5 +90,5 @@
     }
     gprint (GP_LOG, "%3d %s %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n", 
-	     i, image[i].name, r, d, t, image[i].nstar, image[i].source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS);
+	     i, image[i].name, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);
   }
 
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imphot.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imphot.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imphot.c	(revision 12008)
@@ -65,18 +65,18 @@
     switch (image[i].order) {
     case 0:
-      gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal_PS);
+      gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal);
       break;
     case 1:
-      gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My);
+      gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My);
       break;
     case 2:
-      gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy);
+      gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy);
       break;
     case 3:
-      gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, 
+      gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My, 
 	       image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy);
       break;
     case 4:
-      gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, 
+      gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My, 
 	       image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy,
 	       image[i].Mxxxx, image[i].Mxxxy, image[i].Mxxyy, image[i].Mxyyy, image[i].Myyyy);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imstats.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imstats.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imstats.c	(revision 12008)
@@ -45,14 +45,14 @@
   gprint (GP_LOG, "seq  ra (J2000) dec    time (s)   Nstars\n");
   for (i = 0; i < Nimage; i++) {
-    Xvec.elements[i] = image[i].secz_PS;
+    Xvec.elements[i] = image[i].secz;
     if (Mcal) 
-      Yvec.elements[i] = image[i].Mcal_PS;
+      Yvec.elements[i] = image[i].Mcal;
     else 
-      Yvec.elements[i] = image[i].dMcal_PS;
+      Yvec.elements[i] = image[i].dMcal;
     if (!FindMosaicForImage (image, Nimage, i)) continue;
     XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
     gprint (GP_ERR, "%d %8.4f %8.4f %10d %6d  %5.3f %6.3f %6.3f\n", 
 	     i, r, d, image[i].tzero, image[i].nstar, Xvec.elements[i], 
-	     image[i].Mcal_PS, image[i].dMcal_PS);
+	     image[i].Mcal, image[i].dMcal);
   } 
   if (AutoLimits) SetLimits (&Xvec, &Yvec, &graphmode);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lcurve.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lcurve.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lcurve.c	(revision 12008)
@@ -130,5 +130,5 @@
       m = catalog.average[N1[i]].offset;
       for (j = 0; j < catalog.average[N1[i]].Nm; j++, m++) {
-	if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM_PS;
+	if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM;
 	Xvec.elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
 	Yvec.elements[N] = PhotCat (&catalog.measure[m]);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lightcurve.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lightcurve.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lightcurve.c	(revision 12008)
@@ -110,13 +110,13 @@
 	if (PhotCodeSelect) {
 	  if ((code[0].type == PHOT_REF) || (code[0].type == PHOT_DEP)) {
-	    if (code[0].code != catalog.measure[m].source) continue;
+	    if (code[0].code != catalog.measure[m].photcode) continue;
 	  } 
 	  if ((code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {
-	    if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].source)) continue;
+	    if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue;
 	  } 
 	}      
 
 	tvec[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
-	dmvec[0].elements[N] = catalog.measure[m].dM_PS;
+	dmvec[0].elements[N] = catalog.measure[m].dM;
 	if (RELPHOT) {
 	  mvec[0].elements[N] = PhotCat (&catalog.measure[m]);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/match_image.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/match_image.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/match_image.c	(revision 12008)
@@ -30,5 +30,5 @@
 
   for (N = N1; N < N2; N++) {
-    if ((image[N].tzero == T) && (image[N].source == S)) {
+    if ((image[N].tzero == T) && (image[N].photcode == S)) {
       return (N);
     }
@@ -66,5 +66,5 @@
 
   for (N = N1; N < N2; N++) {
-    if ((image[subset[N]].tzero == T) && (image[subset[N]].source == S)) {
+    if ((image[subset[N]].tzero == T) && (image[subset[N]].photcode == S)) {
       return (subset[N]);
     }
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/mextract.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/mextract.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/mextract.c	(revision 12008)
@@ -66,4 +66,6 @@
     dvo_catalog_unlock (&catalog);
 
+    /* XXX need to call dvo_catalog_chipcoords here passing the loaded images */
+
     for (j = 0; j < catalog.Naverage; j++) {
       M1 = NULL;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/paverage.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/paverage.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/paverage.c	(revision 12008)
@@ -116,5 +116,5 @@
       while (average[i].R > Rmax) average[i].R -= 360.0;
 
-      mag = (Nsec == -1) ? average[i].M : secfilt[i*Nsecfilt+Nsec].M_PS;
+      mag = (Nsec == -1) ? average[i].M : secfilt[i*Nsecfilt+Nsec].M;
       Zvec[Npts] = MIN (1.0, MAX (0.01, (mag - Mz) / Mr));
       if (LimExclude && (Zvec[Npts] > 0.99)) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/photometry.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/photometry.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/photometry.c	(revision 12008)
@@ -7,9 +7,9 @@
     case PHOT_DEP: \
     case PHOT_REF: \
-      if (C[0].code != M.source) continue; \
+      if (C[0].code != M.photcode) continue; \
       break; \
     case PHOT_PRI: \
     case PHOT_SEC: \
-      if (C[0].code != GetPhotcodeEquivCodebyCode (M.source)) continue; \
+      if (C[0].code != GetPhotcodeEquivCodebyCode (M.photcode)) continue; \
       break; \
     default: \
@@ -22,5 +22,5 @@
     if (TimeSelect && (M.t < tzero)) continue; \
     if (TimeSelect && (M.t > tend)) continue; \
-    if (ErrSelect  && (M.dM_PS > ErrValue)) continue; \
+    if (ErrSelect  && (M.dM > ErrValue)) continue; \
     if (TypeSelect && (TypeValue != GetMeasureTypeCode (&M))) continue; \
     if (iMagSelect && (PhotInst (&M) < iMagMin)) continue; \
@@ -34,7 +34,7 @@
   if (MODE == MAG_SYS)  MOUT = PhotSys  (&MEAS, average, secfilt); \
   if (MODE == MAG_REL)  MOUT = PhotRel  (&MEAS, average, secfilt); \
-  if (MODE == MAG_CAL)  MOUT = PhotCal  (&MEAS, average, secfilt, measure, GetPhotcodeEquivbyCode (MEAS.source)); \
-  if (MODE == MAG_AVE)  MOUT = PhotAve  (GetPhotcodeEquivbyCode (MEAS.source), average, secfilt); \
-  if (MODE == MAG_REF)  MOUT = PhotRef  (GetPhotcodeEquivbyCode (MEAS.source), average, secfilt, measure); \
+  if (MODE == MAG_CAL)  MOUT = PhotCal  (&MEAS, average, secfilt, measure, GetPhotcodeEquivbyCode (MEAS.photcode)); \
+  if (MODE == MAG_AVE)  MOUT = PhotAve  (GetPhotcodeEquivbyCode (MEAS.photcode), average, secfilt); \
+  if (MODE == MAG_REF)  MOUT = PhotRef  (GetPhotcodeEquivbyCode (MEAS.photcode), average, secfilt, measure); \
   if (ApplySelections[SelectionParam]) { \
     if (MagSelect && (MOUT > MagMax)) continue; \
@@ -676,5 +676,5 @@
       value = 0;
       for (i = 0; i < average[0].Nm; i++) {
-	if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source)) continue;
+	if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue;
 	value ++;
       }
@@ -683,5 +683,5 @@
       value = 0;
       for (i = 0; i < average[0].Nm; i++) {
-	if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source)) continue;
+	if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue;
 	if (measure[i].flags & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;
 	value ++;
@@ -691,6 +691,6 @@
       value = 0;
       for (i = 0; i < average[0].Nm; i++) {
-	if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source))) continue;
-	if (ErrSelect && (measure[i].dM_PS > ErrValue)) continue;
+	if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode))) continue;
+	if (ErrSelect && (measure[i].dM > ErrValue)) continue;
 	if (FlagSelect && (measure[i].flags != FlagValue)) continue;
 	if (TypeSelect && (TypeValue != GetMeasureTypeCode (&measure[i]))) continue;
@@ -711,5 +711,5 @@
   Nt = Nc = 0;
   for (k = 0; k < average[0].Nm; k++) {
-    if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[k].source))) continue;
+    if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[k].photcode))) continue;
     Nc ++;
     if (measure[k].dophot != TypefracType) continue;
@@ -727,5 +727,5 @@
   Nt[0] = Nt[1] = Nt[2] = 0;
   for (k = 0; k < average[0].Nm; k++) {
-    if (code != GetPhotcodeEquivCodebyCode (measure[k].source)) continue;
+    if (code != GetPhotcodeEquivCodebyCode (measure[k].photcode)) continue;
     N = GetMeasureTypeCode (&measure[k]);
     Nt[N] ++;
@@ -1128,20 +1128,20 @@
       break;
     case MEAS_RA: /* OK */
-      value = average[0].R - measure[0].dR_PS / 3600.0;
+      value = average[0].R - measure[0].dR / 3600.0;
       break;
     case MEAS_DEC: /* OK */
-      value = average[0].D - measure[0].dD_PS / 3600.0;
+      value = average[0].D - measure[0].dD / 3600.0;
       break;
     case MEAS_dMAG: /* OK */
-      value = measure[0].dM_PS;
+      value = measure[0].dM;
       break;
     case MEAS_AIRMASS: /* OK */
-      value = measure[0].airmass_PS;
+      value = measure[0].airmass;
       break;
     case MEAS_EXPTIME: /* OK */
-      value = pow (10.0, measure[0].dt_PS * 0.4);
+      value = pow (10.0, measure[0].dt * 0.4);
       break;
     case MEAS_PHOTCODE: /* OK */
-      value = measure[0].source;
+      value = measure[0].photcode;
       break;
     case MEAS_TIME: /* OK */
@@ -1149,8 +1149,8 @@
       break;
     case MEAS_dR: /* OK */
-      value = measure[0].dR_PS;
+      value = measure[0].dR;
       break;
     case MEAS_dD: /* OK */
-      value = measure[0].dD_PS;
+      value = measure[0].dD;
       break;
     case MEAS_FWHM: /* OK */
@@ -1164,23 +1164,33 @@
       break;
     case MEAS_XCCD: /* OK */
-      ra  = average[0].R - measure[0].dR_PS / 3600.0;
-      dec = average[0].D - measure[0].dD_PS / 3600.0;
-      image = MatchImage (measure[0].t, measure[0].source);
+/* I need to perform this conversion for ELIXIR and LONEOS formats on load */      
+# if 0
+      value = measure[0].Xccd;
+# else
+      ra  = average[0].R - measure[0].dR / 3600.0;
+      dec = average[0].D - measure[0].dD / 3600.0;
+      image = MatchImage (measure[0].t, measure[0].photcode);
       if (image == NULL) break;
       RD_to_XY (&x, &y, ra, dec, &image[0].coords);
       value = x;
+# endif
       break;
     case MEAS_YCCD: /* OK */
-      ra  = average[0].R - measure[0].dR_PS / 3600.0;
-      dec = average[0].D - measure[0].dD_PS / 3600.0;
-      image = MatchImage (measure[0].t, measure[0].source);
+/* I need to perform this conversion for ELIXIR and LONEOS formats on load */      
+# if 0
+      value = measure[0].Yccd;
+# else
+      ra  = average[0].R - measure[0].dR / 3600.0;
+      dec = average[0].D - measure[0].dD / 3600.0;
+      image = MatchImage (measure[0].t, measure[0].photcode);
       if (image == NULL) break;
       RD_to_XY (&x, &y, ra, dec, &image[0].coords);
       value = y;
+# endif
       break;
     case MEAS_XMOSAIC: /* OK */
-      ra  = average[0].R - measure[0].dR_PS / 3600.0;
-      dec = average[0].D - measure[0].dD_PS / 3600.0;
-      mosaic = MatchMosaic (measure[0].t, measure[0].source);
+      ra  = average[0].R - measure[0].dR / 3600.0;
+      dec = average[0].D - measure[0].dD / 3600.0;
+      mosaic = MatchMosaic (measure[0].t, measure[0].photcode);
       if (mosaic == NULL) break;
       RD_to_XY (&x, &y, ra, dec, mosaic);
@@ -1188,7 +1198,7 @@
       break;
     case MEAS_YMOSAIC: /* OK */
-      ra  = average[0].R - measure[0].dR_PS / 3600.0;
-      dec = average[0].D - measure[0].dD_PS / 3600.0;
-      mosaic = MatchMosaic (measure[0].t, measure[0].source);
+      ra  = average[0].R - measure[0].dR / 3600.0;
+      dec = average[0].D - measure[0].dD / 3600.0;
+      mosaic = MatchMosaic (measure[0].t, measure[0].photcode);
       if (mosaic == NULL) break;
       RD_to_XY (&x, &y, ra, dec, mosaic);
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/pmeasure.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/pmeasure.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/pmeasure.c	(revision 12008)
@@ -116,16 +116,16 @@
 	  if (!(flags & FlagChoice)) continue;
 	}
-	if ((PhotcodeClip != -1) && (catalog.measure[m+k].source != PhotcodeClip)) continue;
+	if ((PhotcodeClip != -1) && (catalog.measure[m+k].photcode != PhotcodeClip)) continue;
 	mag = PhotCat (&catalog.measure[m+k]);
 	Zvec[Npts] = MIN (1.0, MAX (0.01, (mag - Mz) / Mr));
 	if (LimExclude && (Zvec[Npts] > 0.99)) continue;
 	if (Zvec[Npts] < 0.011) continue;
-	R = catalog.average[i].R - catalog.measure[m+k].dR_PS/3600.0;
-	D = catalog.average[i].D - catalog.measure[m+k].dD_PS/3600.0;
+	R = catalog.average[i].R - catalog.measure[m+k].dR/3600.0;
+	D = catalog.average[i].D - catalog.measure[m+k].dD/3600.0;
 	// XXX drop this check
 	if ((R < Rmin) || (R > Rmax) || (D < -90.0) || (D > 90.0)) {
 	  char *date;
 	  date = sec_to_date (catalog.measure[m+k].t);
-	  gprint (GP_LOG, "out: %f, %f : %s : (%f, %f) + (%f, %f)\n", R, D, date, catalog.average[i].R, catalog.average[i].D, catalog.measure[m+k].dR_PS/3600.0, catalog.measure[m+k].dD_PS/3600.0);
+	  gprint (GP_LOG, "out: %f, %f : %s : (%f, %f) + (%f, %f)\n", R, D, date, catalog.average[i].R, catalog.average[i].D, catalog.measure[m+k].dR/3600.0, catalog.measure[m+k].dD/3600.0);
 	  free (date);
 	}
Index: /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/subpix.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/subpix.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/subpix.c	(revision 12008)
@@ -143,5 +143,5 @@
 	RD_to_XY (&X, &Y, Ra, Dec, &image[I].coords);
 	t = TimeValue (measure[j].t, TimeReference, TimeFormat);
-	gprint (GP_LOG, "%f %6.3f %7.2f %7.2f %5.3f\n", t, Mabs, X, Y, image[I].secz_PS);
+	gprint (GP_LOG, "%f %6.3f %7.2f %7.2f %5.3f\n", t, Mabs, X, Y, image[I].secz);
       } 
     }
Index: /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/find_images.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/find_images.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/find_images.c	(revision 12008)
@@ -38,5 +38,5 @@
 # if (0)
     /* select images by photcode */
-    ecode = GetPhotcodeEquivCodebyCode (timage[i].source);
+    ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode);
     if (ecode != photcode[0].code) continue;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/flag_measures.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/flag_measures.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/flag_measures.c	(revision 12008)
@@ -28,8 +28,8 @@
     n = catalog[0].measure[i].averef;
     Time = catalog[0].measure[i].t;
-    Photcode = catalog[0].measure[i].source;
+    Photcode = catalog[0].measure[i].photcode;
     found = FALSE;
     for (k = 0; !found && (k < Nimage); k++) { 
-      if ((Time == image[k].tzero) && (Photcode == image[k].source)) {
+      if ((Time == image[k].tzero) && (Photcode == image[k].photcode)) {
 	imagelink[i] = k;
 	found = TRUE;
@@ -44,6 +44,6 @@
   for (i = 0; i < catalog[0].Nmeasure; i++) {
     n = catalog[0].measure[i].averef;
-    ra  = catalog[0].average[n].R_PS - catalog[0].measure[i].dR_PS / 3600.0;
-    dec = catalog[0].average[n].D_PS - catalog[0].measure[i].dD_PS / 3600.0;
+    ra  = catalog[0].average[n].R - catalog[0].measure[i].dR / 3600.0;
+    dec = catalog[0].average[n].D - catalog[0].measure[i].dD / 3600.0;
     k = imagelink[i];
     RD_to_XY (&x, &y, ra, dec, &image[k].coords);
@@ -98,5 +98,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
@@ -115,5 +115,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
@@ -130,5 +130,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
@@ -145,5 +145,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
@@ -159,5 +159,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
@@ -172,5 +172,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
@@ -182,5 +182,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/get_mags.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/get_mags.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/get_mags.c	(revision 12008)
@@ -44,5 +44,5 @@
       m = catalog[0].average[i].offset;
       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].source]) < 0) continue;
+	if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue;
 	if (photcodes.code[Ncode].equiv != Photcode) continue;
 	if (photcodes.code[Ncode].type != PHOT_DEP) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/join_stars.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/join_stars.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/join_stars.c	(revision 12008)
@@ -28,6 +28,6 @@
   Rmid = Dmid = 0;
   for (i = 0; i < Naverage; i++) {
-    Rmid += average[i].R_PS;
-    Dmid += average[i].D_PS;
+    Rmid += average[i].R;
+    Dmid += average[i].D;
   }
   Rmid /= Naverage;
@@ -50,5 +50,5 @@
   for (i = 0; i < Naverage; i++) {
     index[i] = i;
-    fRD_to_XY (&X[i], &Y[i], average[i].R_PS, average[i].D_PS, &tcoords);
+    fRD_to_XY (&X[i], &Y[i], average[i].R, average[i].D, &tcoords);
   }
   sort_lists (X, Y, index, Naverage);
@@ -77,6 +77,6 @@
 	mpointer[Nmeas].measure = m;
 	mpointer[Nmeas].averef  = Naves;
-	mpointer[Nmeas].R       = average[Ni].R_PS - measure[m].dR_PS / 3600.0;
-	mpointer[Nmeas].D       = average[Ni].D_PS - measure[m].dD_PS / 3600.0;
+	mpointer[Nmeas].R       = average[Ni].R - measure[m].dR / 3600.0;
+	mpointer[Nmeas].D       = average[Ni].D - measure[m].dD / 3600.0;
 	Nmeas ++;
       }
@@ -113,6 +113,6 @@
 	  mpointer[Nmeas].measure = m;
 	  mpointer[Nmeas].averef  = Ncurr;
-	  mpointer[Nmeas].R       = average[Nj].R_PS - measure[m].dR_PS / 3600.0;
-	  mpointer[Nmeas].D       = average[Nj].D_PS - measure[m].dD_PS / 3600.0;
+	  mpointer[Nmeas].R       = average[Nj].R - measure[m].dR / 3600.0;
+	  mpointer[Nmeas].D       = average[Nj].D - measure[m].dD / 3600.0;
 	  Nmeas ++;
 	}
@@ -130,6 +130,6 @@
 	Sr = Sr / naverage[Ncurr].Nm;
 	Sd = Sd / naverage[Ncurr].Nm;
-	naverage[Ncurr].R_PS = Sr;
-	naverage[Ncurr].D_PS = Sd;
+	naverage[Ncurr].R = Sr;
+	naverage[Ncurr].D = Sd;
 
 	/* update original measurement offsets */
@@ -137,6 +137,6 @@
 	  m = naverage[Ncurr].offset + k;
 	  M = mpointer[m].measure;
-	  measure[M].dR_PS = 3600.0*(Sr - mpointer[m].R);
-	  measure[M].dD_PS = 3600.0*(Sd - mpointer[m].D);
+	  measure[M].dR = 3600.0*(Sr - mpointer[m].R);
+	  measure[M].dD = 3600.0*(Sd - mpointer[m].D);
 	}
 
Index: /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/make_subcatalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/make_subcatalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/make_subcatalog.c	(revision 12008)
@@ -40,5 +40,5 @@
       # if 0
       if (DropPhotcode) {
-	ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].source);
+	ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode);
 	if (ecode == photcode[0].code) continue;
       }
@@ -47,5 +47,5 @@
 
       /* exclude measurements by measurement error */
-      if (SIGMA_MAX && (catalog[0].measure[offset].dM_PS > SIGMA_MAX)) continue;
+      if (SIGMA_MAX && (catalog[0].measure[offset].dM > SIGMA_MAX)) continue;
 
       /* select measurements by mag limit */
Index: /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/unique_measures.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/unique_measures.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/photdbc/src/unique_measures.c	(revision 12008)
@@ -60,6 +60,6 @@
       }
       
-      dR = (catalog[0].measure[ilist[j]].dR_PS - catalog[0].measure[ilist[k]].dR_PS);
-      dD = (catalog[0].measure[ilist[j]].dD_PS - catalog[0].measure[ilist[k]].dD_PS);
+      dR = (catalog[0].measure[ilist[j]].dR - catalog[0].measure[ilist[k]].dR);
+      dD = (catalog[0].measure[ilist[j]].dD - catalog[0].measure[ilist[k]].dD);
       R = SQ(dR) + SQ(dD);
       
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/GridOps.v1.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/GridOps.v1.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/GridOps.v1.c	(revision 12008)
@@ -331,5 +331,5 @@
   for (i = 0; i < Nimage; i++) {
     image = getimage (imlist[i]);
-    pname = GetPhotcodeNamebyCode (image[0].source);
+    pname = GetPhotcodeNamebyCode (image[0].photcode);
 
     /* this is kind of bogus... */
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/GridOps.v2.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/GridOps.v2.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/GridOps.v2.c	(revision 12008)
@@ -278,5 +278,5 @@
       Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
       list[N] = Msys - Mrel - Mcal - Mmos;
-      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
       N++;
     }
@@ -439,5 +439,5 @@
   for (i = 0; i < Nimage; i++) {
     image = getimage (imlist[i]);
-    pname = GetPhotcodeNamebyCode (image[0].source);
+    pname = GetPhotcodeNamebyCode (image[0].photcode);
 
     /* this is kind of bogus... */
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/ImageOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/ImageOps.c	(revision 12008)
@@ -75,5 +75,5 @@
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Nmeasure; j++) {
-      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);
       if (photcode[0].code != ecode) continue;
       matchImage (catalog, j, i);
@@ -91,6 +91,6 @@
   measure = &catalog[cat].measure[meas];
   for (i = 0; i < Nimage; i++) {
-    if (image[0].source == -1) continue;
-    if (measure[0].source != image[i].source) continue;
+    if (image[0].photcode == -1) continue;
+    if (measure[0].photcode != image[i].photcode) continue;
     if (measure[0].t < start[i]) continue;
     if (measure[0].t > stop[i]) continue;
@@ -100,5 +100,5 @@
 
       /* identify the ccd on the basis of the photcode name */
-      pname = GetPhotcodeNamebyCode (image[i].source);
+      pname = GetPhotcodeNamebyCode (image[i].photcode);
       filter = photcode[0].name;
       sprintf (base, "%s.%s.", MOSAICNAME, filter);
@@ -111,6 +111,6 @@
       /* add this measurement to the grid cell for this chip */
       ave = measure[0].averef;
-      ra  = catalog[cat].average[ave].R - measure[0].dR_PS / 3600.0;
-      dec = catalog[cat].average[ave].D - measure[0].dD_PS / 3600.0;
+      ra  = catalog[cat].average[ave].R - measure[0].dR / 3600.0;
+      dec = catalog[cat].average[ave].D - measure[0].dD / 3600.0;
        
       /* X,Y always positive-definite in range 0,0 - dX, dY */
@@ -133,5 +133,5 @@
     return;
   }
-  /*  fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0].source); */
+  /*  fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0].photcode); */
 }
 
@@ -145,5 +145,5 @@
 
   if (image[i].code & IMAGE_BAD)  return (NO_MAG);  
-  value = image[i].Mcal_PS;
+  value = image[i].Mcal;
   return (value);
 }
@@ -201,5 +201,5 @@
       Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
       list[N] = Msys - Mrel - Mmos - Mgrid;
-      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
       N++;
     }
@@ -217,6 +217,6 @@
     
     liststats (list, dlist, N, &stats);
-    image[i].Mcal_PS  = stats.mean;
-    image[i].dMcal_PS = stats.sigma;
+    image[i].Mcal  = stats.mean;
+    image[i].dMcal = stats.sigma;
     image[i].Xm    = 100.0*log10(stats.chisq);
   }
@@ -249,6 +249,6 @@
   for (i = N = 0; i < Nimage; i++) {
     if (image[i].code & IMAGE_BAD) continue;
-    mlist[N] = fabs (image[i].Mcal_PS);
-    slist[N] = image[i].dMcal_PS;
+    mlist[N] = fabs (image[i].Mcal);
+    slist[N] = image[i].dMcal;
     dlist[N] = 1;
     N++;
@@ -266,5 +266,5 @@
     mark = FALSE;
     image[i].code &= ~ID_IMAGE_POOR;
-    mark = (image[i].dMcal_PS > MaxScatter) || (fabs(image[i].Mcal_PS - MedOffset) > MaxOffset);
+    mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].Mcal - MedOffset) > MaxOffset);
     if (mark) { 
       Nmark ++;
@@ -296,7 +296,7 @@
   /**** dMcal vs airmass ****/
   for (i = 0; i < Nimage; i++) {
-    Mlist[i] = image[i].Mcal_PS;
-    dlist[i] = image[i].dMcal_PS;
-    xlist[i] = image[i].secz_PS;
+    Mlist[i] = image[i].Mcal;
+    dlist[i] = image[i].dMcal;
+    xlist[i] = image[i].secz;
   }
 
@@ -316,5 +316,5 @@
   bzero (Mlist, NBIN*sizeof(double));
   for (i = 0; i < Nimage; i++) {
-    bin = image[i].dMcal_PS / 0.00025;
+    bin = image[i].dMcal / 0.00025;
     bin = MAX (0, MIN (NBIN - 1, bin));
     Mlist[bin] += 1.0;
@@ -413,5 +413,5 @@
     if (image[i].code & IMAGE_BAD)  continue;
 
-    list[n] = image[i].Mcal_PS;
+    list[n] = image[i].Mcal;
     dlist[n] = 1;
     n++;
@@ -441,5 +441,5 @@
     if (image[i].code & IMAGE_BAD)  continue;
 
-    list[n] = image[i].dMcal_PS;
+    list[n] = image[i].dMcal;
     dlist[n] = 1;
     n++;
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/MosaicOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/MosaicOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/MosaicOps.c	(revision 12008)
@@ -36,5 +36,5 @@
 
     /* select valid mosaic images by photcode */
-    pname = GetPhotcodeNamebyCode (image[i].source);
+    pname = GetPhotcodeNamebyCode (image[i].photcode);
     status = strncmp (pname, MOSAICNAME, strlen (MOSAICNAME));
     if (status) continue;
@@ -69,5 +69,5 @@
     mosaic[Nmosaic].Xm    = 0.0;
     mosaic[Nmosaic].code  = image[i].code;
-    mosaic[Nmosaic].secz  = image[i].secz_PS;
+    mosaic[Nmosaic].secz  = image[i].secz;
 
     /* add image to mosaic image list */
@@ -134,10 +134,10 @@
       Dmin = MIN (Dmin, D);
       Dmax = MAX (Dmax, D);
-      Mcal += image[m].Mcal_PS;
-      dMcal += image[m].dMcal_PS;
+      Mcal += image[m].Mcal;
+      dMcal += image[m].dMcal;
       Xm += image[m].Xm;
       /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */
-      image[m].Mcal_PS = 0.0;
-      image[m].dMcal_PS = image[m].Xm = NO_MAG;
+      image[m].Mcal = 0.0;
+      image[m].dMcal = image[m].Xm = NO_MAG;
     }
     dS /= Nimlist[i];
@@ -179,6 +179,6 @@
     for (j = 0; j < Nimlist[i]; j++) {
       im = imlist[i][j];
-      image[im].Mcal_PS = mosaic[i].Mcal;
-      image[im].dMcal_PS = mosaic[i].dMcal;
+      image[im].Mcal = mosaic[i].Mcal;
+      image[im].dMcal = mosaic[i].dMcal;
       image[im].Xm = mosaic[i].Xm;
       image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);
@@ -247,5 +247,5 @@
 	if (catalog[i].measure[j].t > TSTOP) continue;
       }
-      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);
       if (photcode[0].code != ecode) continue;
       matchMosaics (catalog, j, i);
@@ -266,6 +266,6 @@
     if (USE_GRID) {
       ave = catalog[cat].measure[meas].averef;
-      ra  = catalog[cat].average[ave].R_PS - catalog[cat].measure[meas].dR_PS / 3600.0;
-      dec = catalog[cat].average[ave].D_PS - catalog[cat].measure[meas].dD_PS / 3600.0;
+      ra  = catalog[cat].average[ave].R - catalog[cat].measure[meas].dR / 3600.0;
+      dec = catalog[cat].average[ave].D - catalog[cat].measure[meas].dD / 3600.0;
 
       /* X,Y always positive-definite in range 0,0 - dX, dY */
@@ -353,5 +353,5 @@
       Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
       list[N]  = Msys - Mrel - Mcal - Mgrid;
-      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
       Mlist[N] = Msys;
       dMlist[N] = list[N];
@@ -591,6 +591,6 @@
 
       ave = catalog[c].measure[m].averef;
-      xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR_PS / 3600.0;
-      ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD_PS / 3600.0;
+      xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR / 3600.0;
+      ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD / 3600.0;
       N++;
     }
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/StarOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/StarOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/StarOps.c	(revision 12008)
@@ -28,5 +28,5 @@
   if (catalog[cat].average[ave].code & STAR_BAD) return (NO_MAG);  
  
-  value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M_PS;
+  value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M;
   return (value);
 }
@@ -54,5 +54,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
@@ -70,6 +70,6 @@
 	catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       } else {
-	catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS  = stats.mean;
-	catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = stats.sigma;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma;
 	catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       }      
@@ -112,5 +112,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
@@ -126,6 +126,6 @@
 	catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       } else {
-	catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS  = stats.mean;
-	catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = MAX (stats.error, stats.sigma);
+	catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].dM = MAX (stats.error, stats.sigma);
 	catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       }      
@@ -156,5 +156,5 @@
 	if ((Mmos  = getMmos  (m, i)) == NO_MAG) continue;
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
-	catalog[i].measure[m].Mcal_PS = Mcal + Mmos + Mgrid;
+	catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
       }
     }
@@ -187,5 +187,5 @@
       Chisq = pow (10.0, 0.01*Xm);
       xlist[Ntot] = Chisq;
-      slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       dlist[Ntot] = 1;
       Ntot ++;
@@ -203,5 +203,5 @@
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Naverage; j++) {
-      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       Xm = PhotPrimary ? catalog[i].average[j].Xm    : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
       Chisq = pow (10.0, 0.01*Xm);
@@ -269,5 +269,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
@@ -301,5 +301,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	ilist[N] = m;
 	N++;
@@ -423,5 +423,5 @@
       if (catalog[i].average[j].code & STAR_BAD) continue;  
 
-      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       list[n] = dM;
       dlist[n] = 1;
@@ -452,5 +452,5 @@
     for (j = 0; j < catalog[i].Naverage; j++) {
       if (catalog[i].average[j].code & STAR_BAD) continue;  
-      dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       bin = dMrel / 0.00025;
       bin = MAX (0, MIN (NBIN-1, bin));
@@ -483,5 +483,5 @@
     for (j = 0; j < catalog[i].Naverage; j++) {
       if (catalog[i].average[j].code & STAR_BAD) continue;
-      xlist[N] = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
+      xlist[N] = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M;
       value    = PhotPrimary ? catalog[i].average[j].Xm   : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
       if (value == NO_MAG) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateImages.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateImages.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateImages.c	(revision 12008)
@@ -42,6 +42,6 @@
 	/* the astrometric errors are not being carried yet (but should be!) */
 	/* we use the photometric mag error as a weighting term */
-	dlistR[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
-	dlistD[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlistR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
+	dlistD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateObjects.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateObjects.c	(revision 12008)
@@ -42,6 +42,6 @@
 	/* the astrometric errors are not being carried yet (but should be!) */
 	/* we use the photometric mag error as a weighting term */
-	dlistR[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
-	dlistD[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlistR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
+	dlistD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/bcatalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/bcatalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/bcatalog.c	(revision 12008)
@@ -35,7 +35,7 @@
     if (RESET) {
       float *p;
-      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M_PS;
+      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM_PS;
+      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM;
       *p = NO_MAG;
       subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW;
@@ -49,5 +49,5 @@
 
       /* select measurements by photcode */
-      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode);
       if (ecode != photcode[0].code) continue;
 
@@ -66,5 +66,5 @@
 
       /* select measurements by measurement error */
-      if (catalog[0].measure[offset].dM_PS > SIGMA_LIM) continue;
+      if (catalog[0].measure[offset].dM > SIGMA_LIM) continue;
 
       /* select measurements by mag limit */
@@ -79,5 +79,5 @@
       subcatalog[0].measure[Nmeasure].averef = Naverage;
       if (RESET) { 
-	subcatalog[0].measure[Nmeasure].Mcal_PS = 0;
+	subcatalog[0].measure[Nmeasure].Mcal = 0;
 	subcatalog[0].measure[Nmeasure].flags &= 0xff00;
 	subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR;
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/plot_scatter.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/plot_scatter.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/plot_scatter.c	(revision 12008)
@@ -32,5 +32,5 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
+	Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M;
 	xlist[N] = Mrel;
 	ylist[N] = PhotSys  (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel;
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/plotstuff.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/plotstuff.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/plotstuff.c	(revision 12008)
@@ -49,5 +49,5 @@
   if (Xgraph[N] == 0) return;
 
-  KiiPS (Xgraph[N], TRUE, KAPA_PS_NEWPLOT, filename);
+  KiiPS (Xgraph[N], TRUE, KAPA_NEWPLOT, filename);
   return;
 }
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/select_images.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/select_images.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/select_images.c	(revision 12008)
@@ -76,5 +76,5 @@
       
     /* exclude images by photcode */
-    ecode = GetPhotcodeEquivCodebyCode (timage[i].source);
+    ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode);
     if (ecode != photcode[0].code) continue;
 
@@ -135,5 +135,5 @@
       if (RESET) {
 	assignMcal (&image[nimage], (double *) NULL, -1);
-	image[nimage].dMcal_PS = NO_MAG;
+	image[nimage].dMcal = NO_MAG;
 	image[nimage].code &= ~ID_IMAGE_POOR;
       }
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/setExclusions.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/setExclusions.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/setExclusions.c	(revision 12008)
@@ -14,5 +14,5 @@
 
 	/* select measurements by photcode */
-	ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].source);
+	ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].photcode);
 	if (ecode != photcode[0].code) goto mark_nocal;
 	
@@ -25,6 +25,6 @@
 	/* select measurements by mag limit */
 	if (AreaSelect) {
-	  r = catalog[i].average[j].R + catalog[i].measure[m].dR_PS / 3600.0;
-	  d = catalog[i].average[j].D + catalog[i].measure[m].dD_PS / 3600.0;
+	  r = catalog[i].average[j].R + catalog[i].measure[m].dR / 3600.0;
+	  d = catalog[i].average[j].D + catalog[i].measure[m].dD / 3600.0;
 	  if ((coords = getCoords (m, i)) == NULL) goto markbad;
 	  RD_to_XY (&x, &y, r, d, coords);
Index: /branches/dvo-mods-2007-02/Ohana/src/relastro/src/setMrelFinal.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relastro/src/setMrelFinal.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relastro/src/setMrelFinal.c	(revision 12008)
@@ -11,7 +11,7 @@
 
     for (i = 0; i < catalog[0].Naverage; i++) {
-      p = (PhotPrimary) ? &catalog[0].average[i].M  : &catalog[0].secfilt[PhotNsec*i+PhotSec].M_PS;
+      p = (PhotPrimary) ? &catalog[0].average[i].M  : &catalog[0].secfilt[PhotNsec*i+PhotSec].M;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM_PS;
+      p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM;
       *p = NO_MAG;
       q = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm;
@@ -22,5 +22,5 @@
 	
 	/* select measurements by photcode */
-	ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].source);
+	ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode);
 	if (ecode != photcode[0].code) continue;
 	
@@ -31,5 +31,5 @@
 	}
 	
-	catalog[0].measure[m].Mcal_PS = 0;
+	catalog[0].measure[m].Mcal = 0;
 	catalog[0].measure[m].flags &= 0xff00;
 	catalog[0].measure[m].flags &= ~ID_MEAS_POOR;
@@ -97,5 +97,5 @@
       /** never use these measurements (wrong photcode, bad time range) */
       /* skipped via NOCAL, don't mark as skipped */
-      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode);
       if (ecode != photcode[0].code) continue;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/GridOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/GridOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/GridOps.c	(revision 12008)
@@ -282,5 +282,5 @@
       Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
       list[N] = Msys - Mrel - Mcal - Mmos;
-      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
       N++;
     }
@@ -447,5 +447,5 @@
   for (i = 0; i < Nimage; i++) {
     image = getimage (imlist[i]);
-    pname = GetPhotcodeNamebyCode (image[0].source);
+    pname = GetPhotcodeNamebyCode (image[0].photcode);
 
     /* this is kind of bogus... */
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/ImageOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/ImageOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/ImageOps.c	(revision 12008)
@@ -75,5 +75,5 @@
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Nmeasure; j++) {
-      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);
       if (photcode[0].code != ecode) continue;
       matchImage (catalog, j, i);
@@ -82,4 +82,6 @@
 }
 
+/* XXX convert this to use the values of measure->Xccd,Yccd */
+/* XXX need to apply the conversion for ELIXIR and LONEOS formats */
 void matchImage (Catalog *catalog, int meas, int cat) {
 
@@ -91,6 +93,6 @@
   measure = &catalog[cat].measure[meas];
   for (i = 0; i < Nimage; i++) {
-    if (image[0].source == -1) continue;
-    if (measure[0].source != image[i].source) continue;
+    if (image[0].photcode == -1) continue;
+    if (measure[0].photcode != image[i].photcode) continue;
     if (measure[0].t < start[i]) continue;
     if (measure[0].t > stop[i]) continue;
@@ -100,5 +102,5 @@
 
       /* identify the ccd on the basis of the photcode name */
-      pname = GetPhotcodeNamebyCode (image[i].source);
+      pname = GetPhotcodeNamebyCode (image[i].photcode);
       filter = photcode[0].name;
       sprintf (base, "%s.%s.", MOSAICNAME, filter);
@@ -111,6 +113,6 @@
       /* add this measurement to the grid cell for this chip */
       ave = measure[0].averef;
-      ra  = catalog[cat].average[ave].R - measure[0].dR_PS / 3600.0;
-      dec = catalog[cat].average[ave].D - measure[0].dD_PS / 3600.0;
+      ra  = catalog[cat].average[ave].R - measure[0].dR / 3600.0;
+      dec = catalog[cat].average[ave].D - measure[0].dD / 3600.0;
        
       /* X,Y always positive-definite in range 0,0 - dX, dY */
@@ -133,5 +135,5 @@
     return;
   }
-  /*  fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0].source); */
+  /*  fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0].photcode); */
 }
 
@@ -145,5 +147,5 @@
 
   if (image[i].code & IMAGE_BAD)  return (NO_MAG);  
-  value = image[i].Mcal_PS;
+  value = image[i].Mcal;
   return (value);
 }
@@ -203,5 +205,5 @@
       Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
       list[N] = Msys - Mrel - Mmos - Mgrid;
-      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
       N++;
     }
@@ -219,6 +221,6 @@
     
     liststats (list, dlist, N, &stats);
-    image[i].Mcal_PS  = stats.mean;
-    image[i].dMcal_PS = stats.sigma;
+    image[i].Mcal  = stats.mean;
+    image[i].dMcal = stats.sigma;
     image[i].Xm    = 100.0*log10(stats.chisq);
   }
@@ -251,6 +253,6 @@
   for (i = N = 0; i < Nimage; i++) {
     if (image[i].code & IMAGE_BAD) continue;
-    mlist[N] = fabs (image[i].Mcal_PS);
-    slist[N] = image[i].dMcal_PS;
+    mlist[N] = fabs (image[i].Mcal);
+    slist[N] = image[i].dMcal;
     dlist[N] = 1;
     N++;
@@ -268,5 +270,5 @@
     mark = FALSE;
     image[i].code &= ~ID_IMAGE_POOR;
-    mark = (image[i].dMcal_PS > MaxScatter) || (fabs(image[i].Mcal_PS - MedOffset) > MaxOffset);
+    mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].Mcal - MedOffset) > MaxOffset);
     if (mark) { 
       Nmark ++;
@@ -298,7 +300,7 @@
   /**** dMcal vs airmass ****/
   for (i = 0; i < Nimage; i++) {
-    Mlist[i] = image[i].Mcal_PS;
-    dlist[i] = image[i].dMcal_PS;
-    xlist[i] = image[i].secz_PS;
+    Mlist[i] = image[i].Mcal;
+    dlist[i] = image[i].dMcal;
+    xlist[i] = image[i].secz;
   }
 
@@ -318,5 +320,5 @@
   bzero (Mlist, NBIN*sizeof(double));
   for (i = 0; i < Nimage; i++) {
-    bin = image[i].dMcal_PS / 0.00025;
+    bin = image[i].dMcal / 0.00025;
     bin = MAX (0, MIN (NBIN - 1, bin));
     Mlist[bin] += 1.0;
@@ -420,5 +422,5 @@
     if (image[i].code & IMAGE_BAD)  continue;
 
-    list[n] = image[i].Mcal_PS;
+    list[n] = image[i].Mcal;
     dlist[n] = 1;
     n++;
@@ -448,5 +450,5 @@
     if (image[i].code & IMAGE_BAD)  continue;
 
-    list[n] = image[i].dMcal_PS;
+    list[n] = image[i].dMcal;
     dlist[n] = 1;
     n++;
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/MosaicOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/MosaicOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/MosaicOps.c	(revision 12008)
@@ -36,5 +36,5 @@
 
     /* select valid mosaic images by photcode */
-    pname = GetPhotcodeNamebyCode (image[i].source);
+    pname = GetPhotcodeNamebyCode (image[i].photcode);
     status = strncmp (pname, MOSAICNAME, strlen (MOSAICNAME));
     if (status) continue;
@@ -69,5 +69,5 @@
     mosaic[Nmosaic].Xm    = 0.0;
     mosaic[Nmosaic].code  = image[i].code;
-    mosaic[Nmosaic].secz  = image[i].secz_PS;
+    mosaic[Nmosaic].secz  = image[i].secz;
 
     /* add image to mosaic image list */
@@ -134,10 +134,10 @@
       Dmin = MIN (Dmin, D);
       Dmax = MAX (Dmax, D);
-      Mcal += image[m].Mcal_PS;
-      dMcal += image[m].dMcal_PS;
+      Mcal += image[m].Mcal;
+      dMcal += image[m].dMcal;
       Xm += image[m].Xm;
       /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */
-      image[m].Mcal_PS = 0.0;
-      image[m].dMcal_PS = image[m].Xm = NO_MAG;
+      image[m].Mcal = 0.0;
+      image[m].dMcal = image[m].Xm = NO_MAG;
     }
     dS /= Nimlist[i];
@@ -179,6 +179,6 @@
     for (j = 0; j < Nimlist[i]; j++) {
       im = imlist[i][j];
-      image[im].Mcal_PS = mosaic[i].Mcal;
-      image[im].dMcal_PS = mosaic[i].dMcal;
+      image[im].Mcal = mosaic[i].Mcal;
+      image[im].dMcal = mosaic[i].dMcal;
       image[im].Xm = mosaic[i].Xm;
       image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);
@@ -247,5 +247,5 @@
 	if (catalog[i].measure[j].t > TSTOP) continue;
       }
-      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);
       if (photcode[0].code != ecode) continue;
       matchMosaics (catalog, j, i);
@@ -266,6 +266,6 @@
     if (USE_GRID) {
       ave = catalog[cat].measure[meas].averef;
-      ra  = catalog[cat].average[ave].R_PS - catalog[cat].measure[meas].dR_PS / 3600.0;
-      dec = catalog[cat].average[ave].D_PS - catalog[cat].measure[meas].dD_PS / 3600.0;
+      ra  = catalog[cat].average[ave].R - catalog[cat].measure[meas].dR / 3600.0;
+      dec = catalog[cat].average[ave].D - catalog[cat].measure[meas].dD / 3600.0;
 
       /* X,Y always positive-definite in range 0,0 - dX, dY */
@@ -355,5 +355,5 @@
       Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
       list[N]  = Msys - Mrel - Mcal - Mgrid;
-      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
       Mlist[N] = Msys;
       dMlist[N] = list[N];
@@ -596,6 +596,6 @@
 
       ave = catalog[c].measure[m].averef;
-      xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR_PS / 3600.0;
-      ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD_PS / 3600.0;
+      xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR / 3600.0;
+      ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD / 3600.0;
       N++;
     }
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/StarOps.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/StarOps.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/StarOps.c	(revision 12008)
@@ -28,5 +28,5 @@
   if (catalog[cat].average[ave].code & STAR_BAD) return (NO_MAG);  
  
-  value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M_PS;
+  value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M;
   return (value);
 }
@@ -65,5 +65,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
@@ -81,6 +81,6 @@
 	catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       } else {
-	catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS  = stats.mean;
-	catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = stats.sigma;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma;
 	catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       }      
@@ -130,5 +130,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
@@ -144,6 +144,6 @@
 	catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       } else {
-	catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS  = stats.mean;
-	catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = MAX (stats.error, stats.sigma);
+	catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].dM = MAX (stats.error, stats.sigma);
 	catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       }      
@@ -178,5 +178,5 @@
 	if (Mmos == NO_IMAGE) continue;
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
-	catalog[i].measure[m].Mcal_PS = Mcal + Mmos + Mgrid;
+	catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
       }
     }
@@ -209,5 +209,5 @@
       Chisq = pow (10.0, 0.01*Xm);
       xlist[Ntot] = Chisq;
-      slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       dlist[Ntot] = 1;
       Ntot ++;
@@ -225,5 +225,5 @@
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Naverage; j++) {
-      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       Xm = PhotPrimary ? catalog[i].average[j].Xm    : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
       Chisq = pow (10.0, 0.01*Xm);
@@ -295,5 +295,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	N++;
       }
@@ -331,5 +331,5 @@
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
 	list[N] = Msys - Mcal - Mmos - Mgrid;
-	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
 	ilist[N] = m;
 	N++;
@@ -458,5 +458,5 @@
       if (catalog[i].average[j].code & STAR_BAD) continue;  
 
-      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       list[n] = dM;
       dlist[n] = 1;
@@ -487,5 +487,5 @@
     for (j = 0; j < catalog[i].Naverage; j++) {
       if (catalog[i].average[j].code & STAR_BAD) continue;  
-      dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
       bin = dMrel / 0.00025;
       bin = MAX (0, MIN (NBIN-1, bin));
@@ -518,5 +518,5 @@
     for (j = 0; j < catalog[i].Naverage; j++) {
       if (catalog[i].average[j].code & STAR_BAD) continue;
-      xlist[N] = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
+      xlist[N] = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M;
       value    = PhotPrimary ? catalog[i].average[j].Xm   : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
       if (value == NO_MAG) continue;
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/bcatalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/bcatalog.c	(revision 12008)
@@ -28,7 +28,7 @@
     if (RESET) {
       float *p;
-      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M_PS;
+      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM_PS;
+      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM;
       *p = NO_MAG;
       subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW;
@@ -42,5 +42,5 @@
 
       /* select measurements by photcode */
-      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode);
       if (ecode != photcode[0].code) continue;
 
@@ -60,5 +60,5 @@
 
       /* select measurements by measurement error */
-      if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM_PS > SIGMA_LIM)) continue;
+      if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) continue;
 
       /* select measurements by mag limit */
@@ -73,5 +73,5 @@
       subcatalog[0].measure[Nmeasure].averef = Naverage;
       if (RESET) { 
-	subcatalog[0].measure[Nmeasure].Mcal_PS = 0;
+	subcatalog[0].measure[Nmeasure].Mcal = 0;
 	subcatalog[0].measure[Nmeasure].flags &= 0xff00;
 	subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR;
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/plot_scatter.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/plot_scatter.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/plot_scatter.c	(revision 12008)
@@ -36,5 +36,5 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
+	Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M;
 	xlist[N] = Mrel;
 	ylist[N] = PhotSys  (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel;
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/relphot.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/relphot.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/relphot.c	(revision 12008)
@@ -44,4 +44,6 @@
   /* load catalog data from region files */
   catalog = load_catalogs (skylist, &Ncatalog);
+  
+  /* add in a loop over the catalogs calling dvo_catalog_chipcoords */
 
   /* match measurements with images, mosaics */
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/select_images.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/select_images.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/select_images.c	(revision 12008)
@@ -76,5 +76,5 @@
       
     /* exclude images by photcode */
-    ecode = GetPhotcodeEquivCodebyCode (timage[i].source);
+    ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode);
     if (ecode != photcode[0].code) continue;
 
@@ -135,5 +135,5 @@
       if (RESET) {
 	assignMcal (&image[nimage], (double *) NULL, -1);
-	image[nimage].dMcal_PS = NO_MAG;
+	image[nimage].dMcal = NO_MAG;
 	image[nimage].code &= ~ID_IMAGE_POOR;
       }
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/setExclusions.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/setExclusions.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/setExclusions.c	(revision 12008)
@@ -14,5 +14,5 @@
 
 	/* select measurements by photcode */
-	ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].source);
+	ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].photcode);
 	if (ecode != photcode[0].code) goto mark_nocal;
 	
@@ -25,6 +25,6 @@
 	/* select measurements by mag limit */
 	if (AreaSelect) {
-	  r = catalog[i].average[j].R + catalog[i].measure[m].dR_PS / 3600.0;
-	  d = catalog[i].average[j].D + catalog[i].measure[m].dD_PS / 3600.0;
+	  r = catalog[i].average[j].R + catalog[i].measure[m].dR / 3600.0;
+	  d = catalog[i].average[j].D + catalog[i].measure[m].dD / 3600.0;
 	  if ((coords = getCoords (m, i)) == NULL) goto markbad;
 	  RD_to_XY (&x, &y, r, d, coords);
Index: /branches/dvo-mods-2007-02/Ohana/src/relphot/src/setMrelFinal.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/relphot/src/setMrelFinal.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/relphot/src/setMrelFinal.c	(revision 12008)
@@ -11,7 +11,7 @@
 
     for (i = 0; i < catalog[0].Naverage; i++) {
-      p = (PhotPrimary) ? &catalog[0].average[i].M  : &catalog[0].secfilt[PhotNsec*i+PhotSec].M_PS;
+      p = (PhotPrimary) ? &catalog[0].average[i].M  : &catalog[0].secfilt[PhotNsec*i+PhotSec].M;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM_PS;
+      p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM;
       *p = NO_MAG;
       q = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm;
@@ -22,5 +22,5 @@
 	
 	/* select measurements by photcode */
-	ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].source);
+	ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode);
 	if (ecode != photcode[0].code) continue;
 	
@@ -31,5 +31,5 @@
 	}
 	
-	catalog[0].measure[m].Mcal_PS = 0;
+	catalog[0].measure[m].Mcal = 0;
 	catalog[0].measure[m].flags &= 0xff00;
 	catalog[0].measure[m].flags &= ~ID_MEAS_POOR;
@@ -97,5 +97,5 @@
       /** never use these measurements (wrong photcode, bad time range) */
       /* skipped via NOCAL, don't mark as skipped */
-      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].source);
+      ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode);
       if (ecode != photcode[0].code) continue;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/fit_groups.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/fit_groups.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/fit_groups.c	(revision 12008)
@@ -18,8 +18,8 @@
       if (tgroup[i].image[j][0].code & IMAGE_BAD) continue;
       sgroup = (Group *) tgroup[i].imlink[j][0].sgroup;
-      Mcal = tgroup[i].image[j][0].Mcal_PS;
+      Mcal = tgroup[i].image[j][0].Mcal;
       Mgrp = sgroup[0].M;
       mlist[Nlist] = (Mcal - Mgrp);
-      dlist[Nlist] = tgroup[i].image[j][0].dMcal_PS;
+      dlist[Nlist] = tgroup[i].image[j][0].dMcal;
       Nlist ++;
     }
@@ -56,8 +56,8 @@
       if (sgroup[i].image[j][0].code & IMAGE_BAD) continue;
       tgroup = (Group *) sgroup[i].imlink[j][0].tgroup;
-      Mcal = sgroup[i].image[j][0].Mcal_PS;
+      Mcal = sgroup[i].image[j][0].Mcal;
       Mgrp = tgroup[0].M;
       mlist[Nlist] = (Mcal - Mgrp);
-      dlist[Nlist] = sgroup[i].image[j][0].dMcal_PS;
+      dlist[Nlist] = sgroup[i].image[j][0].dMcal;
       Nlist ++;
     }
Index: /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/subset_images.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/subset_images.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/subset_images.c	(revision 12008)
@@ -19,5 +19,5 @@
 
     /* select images by photcode */
-    equiv = GetPhotcodeEquivCodebyCode (image[i].source);
+    equiv = GetPhotcodeEquivCodebyCode (image[i].photcode);
     if (equiv != photcode[0].code) continue;
 
Index: /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/update.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/update.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/update.c	(revision 12008)
@@ -22,5 +22,5 @@
   for (i = 0; i < Nsgroup; i++) {
     for (j = 0; j < sgroup[i].Nimage; j++) {
-      sgroup[i].image[j][0].Mcal_PS -= sgroup[i].M;
+      sgroup[i].image[j][0].Mcal -= sgroup[i].M;
     }
   }
Index: /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/update_catalog.c
===================================================================
--- /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/update_catalog.c	(revision 12007)
+++ /branches/dvo-mods-2007-02/Ohana/src/uniphot/src/update_catalog.c	(revision 12008)
@@ -15,14 +15,14 @@
   for (i = 0; i < catalog[0].Naverage; i++) {
     
-    Mp = Primary ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].M_PS;
+    Mp = Primary ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].M;
     if (*Mp != NO_MAG) *Mp += sgroup[0].M;
 
     m = catalog[0].average[i].offset;
     for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
-      code = GetPhotcodebyCode (catalog[0].measure[m].source);
+      code = GetPhotcodebyCode (catalog[0].measure[m].photcode);
       if (code == NULL) continue;
       if (code[0].type != PHOT_DEP) continue;
       if (code[0].equiv != photcode[0].code) continue;
-      catalog[0].measure[m].Mcal_PS -= sgroup[0].M;
+      catalog[0].measure[m].Mcal -= sgroup[0].M;
       found ++;
     }
