Index: /trunk/Ohana/src/addstar/src/calibrate.c
===================================================================
--- /trunk/Ohana/src/addstar/src/calibrate.c	(revision 4864)
+++ /trunk/Ohana/src/addstar/src/calibrate.c	(revision 4865)
@@ -60,17 +60,17 @@
     if (measure[0].source == CalC0) { 
       found0 = TRUE; 
-      CalM0  = measure[i].M; 
-      dCalM  = measure[i].dM; 
+      CalM0  = measure[i].M_PS; 
+      dCalM  = measure[i].dM_PS; 
     }
     if (measure[i].source == CalC1) { 
       found1 = TRUE; 
-      CalM1  = measure[i].M; 
+      CalM1  = measure[i].M_PS; 
     }
     if (measure[i].source == CalC2) { 
       found2 = TRUE; 
-      CalM2  = measure[i].M; 
+      CalM2  = measure[i].M_PS; 
     }
     if (found0 && found1 && found2) {
-      SaveCalibration (new[0].M, new[0].dM, CalM0, dCalM, CalM1-CalM2, new[0].airmass, Nstar);
+      SaveCalibration (new[0].M_PS, new[0].dM_PS, CalM0, dCalM, CalM1-CalM2, new[0].airmass_PS, Nstar);
       return;
     }
@@ -83,5 +83,5 @@
 
   int i, MaxN, *Nlist, Nkeep;
-  short int Mint;
+  float Mint;
   float N, M1, M2, Klam, Clam, Xlam, Mabs, *Dmag, *dDmag;
   float dMo, dMr, Mw, Dmed, W1, W2, NSigma;
@@ -110,12 +110,12 @@
   ALLOCATE (dDmag, float, Ncal);
   Nkeep = 0;
+  Clam = thiscode[0].C*0.001;
   Klam = thiscode[0].K;
-  Clam = thiscode[0].C;
   Xlam = thiscode[0].X[0];
   for (i = 0; i < Ncal; i++) {
     /* if this entry has too many (or two few?) matches, skip it */
     if (Nlist[Nstar[i]] != 1) continue;
-    Mint = Clam + Mobs[i] + Xlam*Cref[i] + Klam*(Airm[i] - 1000);
-    Mabs = 0.001*Mint - ZeroPt;
+    Mint = Clam + Mobs[i] + Xlam*Cref[i] + Klam*(Airm[i] - 1.000);
+    Mabs = Mint - ZeroPt;
     /* note: subpix correction is applied in gstars */
 
@@ -126,8 +126,9 @@
     }
     
-    dMr = MAX (0.005, 0.001*dMref[i]);
-    dMo = MAX (0.005, 0.001*dMobs[i]);
+    /* XXX EAM: note the artificial 0.005 dmag here */
+    dMr = MAX (0.005, dMref[i]);
+    dMo = MAX (0.005, dMobs[i]);
 
-    Dmag[Nkeep] = (Mabs - 0.001*Mref[i]);
+    Dmag[Nkeep] = (Mabs - Mref[i]);
     dDmag[Nkeep] = (dMr*dMr + dMo*dMo);
     Nkeep ++;
@@ -178,2 +179,4 @@
   }
 }
+
+/*** image.Mcal is still in millimags ***/
Index: /trunk/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /trunk/Ohana/src/addstar/src/find_matches.c	(revision 4864)
+++ /trunk/Ohana/src/addstar/src/find_matches.c	(revision 4865)
@@ -13,5 +13,5 @@
   Coords tcoords;
   int Nsecfilt, Nsec, MTIME;
-  short int Mcat, *Mval;
+  float Mcat, *Mval;
 
   /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
@@ -103,5 +103,5 @@
   /* correct instrumental mags for exposure time */
   if (image[0].exptime > 0) {
-    MTIME = 2500*log10(image[0].exptime);
+    MTIME = 2.500*log10(image[0].exptime);
   } else {
     MTIME = 0;
@@ -149,24 +149,24 @@
       catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N].R);
       catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N].D);
-      catalog[0].measure[Nmeas].M        = MIN (1000*stars[N].M + MTIME, NO_MAG);
-      catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
-      catalog[0].measure[Nmeas].Mcal     = image[0].Mcal;
-      catalog[0].measure[Nmeas].t        = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
-      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       = MTIME;
-      catalog[0].measure[Nmeas].airmass  = secz;
-
-      catalog[0].measure[Nmeas].Mgal     = MIN (1000*stars[N].Mgal + MTIME, NO_MAG);
-      catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
-      catalog[0].measure[Nmeas].fwy      = MIN (100*(stars[N].fy / stars[N].fx), NO_ERR);
-      catalog[0].measure[Nmeas].theta    = MIN ((255/360)*stars[N].df, NO_ERR);
+      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
+      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
+      catalog[0].measure[Nmeas].Mcal_PS     = 0.001*image[0].Mcal; /* XXX image.Mcal still millimags */
+      catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
+      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       = MTIME;
+      catalog[0].measure[Nmeas].airmass_PS  = secz;
+
+      catalog[0].measure[Nmeas].Mgal_PS     = MIN (stars[N].Mgal + MTIME, NO_MAG);
+      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);
 	
       /* it is not valid to pass PRI/SEC/REF photcodes to this routine */
       /* check for entries in the secfilt lists */
-      Mcat = iPhotCat (&catalog[0].measure[Nmeas]);
-      Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M;
+      Mcat = PhotCat (&catalog[0].measure[Nmeas]);
+      Mval = (Nsec == -1) ? &catalog[0].average[n].M_PS : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
       if (*Mval == NO_MAG) *Mval = Mcat;
 
@@ -254,8 +254,8 @@
     secz = airmass (image[0].secz, stars[N].R, stars[N].D, SiderealTime, Latitude);
 
-    catalog[0].average[Nave].R_PS 	       = stars[N].R;
-    catalog[0].average[Nave].D_PS 	       = stars[N].D;
-    catalog[0].average[Nave].M 	       = NO_MAG;
-    catalog[0].average[Nave].dM        = NO_MAG;
+    catalog[0].average[Nave].R_PS      = stars[N].R;
+    catalog[0].average[Nave].D_PS      = stars[N].D;
+    catalog[0].average[Nave].M_PS      = NO_MAG;
+    catalog[0].average[Nave].dM_PS     = NO_MAG;
     catalog[0].average[Nave].Nm        = 1;
     catalog[0].average[Nave].Nn        = 0;
@@ -268,29 +268,29 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
+      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        = MIN (1000*stars[N].M + MTIME, NO_MAG);
-    catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N].dM, NO_ERR);
-    catalog[0].measure[Nmeas].Mcal     = image[0].Mcal;
-    catalog[0].measure[Nmeas].t        = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */
-    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       = MTIME;
-    catalog[0].measure[Nmeas].airmass  = secz;
-
-    catalog[0].measure[Nmeas].Mgal     = MIN (1000*stars[N].Mgal + MTIME, NO_MAG);
-    catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
-    catalog[0].measure[Nmeas].fwy      = MIN (100*(stars[N].fy / stars[N].fx), NO_ERR);
-    catalog[0].measure[Nmeas].theta    = MIN ((255/360)*stars[N].df, NO_ERR);
-
-    Mcat = iPhotCat (&catalog[0].measure[Nmeas]);
-    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M;
+    catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
+    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);
+    catalog[0].measure[Nmeas].Mcal_PS  	  = 0.001*image[0].Mcal;
+    catalog[0].measure[Nmeas].t        	  = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */
+    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    	  = MTIME;
+    catalog[0].measure[Nmeas].airmass_PS  = secz;
+
+    catalog[0].measure[Nmeas].Mgal_PS  	  = MIN (stars[N].Mgal + MTIME, NO_MAG);
+    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);
+
+    Mcat = PhotCat (&catalog[0].measure[Nmeas]);
+    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M_PS : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
     if (*Mval == NO_MAG) *Mval = Mcat;
 
Index: /trunk/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/find_matches_refstars.c	(revision 4864)
+++ /trunk/Ohana/src/addstar/src/find_matches_refstars.c	(revision 4865)
@@ -130,7 +130,7 @@
       catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N][0].R);
       catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N][0].D);
-      catalog[0].measure[Nmeas].M        = MIN (1000*stars[N][0].M,  NO_MAG);
-      catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N][0].dM, NO_ERR);
-      catalog[0].measure[Nmeas].Mcal     = 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        = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
       catalog[0].measure[Nmeas].averef   = n;
@@ -138,11 +138,11 @@
       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      = 0xff;
-      catalog[0].measure[Nmeas].theta    = 0xff;
+      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;
 	
       /** don't update average / secfilt values for REF photcodes **/
@@ -195,6 +195,6 @@
     catalog[0].average[Nave].R_PS         = stars[N][0].R;
     catalog[0].average[Nave].D_PS         = stars[N][0].D;
-    catalog[0].average[Nave].M         = NO_MAG;
-    catalog[0].average[Nave].dM        = NO_MAG;
+    catalog[0].average[Nave].M_PS         = NO_MAG;
+    catalog[0].average[Nave].dM_PS        = NO_MAG;
     catalog[0].average[Nave].Nm        = 1;
     catalog[0].average[Nave].Nn        = 0;
@@ -207,14 +207,14 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;
-      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
+      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        = MIN (1000*stars[N][0].M,  NO_MAG);
-    catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N][0].dM, NO_ERR);
-    catalog[0].measure[Nmeas].Mcal     = 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;
@@ -222,11 +222,11 @@
     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      = 0xff;
-    catalog[0].measure[Nmeas].theta    = 0xff;
+    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;
 
     stars[N][0].found = Nmeas;
Index: /trunk/Ohana/src/addstar/src/gcatalog.c
===================================================================
--- /trunk/Ohana/src/addstar/src/gcatalog.c	(revision 4864)
+++ /trunk/Ohana/src/addstar/src/gcatalog.c	(revision 4865)
@@ -28,12 +28,12 @@
     for (in = out = i = 0; i < catalog[0].Naverage; i++) {
       for (j = 0; j < catalog[0].Nsecfilt; j++, in++, out++) {
-	outsec[out].M  = insec[in].M;
+	outsec[out].M_PS  = insec[in].M_PS;
+	outsec[out].dM_PS = insec[in].dM_PS;
 	outsec[out].Xm = insec[in].Xm;
-	outsec[out].dM = insec[in].dM;
       }
       for (j = 0; j < Nextra; j++, out++) {
-	outsec[out].M  = NO_MAG;
-	outsec[out].Xm = NO_MAG;
-	outsec[out].dM = NO_MAG;
+	outsec[out].M_PS  = NO_MAG;
+	outsec[out].dM_PS = NO_MAG;
+	outsec[out].Xm    = NO_MAG;
       }
     }
Index: /trunk/Ohana/src/addstar/src/replace_match.c
===================================================================
--- /trunk/Ohana/src/addstar/src/replace_match.c	(revision 4864)
+++ /trunk/Ohana/src/addstar/src/replace_match.c	(revision 4865)
@@ -12,6 +12,6 @@
     measure[i].dR_PS       = 3600.0*(average[0].R_PS - star[0].R);
     measure[i].dD_PS       = 3600.0*(average[0].D_PS - star[0].D);
-    measure[i].M        = MIN (1000*star[0].M,  NO_MAG);
-    measure[i].dM       = MIN (1000*star[0].dM, NO_ERR);
+    measure[i].M_PS        = MIN (star[0].M,  NO_MAG);
+    measure[i].dM_PS       = MIN (star[0].dM, NO_ERR);
     star[0].found      = average[0].offset + i;
     return (TRUE);
Index: /trunk/Ohana/src/delstar/src/gcatalog.c
===================================================================
--- /trunk/Ohana/src/delstar/src/gcatalog.c	(revision 4864)
+++ /trunk/Ohana/src/delstar/src/gcatalog.c	(revision 4865)
@@ -28,10 +28,12 @@
     for (in = out = i = 0; i < catalog[0].Naverage; i++) {
       for (j = 0; j < catalog[0].Nsecfilt; j++, in++, out++) {
-	outsec[out].M = insec[in].M;
-	outsec[out].Xm = insec[in].Xm;
+	outsec[out].M_PS  = insec[in].M_PS;
+	outsec[out].dM_PS = insec[in].dM_PS;
+	outsec[out].Xm    = insec[in].Xm;
       }
       for (j = 0; j < Nextra; j++, out++) {
-	outsec[out].M = NO_MAG;
-	outsec[out].Xm = NO_MAG;
+	outsec[out].M_PS  = NO_MAG;
+	outsec[out].dM_PS = NO_ERR;
+	outsec[out].Xm    = NO_MAG;
       }
     }
Index: /trunk/Ohana/src/gastro/src/gptolemy.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gptolemy.c	(revision 4864)
+++ /trunk/Ohana/src/gastro/src/gptolemy.c	(revision 4865)
@@ -45,5 +45,5 @@
     stars[0][nstar].X = catalog.average[i].R_PS;
     stars[0][nstar].Y = catalog.average[i].D_PS;
-    stars[0][nstar].mag = 0.001*catalog.measure[catalog.average[i].offset].M;
+    stars[0][nstar].mag = catalog.measure[catalog.average[i].offset].M_PS;
   }
 
@@ -54,11 +54,11 @@
     stars[0][nstar].Y = catalog.average[i].D_PS;
     GotIt = FALSE;
-    if (catalog.average[i].M != NO_MAG) {
-      stars[0][nstar].mag = 0.001*catalog.average[i].M;
+    if (catalog.average[i].M_PS != NO_MAG) {
+      stars[0][nstar].mag = catalog.average[i].M_PS;
       GotIt = TRUE;
     }
     for (j = 0; !GotIt && (j < Nsec); j++) {
-      if (catalog.secfilt[i*Nsec + j].M != NO_MAG) {
-	stars[0][nstar].mag = 0.001*catalog.secfilt[i*Nsec + j].M;
+      if (catalog.secfilt[i*Nsec + j].M_PS != NO_MAG) {
+	stars[0][nstar].mag = catalog.secfilt[i*Nsec + j].M_PS;
 	GotIt = TRUE;
       }
Index: /trunk/Ohana/src/gastro2/src/gptolemy2.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/gptolemy2.c	(revision 4864)
+++ /trunk/Ohana/src/gastro2/src/gptolemy2.c	(revision 4865)
@@ -43,5 +43,5 @@
     stars[nstar].R = catalog.average[i].R_PS;
     stars[nstar].D = catalog.average[i].D_PS;
-    stars[nstar].M = 0.001*catalog.measure[catalog.average[i].offset].M;
+    stars[nstar].M = catalog.measure[catalog.average[i].offset].M_PS;
   }
 
Index: /trunk/Ohana/src/libautocode/Makefile
===================================================================
--- /trunk/Ohana/src/libautocode/Makefile	(revision 4864)
+++ /trunk/Ohana/src/libautocode/Makefile	(revision 4865)
@@ -29,4 +29,6 @@
 $(SRC)/average-panstarrs.$(ARCH).o \
 $(SRC)/secfilt.$(ARCH).o \
+$(SRC)/secfilt-elixir.$(ARCH).o \
+$(SRC)/secfilt-panstarrs.$(ARCH).o \
 $(SRC)/measure.$(ARCH).o \
 $(SRC)/measure-loneos.$(ARCH).o \
@@ -51,4 +53,6 @@
 $(INC)/average-panstarrs.h \
 $(INC)/secfilt.h \
+$(INC)/secfilt-elixir.h \
+$(INC)/secfilt-panstarrs.h \
 $(INC)/measure.h \
 $(INC)/measure-loneos.h \
Index: /trunk/Ohana/src/libautocode/def/average-elixir.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average-elixir.d	(revision 4864)
+++ /trunk/Ohana/src/libautocode/def/average-elixir.d	(revision 4865)
@@ -12,8 +12,8 @@
 FIELD Nn,             NMISS,      unsigned short,   number of missings
 FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
-FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [1000*value]  ?
+FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [100*log(value)]  ?
 FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
 FIELD offset,         offset,     int,     	    offset to first measurement
 FIELD missing,        missing,    int,     	    offset to first missing obs
-FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
+FIELD dM,             MAG_ERR,    short,            error on primary mag,         millimag
 FIELD Xg,             Xg,         short,            best chisq value
Index: /trunk/Ohana/src/libautocode/def/average-panstarrs.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average-panstarrs.d	(revision 4864)
+++ /trunk/Ohana/src/libautocode/def/average-panstarrs.d	(revision 4865)
@@ -2,5 +2,5 @@
 EXTNAME DVO_AVERAGE_PANSTARRS
 TYPE    BINTABLE
-SIZE    40
+SIZE    44
 
 # elements of data structure / FITS table
@@ -8,12 +8,12 @@
 FIELD R,              RA,         double,           RA,                	       	  decimal degrees 
 FIELD D,              DEC,        double,           DEC,               	       	  decimal degrees 
-FIELD M,              MAG,        short,            primary mag,       	       	  millimag
+FIELD M,              MAG,        float,            primary mag,       	       	  mag
+FIELD dM,             MAG_ERR,    float,            error on primary mag,         mag
+FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
+FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [100*log(value)]
+FIELD Xg,             CHISQ_GAL,  short,            chisq for galaxy mag          [100*log(value)]
 FIELD Nm,             NMEAS,      unsigned short,   number of measures
 FIELD Nn,             NMISS,      unsigned short,   number of missings
-FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
-FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [1000*value]  ?
 FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
 FIELD offset,         offset,     int,     	    offset to first measurement
 FIELD missing,        missing,    int,     	    offset to first missing obs
-FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
-FIELD Xg,             Xg,         short,            best chisq value
Index: /trunk/Ohana/src/libautocode/def/average.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average.d	(revision 4864)
+++ /trunk/Ohana/src/libautocode/def/average.d	(revision 4865)
@@ -2,5 +2,5 @@
 EXTNAME DVO_AVERAGE
 TYPE    BINTABLE
-SIZE    40
+SIZE    44
 
 # elements of data structure / FITS table
@@ -8,12 +8,12 @@
 FIELD R_PS,           RA,         double,           RA,                	       	  decimal degrees 
 FIELD D_PS,           DEC,        double,           DEC,               	       	  decimal degrees 
-FIELD M,              MAG,        short,            primary mag,       	       	  millimag
+FIELD M_PS,           MAG,        float,            primary mag,       	       	  mag
+FIELD dM_PS,          MAG_ERR,    float,            error on primary mag,         mag
+FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
+FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [100*log(value)]
+FIELD Xg,             CHISQ_GAL,  short,            chisq for galaxy mags,        [100*log(value)]
 FIELD Nm,             NMEAS,      unsigned short,   number of measures
 FIELD Nn,             NMISS,      unsigned short,   number of missings
-FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
-FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [1000*value]  ?
 FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
 FIELD offset,         offset,     int,     	    offset to first measurement
 FIELD missing,        missing,    int,     	    offset to first missing obs
-FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
-FIELD Xg,             Xg,         short,            best chisq value
Index: /trunk/Ohana/src/libautocode/def/measure-panstarrs.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure-panstarrs.d	(revision 4864)
+++ /trunk/Ohana/src/libautocode/def/measure-panstarrs.d	(revision 4865)
@@ -2,22 +2,22 @@
 EXTNAME DVO_MEASURE_PANSTARRS
 TYPE    BINTABLE
-SIZE    32
+SIZE    50
 
 # elements of data structure / FITS table
 
-FIELD dR,             D_RA,       short,          RA offset,                	  1/100 arcsec
-FIELD dD,             D_DEC,      short,          DEC offset,               	  1/100 arcsec
-FIELD M,              MAG,        short,          catalog mag,       	       	  millimag
-FIELD Mcal,           Mcal,       short,          image cal mag,	          millimag
-FIELD Mgal,           Mgal,       short,          galaxy mag,			  millimag
-FIELD airmass,        airmass,    short,          (airmass - 1),		  milliairmass
+FIELD dR,             D_RA,       float,          RA offset,                	  arcsec
+FIELD dD,             D_DEC,      float,          DEC offset,               	  arcsec
+FIELD M,              MAG,        float,          catalog mag,       	       	  mag
+FIELD dM,             dM,         float,          mag error,                      mag
+FIELD Mcal,           Mcal,       float,          image cal mag,	          mag
+FIELD Mgal,           Mgal,       float,          galaxy mag,			  mag
+FIELD airmass,        airmass,    float,          (airmass - 1),		  airmass
+FIELD dt,             dt,         float,          exposure time,                  2.5*log(exptime)
 FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec 
-FIELD dM,             dM,         unsigned char,  mag error,                      millimag
-FIELD fwy,            fwy,        unsigned char,  object fwhm minor/major ratio
+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 dt,             dt,         short,          exposure time,                  2500*log(exptime)
-FIELD flags,          flags,      unsigned short, flags for various uses  
Index: /trunk/Ohana/src/libautocode/def/measure.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure.d	(revision 4864)
+++ /trunk/Ohana/src/libautocode/def/measure.d	(revision 4865)
@@ -16,10 +16,10 @@
 FIELD airmass_PS,     airmass,    float,          (airmass - 1),		  airmass
 FIELD dt_PS,          dt,         float,          exposure time,                  2.5*log(exptime)
-FIELD t,              t,          unsigned int,   time in seconds (UNIX)
 FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec 
-FIELD FWy_PS,         FWy,        short,          object fwhm minor 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      
Index: /trunk/Ohana/src/libautocode/def/secfilt-elixir.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/secfilt-elixir.d	(revision 4865)
+++ /trunk/Ohana/src/libautocode/def/secfilt-elixir.d	(revision 4865)
@@ -0,0 +1,9 @@
+STRUCT  SecFiltElixir
+EXTNAME DVO_SECFILT_ELIXIR
+TYPE    BINTABLE
+SIZE    6
+
+# elements of data structure / FITS table
+FIELD  M,  MAG,      short,                other mags,       millimags
+FIELD  Xm, MAG_CHI,  short,                chisq on mag
+FIELD  dM, MAG_ERR,  short,                scatter on mag
Index: /trunk/Ohana/src/libautocode/def/secfilt-panstarrs.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/secfilt-panstarrs.d	(revision 4865)
+++ /trunk/Ohana/src/libautocode/def/secfilt-panstarrs.d	(revision 4865)
@@ -0,0 +1,9 @@
+STRUCT  SecFiltPanstarrs
+EXTNAME DVO_SECFILT_PANSTARRS
+TYPE    BINTABLE
+SIZE    8
+
+# elements of data structure / FITS table
+FIELD  M,  MAG,      float,                other mags,       mags
+FIELD  dM, MAG_ERR,  short,                scatter on mag    1e4*mag
+FIELD  Xm, MAG_CHI,  short,                chisq on mag,     [100*log(value)]
Index: /trunk/Ohana/src/libautocode/def/secfilt.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/secfilt.d	(revision 4864)
+++ /trunk/Ohana/src/libautocode/def/secfilt.d	(revision 4865)
@@ -2,8 +2,8 @@
 EXTNAME DVO_SECFILT
 TYPE    BINTABLE
-SIZE    6
+SIZE    10
 
 # elements of data structure / FITS table
-FIELD  M,  MAG,      short,                other mags,       millimags
-FIELD  Xm, MAG_CHI,  short,                chisq on mag
-FIELD  dM, MAG_ERR,  short,                scatter on mag
+FIELD  M_PS,  MAG,      float,                other mags,       mags
+FIELD  dM_PS, MAG_ERR,  float,                scatter on mag    mags
+FIELD  Xm,    MAG_CHI,  short,                chisq on mag      [100*log(value)]
Index: /trunk/Ohana/src/libohana/Makefile
===================================================================
--- /trunk/Ohana/src/libohana/Makefile	(revision 4864)
+++ /trunk/Ohana/src/libohana/Makefile	(revision 4865)
@@ -63,4 +63,6 @@
 $(ASRC)/average-panstarrs.$(ARCH).o \
 $(ASRC)/secfilt.$(ARCH).o \
+$(ASRC)/secfilt-elixir.$(ARCH).o \
+$(ASRC)/secfilt-panstarrs.$(ARCH).o \
 $(ASRC)/measure.$(ARCH).o \
 $(ASRC)/measure-loneos.$(ARCH).o \
Index: /trunk/Ohana/src/libohana/include/dvo.h
===================================================================
--- /trunk/Ohana/src/libohana/include/dvo.h	(revision 4864)
+++ /trunk/Ohana/src/libohana/include/dvo.h	(revision 4865)
@@ -187,14 +187,15 @@
 char     *GetPhotcodeNamebyCode (int code);
 
-double PhotInst (Measure *measure);
-double PhotCat (Measure *measure);
-double PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
-double PhotRel (Measure *measure, Average *average, SecFilt *secfilt);
-double PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
-double PhotAve (PhotCode *code, Average *average, SecFilt *secfilt);
-double PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
-double PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
-double PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
-
+float PhotInst (Measure *measure);
+float PhotCat (Measure *measure);
+float PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
+float PhotRel (Measure *measure, Average *average, SecFilt *secfilt);
+float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
+float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt);
+float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
+float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
+float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
+
+# if (0)
 short iPhotInst (Measure *measure);
 short iPhotAbs (Measure *measure);
@@ -207,6 +208,7 @@
 short iPhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
 short iPhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
-
-short iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
+# endif
+
+float iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
 int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color);
 
Index: /trunk/Ohana/src/libohana/src/LoadPhotcodes.c
===================================================================
--- /trunk/Ohana/src/libohana/src/LoadPhotcodes.c	(revision 4864)
+++ /trunk/Ohana/src/libohana/src/LoadPhotcodes.c	(revision 4865)
@@ -3,13 +3,16 @@
 
 # define NCTERMS 4
+# define F_PS 0.001
+# define NO_MAG_PS 100.0
 
 static PhotCodeData *photcodes = NULL;
 static double ZERO_POINT;
-static short int iZERO_POINT;
 static short int Nseclist[0x10000];
+
+/* static short int iZERO_POINT; */
 
 void SetZeroPoint (double ZP) {
   ZERO_POINT = ZP;
-  iZERO_POINT = 1000 * ZP;
+  /* iZERO_POINT = 1000 * ZP; */
 }
 
@@ -375,4 +378,6 @@
 }
 
+/**** conversion to INTERNAL vs TABLE types makes the iPhot versions irrelevant ****/
+# if (0) 
 /******** photometry conversions *********/
 double PhotInst (Measure *measure) {
@@ -474,6 +479,8 @@
 }
 
+# endif 
+
 /******** internal photometry conversions (keeps values in short int millimags) *********/
-short iPhotInst (Measure *measure) {
+float PhotInst (Measure *measure) {
 
   int Np;
@@ -481,12 +488,12 @@
 
   Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG);
+  if (Np == -1) return (NO_MAG_PS);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    M = measure[0].M;
+    M = measure[0].M_PS;
     return (M);
   }
 
-  M = measure[0].M - measure[0].dt - iZERO_POINT;
+  M = measure[0].M_PS - measure[0].dt_PS - ZERO_POINT;
 	  
   return (M);
@@ -494,44 +501,43 @@
 }
 
-short iPhotCat (Measure *measure) {
+float PhotCat (Measure *measure) {
 
   int Np;
-  short Mcat;
+  float Mcat;
   PhotCode *code;
 
   Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG);
+  if (Np == -1) return (NO_MAG_PS);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Mcat = measure[0].M;
+    Mcat = measure[0].M_PS;
     return (Mcat);
   }
   code = &photcodes[0].code[Np];
-  Mcat = measure[0].M - iZERO_POINT + code[0].K*(measure[0].airmass - 1000) + code[0].C;
+  Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;
   
   return (Mcat);
 }
 
-short iPhotSys (Measure *measure, Average *average, SecFilt *secfilt) {
+float PhotSys (Measure *measure, Average *average, SecFilt *secfilt) {
 
   int i, Np;
-  short Mcat, Mcol, Msys, mc;
-  double Mc;
+  float Mcat, Mcol, Msys, mc, Mc;
   PhotCode *code;
 
   Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG);
+  if (Np == -1) return (NO_MAG_PS);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Msys = measure[0].M;
+    Msys = measure[0].M_PS;
     return (Msys);
   }
   code = &photcodes[0].code[Np];
-  Mcat = measure[0].M - iZERO_POINT + code[0].K*(measure[0].airmass - 1000.0) + code[0].C;
+  Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;
 
   /* for DEP, color must be made of PRI/SEC */
   mc = iPhotColor (average, secfilt, NULL, code);
-  if (mc == NO_MAG) return (Mcat);
-  mc = mc - code[0].dX;
+  if (mc == NO_MAG_PS) return (Mcat);
+  mc = mc - F_PS*code[0].dX;
 
   Mc = mc;
@@ -539,5 +545,5 @@
   for (i = 0; i < code[0].Nc; i++) {
     Mcol += code[0].X[i]*Mc;
-    Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
+    Mc *= mc;
   }
   Msys = Mcat + Mcol;
@@ -545,25 +551,24 @@
 }
 
-short iPhotRel (Measure *measure, Average *average, SecFilt *secfilt) {
+float PhotRel (Measure *measure, Average *average, SecFilt *secfilt) {
 
   int i, Np;
-  short Mcat, Mcol, Mrel, mc;
-  double Mc;
+  float Mcat, Mcol, Mrel, mc, Mc;
   PhotCode *code;
 
   Np = photcodes[0].hashcode[measure[0].source];
-  if (Np == -1) return (NO_MAG);
+  if (Np == -1) return (NO_MAG_PS);
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Mcat = measure[0].M;
+    Mcat = measure[0].M_PS;
     return (Mcat);
   }
   code = &photcodes[0].code[Np];
-  Mrel = measure[0].M - iZERO_POINT + code[0].K*(measure[0].airmass - 1000.0) + code[0].C - measure[0].Mcal;
+  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;
 
   /* for DEP, color must be made of PRI/SEC */
   mc = iPhotColor (average, secfilt, NULL, code);
-  if (mc == NO_MAG) return (Mrel);
-  mc = mc - code[0].dX;
+  if (mc == NO_MAG_PS) return (Mrel);
+  mc = mc - F_PS*code[0].dX;
 
   Mc = mc;
@@ -571,5 +576,5 @@
   for (i = 0; i < code[0].Nc; i++) {
     Mcol += code[0].X[i]*Mc;
-    Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
+    Mc *= mc;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
   }
   Mrel += Mcol;
@@ -578,29 +583,28 @@
 
 /* return calibrated magnitude from measure for given photcode */
-short iPhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
+float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
 
   int i, Np; 
-  short Mcal, Mrel, Mcol, mc;
-  double Mc;
+  float Mcal, Mrel, Mcol, mc, Mc;
 
   /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */
   Np = photcodes[0].hashcode[thisone[0].source];
   if (Np == -1) {
-    return (NO_MAG);
+    return (NO_MAG_PS);
   }
 
   if (photcodes[0].code[Np].type == PHOT_REF) {
-    Mrel = thisone[0].M;
+    Mrel = thisone[0].M_PS;
     return (Mrel);
   }
   if (code[0].code != photcodes[0].code[Np].equiv) {
-    return (NO_MAG);
-  }
-
-  Mcal = iPhotRel (thisone, average, secfilt) + code[0].C;
+    return (NO_MAG_PS);
+  }
+
+  Mcal = PhotRel (thisone, average, secfilt) + F_PS*code[0].C;
 
   mc = iPhotColor (average, secfilt, measure, code);
-  if (mc == NO_MAG) return (Mcal);
-  mc = mc - code[0].dX;
+  if (mc == NO_MAG_PS) return (Mcal);
+  mc = mc - F_PS*code[0].dX;
 
   Mc = mc;
@@ -608,5 +612,5 @@
   for (i = 0; i < code[0].Nc; i++) {
     Mcol += code[0].X[i]*Mc;
-    Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
+    Mc *= mc;
   }
   Mcal += Mcol;
@@ -615,11 +619,11 @@
 
 /* color term may not use DEP magnitude */
-short iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
+float iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
 
   int i, Ns1, Ns2, Ns;
-  short m1, m2, mc;
+  float m1, m2, mc;
   PhotCode *color;
 
-  m1 = m2 = NO_MAG;
+  m1 = m2 = NO_MAG_PS;
 
   if (measure == NULL) {
@@ -627,7 +631,7 @@
     Ns2 = photcodes[0].hashNsec[code[0].c2];
   
-    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);
+    m1 = (Ns1 == -1) ? average[0].M_PS : secfilt[Ns1].M_PS;
+    m2 = (Ns2 == -1) ? average[0].M_PS : secfilt[Ns2].M_PS;
+    mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);
     return (mc);
   }
@@ -635,35 +639,35 @@
   /* find magnitude matching first color term */
   color = GetPhotcodebyCode (code[0].c1);
-  if (color == NULL) return (NO_MAG);
+  if (color == NULL) return (NO_MAG_PS);
   if (color[0].type == PHOT_REF) {
-    for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG); i++) {
+    for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG_PS); i++) {
       if (measure[i].source == color[0].code) {
-	m1 = measure[i].M;
+	m1 = measure[i].M_PS;
       }
     }
   } else {
     Ns = photcodes[0].hashNsec[color[0].code];
-    m1 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
+    m1 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
   }	
 
   /* find magnitude matching second color term */
   color = GetPhotcodebyCode (code[0].c2);
-  if (color == NULL) return (NO_MAG);
+  if (color == NULL) return (NO_MAG_PS);
   if (color[0].type == PHOT_REF) {
-    for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG); i++) {
+    for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG_PS); i++) {
       if (measure[i].source == color[0].code) {
-	m2 = measure[i].M;
+	m2 = measure[i].M_PS;
       }
     }
   } else {
     Ns = photcodes[0].hashNsec[color[0].code];
-    m2 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
+    m2 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
   }	
-  mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);
+  mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);
   return (mc);
 }
 
 /* return calibrated magnitude from average/secfilt for given photcode */
-short iPhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {
+float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {
 
   int i, Ns;
@@ -672,10 +676,10 @@
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M;
-  Mref = Mave + code[0].C;
+  Mave = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
+  Mref = Mave + F_PS*code[0].C;
 
   mc = iPhotColor (average, secfilt, measure, code);
-  if (mc == NO_MAG) return (Mref);
-  mc = mc - code[0].dX;
+  if (mc == NO_MAG_PS) return (Mref);
+  mc = mc - F_PS*code[0].dX;
 
   Mc = mc;
@@ -683,5 +687,5 @@
   for (i = 0; i < code[0].Nc; i++) {
     Mcol += code[0].X[i]*Mc;
-    Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
+    Mc *= mc;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
   }
   Mref += Mcol;
@@ -690,5 +694,5 @@
 
 /***/
-short iPhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {
+float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {
 
   int Ns;
@@ -696,10 +700,10 @@
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M;
+  Mave = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
   return (Mave);
 }
 
 /*** note that this is NOT a wrapper around iPhotdM ***/
-short iPhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {
+float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {
 
   int Ns;
@@ -707,16 +711,18 @@
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  dM  = (Ns == -1) ? average[0].dM : secfilt[Ns].dM;
+  dM  = (Ns == -1) ? average[0].dM_PS : secfilt[Ns].dM_PS;
   return (dM);
 }
 
 /*** note that this is NOT a wrapper around iPhotXm ***/
-short iPhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {
+float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {
 
   int Ns;
-  short Xm;
+  short Mi;
+  float Xm;
 
   Ns = photcodes[0].hashNsec[code[0].code];
-  Xm = (Ns == -1) ? average[0].Xm : secfilt[Ns].Xm;
+  Mi = (Ns == -1) ? average[0].Xm : secfilt[Ns].Xm;
+  Xm = (Mi == NO_MAG_PS) ? -1.0 : pow (10.0, 0.01*Mi);
   return (Xm);
 }
@@ -734,5 +740,5 @@
     for (i = 0; i < average[0].Nm; i++) {
       if (measure[i].source == c1) {
-	M1 = 0.001*measure[i].M;
+	M1 = measure[i].M_PS;
 	goto filter1;
       }
@@ -741,5 +747,5 @@
   } else {
     Ns = photcodes[0].hashNsec[code[0].code];
-    M1 = (Ns == -1) ? 0.001*average[0].M : 0.001*secfilt[Ns].M;
+    M1 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
   }	
 
@@ -750,5 +756,5 @@
     for (i = 0; i < average[0].Nm; i++) {
       if (measure[i].source == c2) {
-	M2 = 0.001*measure[i].M;
+	M2 = measure[i].M_PS;
 	goto filter2;
       }
@@ -757,5 +763,5 @@
   } else {
     Ns = photcodes[0].hashNsec[code[0].code];
-    M2 = (Ns == -1) ? 0.001*average[0].M : 0.001*secfilt[Ns].M;
+    M2 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
   }	
   
Index: /trunk/Ohana/src/libohana/src/dvo_convert_elixir.c
===================================================================
--- /trunk/Ohana/src/libohana/src/dvo_convert_elixir.c	(revision 4864)
+++ /trunk/Ohana/src/libohana/src/dvo_convert_elixir.c	(revision 4865)
@@ -13,11 +13,12 @@
     out[i].dR_PS   = in[i].dR * 0.01;
     out[i].dD_PS   = in[i].dD * 0.01;
-    out[i].M       = in[i].M;
-    out[i].Mcal    = in[i].Mcal;
-    out[i].Mgal    = in[i].Mgal;
-    out[i].airmass = in[i].airmass;
+    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].dM      = in[i].dM;
-    out[i].fwy 	   = in[i].fwy;
+    out[i].FWy 	   = in[i].fwy * in[i].FWx * 0.01;
     out[i].theta   = in[i].theta;
     out[i].dophot  = in[i].dophot;
@@ -25,5 +26,4 @@
     out[i].t       = in[i].t;
     out[i].averef  = in[i].averef;
-    out[i].dt      = in[i].dt;
     out[i].flags   = in[i].flags;
   }
@@ -42,11 +42,12 @@
     out[i].dR      = in[i].dR_PS * 100.0;
     out[i].dD 	   = in[i].dD_PS * 100.0;
-    out[i].M       = in[i].M;
-    out[i].Mcal    = in[i].Mcal;
-    out[i].Mgal    = in[i].Mgal;
-    out[i].airmass = in[i].airmass;
+    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].FWx 	   = in[i].FWx;
-    out[i].dM      = in[i].dM;
-    out[i].fwy 	   = in[i].fwy;
+    out[i].fwy 	   = 100.0 * in[i].FWy / in[i].FWx;
     out[i].theta   = in[i].theta;
     out[i].dophot  = in[i].dophot;
@@ -54,5 +55,4 @@
     out[i].t       = in[i].t;
     out[i].averef  = in[i].averef;
-    out[i].dt      = in[i].dt;
     out[i].flags   = in[i].flags;
   }
@@ -70,5 +70,6 @@
     out[i].R_PS    = in[i].R;      
     out[i].D_PS    = in[i].D;      
-    out[i].M       = in[i].M;      
+    out[i].M_PS    = in[i].M  * 0.001;      
+    out[i].dM_PS   = in[i].dM * 0.001;      
     out[i].Xp      = in[i].Xp;     
     out[i].Xm      = in[i].Xm;     
@@ -78,5 +79,4 @@
     out[i].offset  = in[i].offset; 
     out[i].missing = in[i].missing;
-    out[i].dM      = in[i].dM;
     out[i].Xg      = in[i].Xg;
   }
@@ -94,5 +94,6 @@
     out[i].R       = in[i].R_PS;      
     out[i].D       = in[i].D_PS;      
-    out[i].M       = in[i].M;      
+    out[i].M       = in[i].M_PS  * 1000.0;      
+    out[i].dM      = in[i].dM_PS * 1000.0;
     out[i].Xp      = in[i].Xp;     
     out[i].Xm      = in[i].Xm;     
@@ -102,5 +103,4 @@
     out[i].offset  = in[i].offset; 
     out[i].missing = in[i].missing;
-    out[i].dM      = in[i].dM;
     out[i].Xg      = in[i].Xg;
   }
Index: /trunk/Ohana/src/libohana/src/dvo_convert_loneos.c
===================================================================
--- /trunk/Ohana/src/libohana/src/dvo_convert_loneos.c	(revision 4864)
+++ /trunk/Ohana/src/libohana/src/dvo_convert_loneos.c	(revision 4865)
@@ -13,7 +13,7 @@
     out[i].dR_PS   = in[i].dR * 0.01;
     out[i].dD_PS   = in[i].dD * 0.01;
-    out[i].M       = in[i].M;
-    out[i].Mcal    = in[i].Mcal;
-    out[i].dM      = in[i].dM;
+    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].dophot  = in[i].dophot;
     out[i].source  = in[i].source;
@@ -25,10 +25,10 @@
 
     /* these values don't exist in the Loneos format */
-    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].Mgal_PS    = in[i].M;
+    out[i].dt_PS      = 0;
+    out[i].airmass_PS = 0;
+    out[i].FWx 	      = 0;
+    out[i].FWy 	      = 0;
+    out[i].theta      = 0;
   }
   return (out);
@@ -46,7 +46,7 @@
     out[i].dR 	  = in[i].dR_PS * 100.0;
     out[i].dD 	  = in[i].dD_PS * 100.0;
-    out[i].M  	  = in[i].M;
-    out[i].dM 	  = in[i].dM;
-    out[i].Mcal   = in[i].Mcal;
+    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].dophot = in[i].dophot;
     out[i].source = in[i].source;
@@ -67,7 +67,7 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].R_PS       = in[i].R;      
-    out[i].D_PS       = in[i].D;      
-    out[i].M       = in[i].M;      
+    out[i].R_PS    = in[i].R;      
+    out[i].D_PS    = in[i].D;      
+    out[i].M_PS    = in[i].M * 0.001;      
     out[i].Xp      = in[i].Xp;     
     out[i].Xm      = in[i].Xm;     
@@ -79,5 +79,5 @@
 
     /* these don't exist in Loneos */
-    out[i].dM      = 0xffff;
+    out[i].dM_PS   = 0xffff;
     out[i].Xg      = 0xffff;
   }
@@ -95,5 +95,5 @@
     out[i].R       = in[i].R_PS;      
     out[i].D       = in[i].D_PS;      
-    out[i].M       = in[i].M;      
+    out[i].M       = in[i].M_PS * 1000.0;      
     out[i].Xp      = in[i].Xp;     
     out[i].Xm      = in[i].Xm;     
Index: /trunk/Ohana/src/libohana/src/dvo_convert_panstarrs.c
===================================================================
--- /trunk/Ohana/src/libohana/src/dvo_convert_panstarrs.c	(revision 4864)
+++ /trunk/Ohana/src/libohana/src/dvo_convert_panstarrs.c	(revision 4865)
@@ -8,23 +8,25 @@
   Measure *out;
 
+  /*** note that these structures are identical ***/
+
   ALLOCATE (out, Measure, Nvalues);
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].dR_PS   = in[i].dR;
-    out[i].dD_PS   = in[i].dD;
-    out[i].M       = in[i].M;
-    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].dM      = in[i].dM;
-    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].t       = in[i].t;
-    out[i].averef  = in[i].averef;
-    out[i].dt      = in[i].dt;
-    out[i].flags   = in[i].flags;
+    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].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].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].flags      = in[i].flags;
   }
   return (out);
@@ -42,11 +44,12 @@
     out[i].dR 	   = in[i].dR_PS;
     out[i].dD 	   = in[i].dD_PS;
-    out[i].M       = in[i].M;
-    out[i].Mcal    = in[i].Mcal;
-    out[i].Mgal    = in[i].Mgal;
-    out[i].airmass = in[i].airmass;
+    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].FWx 	   = in[i].FWx;
-    out[i].dM      = in[i].dM;
-    out[i].fwy 	   = in[i].fwy;
+    out[i].FWy 	   = in[i].FWy;
     out[i].theta   = in[i].theta;
     out[i].dophot  = in[i].dophot;
@@ -54,5 +57,4 @@
     out[i].t       = in[i].t;
     out[i].averef  = in[i].averef;
-    out[i].dt      = in[i].dt;
     out[i].flags   = in[i].flags;
   }
@@ -68,9 +70,11 @@
 
   for (i = 0; i < Nvalues; i++) {
-    out[i].R_PS       = in[i].R;      
-    out[i].D_PS       = in[i].D;      
-    out[i].M       = in[i].M;      
+    out[i].R_PS    = in[i].R;      
+    out[i].D_PS    = in[i].D;      
+    out[i].M_PS    = in[i].M;      
+    out[i].dM_PS   = in[i].dM;
     out[i].Xp      = in[i].Xp;     
     out[i].Xm      = in[i].Xm;     
+    out[i].Xg      = in[i].Xg;
     out[i].Nm      = in[i].Nm;     
     out[i].Nn      = in[i].Nn;     
@@ -78,6 +82,4 @@
     out[i].offset  = in[i].offset; 
     out[i].missing = in[i].missing;
-    out[i].dM      = in[i].dM;
-    out[i].Xg      = in[i].Xg;
   }
   return (out);
@@ -94,7 +96,9 @@
     out[i].R       = in[i].R_PS;      
     out[i].D       = in[i].D_PS;      
-    out[i].M       = in[i].M;      
+    out[i].M       = in[i].M_PS;      
+    out[i].dM      = in[i].dM_PS;
     out[i].Xp      = in[i].Xp;     
     out[i].Xm      = in[i].Xm;     
+    out[i].Xg      = in[i].Xg;
     out[i].Nm      = in[i].Nm;     
     out[i].Nn      = in[i].Nn;     
@@ -102,6 +106,4 @@
     out[i].offset  = in[i].offset; 
     out[i].missing = in[i].missing;
-    out[i].dM      = in[i].dM;
-    out[i].Xg      = in[i].Xg;
   }
   return (out);
Index: /trunk/Ohana/src/mosastro/src/gptolemy.c
===================================================================
--- /trunk/Ohana/src/mosastro/src/gptolemy.c	(revision 4864)
+++ /trunk/Ohana/src/mosastro/src/gptolemy.c	(revision 4865)
@@ -34,5 +34,5 @@
     stars[i].R 	 = catalog.average[i].R_PS;
     stars[i].D 	 = catalog.average[i].D_PS;
-    stars[i].Mag = 0.001*catalog.measure[catalog.average[i].offset].M;
+    stars[i].Mag = catalog.measure[catalog.average[i].offset].M_PS;
   }
   free (catalog.average);
Index: /trunk/Ohana/src/opihi/dvo/calextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/calextract.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/calextract.c	(revision 4865)
@@ -94,5 +94,5 @@
 	if (catalog.measure[m+j].source != code[1][0].code) continue;
 	M2 = PhotCat  (&catalog.measure[m+j]);
-	dM2 = 0.001*catalog.measure[m+j].dM;
+	dM2 = catalog.measure[m+j].dM_PS;
       }	
       if (M2 == NO_MAG) continue;
Index: /trunk/Ohana/src/opihi/dvo/calmextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/calmextract.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/calmextract.c	(revision 4865)
@@ -107,5 +107,5 @@
 	if (catalog.measure[m+j].source != code[1][0].code) continue;
 	M2 = PhotCat  (&catalog.measure[m+j]); 
-	dM2 = 0.001*catalog.measure[m+j].dM;
+	dM2 = catalog.measure[m+j].dM_PS;
       }	
       if (M2 == NO_MAG) continue;
Index: /trunk/Ohana/src/opihi/dvo/catalog.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/catalog.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/catalog.c	(revision 4865)
@@ -101,7 +101,7 @@
   if ((Nm = get_argument (argc, argv, "-m"))) {
     remove_argument (Nm, &argc, argv);
-    Mr  = 1000*atof(argv[Nm]);
+    Mr  = atof(argv[Nm]);
     remove_argument (Nm, &argc, argv);
-    Mz = 1000*atof(argv[Nm]);
+    Mz = atof(argv[Nm]);
     Mr = Mr - Mz;
     remove_argument (Nm, &argc, argv);
@@ -200,5 +200,5 @@
 	catalog.average[nstar].R_PS = R;
 	catalog.average[nstar].D_PS = D;
-	catalog.average[nstar].M = M * 1000.0;
+	catalog.average[nstar].M_PS = M;
 	nstar++;
 	if (nstar == NSTARS - 1) {
@@ -242,5 +242,5 @@
 	  catalog.average[nstar].R_PS = R;
 	  catalog.average[nstar].D_PS = D;
-	  catalog.average[nstar].M = M * 1000.0;
+	  catalog.average[nstar].M_PS = M;
 	  nstar++;
 	  if (nstar == NSTARS - 1) {
@@ -292,5 +292,5 @@
 	  catalog.average[nstar].R_PS = R;
 	  catalog.average[nstar].D_PS = D;
-	  catalog.average[nstar].M = M * 1000.0;
+	  catalog.average[nstar].M_PS = M;
 	  nstar++;
 	  if (nstar == NSTARS - 1) {
@@ -346,5 +346,5 @@
 	if (IDclip && (catalog.average[i].code != IDchoice))
 	  continue;
-	Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M - Mz) / Mr));
+	Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M_PS - Mz) / Mr));
 	if (LimExclude && (Zvec.elements[N] > 0.99)) continue;
 	if (Zvec.elements[N] < 0.011) continue;
@@ -356,5 +356,5 @@
     case (NUMSCALE):
       for (N = i = 0; i < catalog.Naverage; i++) {
-	if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz))) 
+	if (clip && ((catalog.average[i].M_PS > Mz) || (catalog.average[i].M_PS < Mr+Mz))) 
 	  continue;
 	if (IDclip && (catalog.average[i].code != IDchoice))
@@ -371,5 +371,5 @@
     case (MISSCALE):
       for (N = i = 0; i < catalog.Naverage; i++) {
-	if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz))) 
+	if (clip && ((catalog.average[i].M_PS > Mz) || (catalog.average[i].M_PS < Mr+Mz))) 
 	  continue;
 	if (IDclip && (catalog.average[i].code != IDchoice))
Index: /trunk/Ohana/src/opihi/dvo/compare.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/compare.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/compare.c	(revision 4865)
@@ -38,8 +38,8 @@
 	   rvec[0].elements[Nmatch] = catlog1[0].average[i].R_PS;
 	   dvec[0].elements[Nmatch] = catlog1[0].average[i].D_PS;
-	   mvec[0].elements[Nmatch] = catlog1[0].average[i].M;
+	   mvec[0].elements[Nmatch] = catlog1[0].average[i].M_PS;
 	  drvec[0].elements[Nmatch] = dX;
 	  ddvec[0].elements[Nmatch] = dY;
-	  dmvec[0].elements[Nmatch] = catlog1[0].average[i].M - catlog2[0].average[j].M;
+	  dmvec[0].elements[Nmatch] = catlog1[0].average[i].M_PS - catlog2[0].average[j].M_PS;
 	  Nmatch ++;
 	  if (Nmatch == NMATCH - 1) {
Index: /trunk/Ohana/src/opihi/dvo/dmt.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dmt.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/dmt.c	(revision 4865)
@@ -88,5 +88,5 @@
       if (catalog.average[i].Nm != 3) continue;
       m = catalog.average[i].offset;
-      M0 = (Ns == -1) ? 0.001*catalog.average[i].M : 0.001*catalog.secfilt[i*Nsec+Ns].M;
+      M0 = (Ns == -1) ? catalog.average[i].M_PS : catalog.secfilt[i*Nsec+Ns].M_PS;
       M1 = PhotCat (&catalog.measure[m+0]);
       M2 = PhotCat (&catalog.measure[m+1]);
Index: /trunk/Ohana/src/opihi/dvo/gstar.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/gstar.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/gstar.c	(revision 4865)
@@ -142,11 +142,11 @@
 
       /* average mags */
-      print_value (GetOutfile(), 0.001*catalog.average[k].M, catalog.average[k].M);
-      for (j = 0; j < Nsec; j++) print_value (GetOutfile(), 0.001*catalog.secfilt[j + Nsec*k].M, catalog.secfilt[j + Nsec*k].M);
+      print_value (GetOutfile(), catalog.average[k].M_PS, catalog.average[k].M_PS);
+      for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].M_PS, catalog.secfilt[j + Nsec*k].M_PS);
       fprintf (GetOutfile(), "\n");
 
       /* average mag errors */
-      print_value (GetOutfile(), 0.001*catalog.average[k].dM, catalog.average[k].dM);
-      for (j = 0; j < Nsec; j++) print_value (GetOutfile(), 0.001*catalog.secfilt[j + Nsec*k].dM, catalog.secfilt[j + Nsec*k].dM);
+      print_value (GetOutfile(), catalog.average[k].dM_PS, catalog.average[k].dM_PS);
+      for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].dM_PS, catalog.secfilt[j + Nsec*k].dM_PS);
       fprintf (GetOutfile(), "\n");
 
@@ -166,5 +166,5 @@
 	    date = sec_to_date (catalog.measure[m].t);
 	    fprintf (GetOutfile(), "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n", 
-		     Mcat, Mrel, 0.001*catalog.measure[m].dM,
+		     Mcat, Mrel, catalog.measure[m].dM_PS,
 		     date, catalog.measure[m].dR_PS, catalog.measure[m].dD_PS,
 		     catalog.measure[m].dophot, catalog.measure[m].flags,
@@ -176,5 +176,5 @@
 	    vec1[0].elements[N] = Mcat;
 	    vec2[0].elements[N] = catalog.measure[m].t;
-	    vec3[0].elements[N] = 0.001*catalog.measure[m].airmass;
+	    vec3[0].elements[N] = catalog.measure[m].airmass_PS;
 	    vec4[0].elements[N] = catalog.measure[m].source;
 	    N ++;
Index: /trunk/Ohana/src/opihi/dvo/imdata.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/imdata.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/imdata.c	(revision 4865)
@@ -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 / 1000.0;
+	vec[0].elements[N] = catalog.measure[i].M_PS;
 	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 / 1000.0;
+	vec[0].elements[N] = catalog.measure[i].dM_PS;
 	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 / 1000.0;
+	vec[0].elements[N] = catalog.measure[i].Mcal_PS;
 	N++;
 	CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -179,5 +179,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].M / 1000.0;
+	vec[0].elements[N] = catalog.average[n].M_PS;
 	N++;
       }
Index: /trunk/Ohana/src/opihi/dvo/lcurve.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/lcurve.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/lcurve.c	(revision 4865)
@@ -134,5 +134,5 @@
       m = catalog.average[N1[i]].offset;
       for (j = 0; j < catalog.average[N1[i]].Nm; j++, m++) {
-	if (ErrorBars) dYvec.elements[N] = 0.001*catalog.measure[m].dM;
+	if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM_PS;
 	Xvec.elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
 	Yvec.elements[N] = PhotCat (&catalog.measure[m]);
Index: /trunk/Ohana/src/opihi/dvo/lightcurve.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/lightcurve.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/lightcurve.c	(revision 4865)
@@ -123,5 +123,5 @@
 
 	tvec[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
-	dmvec[0].elements[N] = 0.001*catalog.measure[m].dM;
+	dmvec[0].elements[N] = catalog.measure[m].dM_PS;
 	if (RELPHOT) {
 	  mvec[0].elements[N] = PhotCat (&catalog.measure[m]);
Index: /trunk/Ohana/src/opihi/dvo/photometry.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/photometry.c	(revision 4864)
+++ /trunk/Ohana/src/opihi/dvo/photometry.c	(revision 4865)
@@ -22,5 +22,5 @@
     if (TimeSelect && (M.t < tzero)) continue; \
     if (TimeSelect && (M.t > tend)) continue; \
-    if (ErrSelect  && (M.dM > ErrValue)) continue; \
+    if (ErrSelect  && (M.dM_PS > ErrValue)) continue; \
     if (TypeSelect && (TypeValue != GetMeasureTypeCode (&M))) continue; \
     if (iMagSelect && (PhotInst (&M) < iMagMin)) continue; \
@@ -432,5 +432,5 @@
   if ((N = get_argument (*argc, argv, "-errorlim"))) {
     remove_argument (N, argc, argv);
-    ErrValue = 1000*atof (argv[N]);
+    ErrValue = atof (argv[N]);
     remove_argument (N, argc, argv);
     ErrSelect = TRUE;
@@ -622,5 +622,5 @@
       for (i = 0; i < average[0].Nm; i++) {
 	if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source))) continue;
-	if (ErrSelect && (measure[i].dM > ErrValue)) continue;
+	if (ErrSelect && (measure[i].dM_PS > ErrValue)) continue;
 	if (FlagSelect && (measure[i].flags != FlagValue)) continue;
 	if (TypeSelect && (TypeValue != GetMeasureTypeCode (&measure[i]))) continue;
@@ -789,5 +789,5 @@
   /* for ErrSelect, check average errors */
   if (ErrSelect) {
-    dM = iPhotdM (code, average, secfilt);
+    dM = PhotdM (code, average, secfilt);
     if (dM > ErrValue) return (NO_MAG);
   }
@@ -847,4 +847,5 @@
    average[].M is stored as 1000*mag where mag is PhotAbs
    measure[].M for PHOT_REL is the same 
+   XXX EAM : note that we are transitioning away from millimag internal storage 
 */ 
 
@@ -1063,11 +1064,11 @@
       break;
     case MEAS_dMAG: /* OK */
-      value = 0.001*measure[0].dM;
+      value = measure[0].dM_PS;
       break;
     case MEAS_AIRMASS: /* OK */
-      value = 0.001*measure[0].airmass;
+      value = measure[0].airmass_PS;
       break;
     case MEAS_EXPTIME: /* OK */
-      value = pow (10.0, measure[0].dt * 0.0004);
+      value = pow (10.0, measure[0].dt_PS * 0.4);
       break;
     case MEAS_PHOTCODE: /* OK */
Index: /trunk/Ohana/src/relphot/include/relphot.h
===================================================================
--- /trunk/Ohana/src/relphot/include/relphot.h	(revision 4864)
+++ /trunk/Ohana/src/relphot/include/relphot.h	(revision 4865)
@@ -15,8 +15,8 @@
   unsigned int start;
   unsigned int stop;
-  short int Mcal;
-  short int dMcal;
-  short int Xm;
-  short int secz;
+  float Mcal;
+  float dMcal;
+  short Xm;
+  float secz;
   char code;
   Coords coords;
@@ -133,8 +133,8 @@
 int           gcatalog            PROTO((Catalog *catalog, int FINAL));
 Coords       *getCoords           PROTO((int meas, int cat));
-short         getMcal             PROTO((int meas, int cat));
-short         getMgrid            PROTO((int meas, int cat));
-short         getMmos             PROTO((int meas, int cat));
-short         getMrel             PROTO((Catalog *catalog, int meas, int cat));
+float         getMcal             PROTO((int meas, int cat));
+float         getMgrid            PROTO((int meas, int cat));
+float         getMmos             PROTO((int meas, int cat));
+float         getMrel             PROTO((Catalog *catalog, int meas, int cat));
 GSCRegion    *get_regions         PROTO((double minRa, double maxRa, double minDec, double maxDec, int *Nregions));
 void          getfullregion       PROTO((Image *image, int Nimage, GSCRegion *fullregion));
Index: /trunk/Ohana/src/relphot/src/ConfigInit.c
===================================================================
--- /trunk/Ohana/src/relphot/src/ConfigInit.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/ConfigInit.c	(revision 4865)
@@ -22,7 +22,5 @@
   GetConfig (config, "IMAGE_SCATTER",          "%lf", 0, &IMAGE_SCATTER);
   GetConfig (config, "IMAGE_OFFSET",           "%lf", 0, &IMAGE_OFFSET);
-  MAG_LIM *= 1000;
-  SIGMA_LIM *= 1000;
-  STAR_SCATTER *= 1000;
+
   IMAGE_SCATTER *= 1000;
   IMAGE_OFFSET *= 1000;
Index: /trunk/Ohana/src/relphot/src/GridOps.v2.c
===================================================================
--- /trunk/Ohana/src/relphot/src/GridOps.v2.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/GridOps.v2.c	(revision 4865)
@@ -2,6 +2,6 @@
 
 static int     Ngrid;
-static short   *gridM;
-static short   *gridS;
+static float   *gridM;
+static float   *gridS;
 static int     *gridN;
 static int      gridX;
@@ -36,9 +36,9 @@
   Ngrid = gridX * gridY;
 
-  ALLOCATE (gridM, short, Ngrid);
-  ALLOCATE (gridS, short, Ngrid);
+  ALLOCATE (gridM, float, Ngrid);
+  ALLOCATE (gridS, float, Ngrid);
   ALLOCATE (gridN, int,   Ngrid);
-  bzero (gridM, Ngrid*sizeof(short));
-  bzero (gridS, Ngrid*sizeof(short));
+  bzero (gridM, Ngrid*sizeof(float));
+  bzero (gridS, Ngrid*sizeof(float));
   bzero (gridN, Ngrid*sizeof(int));
 
@@ -87,9 +87,9 @@
   Ngrid = gridX * gridY;
 
-  ALLOCATE (gridM, short, Ngrid);
-  ALLOCATE (gridS, short, Ngrid);
+  ALLOCATE (gridM, float, Ngrid);
+  ALLOCATE (gridS, float, Ngrid);
   ALLOCATE (gridN, int,   Ngrid);
-  bzero (gridM, Ngrid*sizeof(short));
-  bzero (gridS, Ngrid*sizeof(short));
+  bzero (gridM, Ngrid*sizeof(float));
+  bzero (gridS, Ngrid*sizeof(float));
   bzero (gridN, Ngrid*sizeof(int));
 
@@ -232,8 +232,8 @@
 # endif
 
-short getMgrid (int meas, int cat) {
+float getMgrid (int meas, int cat) {
 
   int i;
-  short value;
+  float value;
 
   if (!USE_GRID) return (0);
@@ -250,5 +250,5 @@
   int i, j, m, c, n, N, Nmax;
   double *list, *dlist;
-  short Msys, Mrel, Mcal, Mmos;
+  float Msys, Mrel, Mcal, Mmos;
   StatType stats;
   
@@ -276,7 +276,7 @@
       
       n = catalog[c].measure[m].averef;
-      Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
+      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, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
       N++;
     }
@@ -294,5 +294,5 @@
 
   int i, j, m, c, n, N;
-  short Msys, Mrel, Mcal, Mmos;
+  float Msys, Mrel, Mcal, Mmos;
   double *xlist, *Mlist, *dlist, *ylist;
   Graphdata graphdata;
@@ -322,5 +322,5 @@
 
       n = catalog[c].measure[m].averef;
-      Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
+      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
 
       xlist[N] = Xmeas[c][m];
@@ -328,6 +328,4 @@
       Mlist[N] = Msys - Mrel - Mcal - Mmos;
       dlist[N] = Msys - Mrel - Mcal - Mmos - gridM[i];
-      Mlist[N] *= 0.001;
-      dlist[N] *= 0.001;
       N++;
     }
Index: /trunk/Ohana/src/relphot/src/ImageOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/ImageOps.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/ImageOps.c	(revision 4865)
@@ -136,8 +136,8 @@
 }
 
-short getMcal (int meas, int cat) {
+float getMcal (int meas, int cat) {
 
   int i;
-  short value;
+  float value;
 
   i = bin[cat][meas];
@@ -145,5 +145,5 @@
 
   if (image[i].code & IMAGE_BAD)  return (NO_MAG);  
-  value = image[i].Mcal;
+  value = 0.001*image[i].Mcal;
   return (value);
 }
@@ -162,5 +162,5 @@
 
   int i, j, m, c, n, N, Nmax, mark, bad;
-  short Msys, Mrel, Mmos, Mgrid;
+  float Msys, Mrel, Mmos, Mgrid;
   double *list, *dlist;
   StatType stats;
@@ -199,7 +199,7 @@
       
       n = catalog[c].measure[m].averef;
-      Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
+      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, MIN_ERROR);
+      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
       N++;
     }
@@ -217,6 +217,6 @@
     
     liststats (list, dlist, N, &stats);
-    image[i].Mcal  = stats.mean;
-    image[i].dMcal = stats.sigma;
+    image[i].Mcal  = 1000.0*stats.mean;
+    image[i].dMcal = 1000.0*stats.sigma;
     image[i].Xm    = 100.0*log10(stats.chisq);
   }
Index: /trunk/Ohana/src/relphot/src/MosaicOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/MosaicOps.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/MosaicOps.c	(revision 4865)
@@ -134,6 +134,6 @@
       Dmin = MIN (Dmin, D);
       Dmax = MAX (Dmax, D);
-      Mcal += image[m].Mcal;
-      dMcal += image[m].dMcal;
+      Mcal += 0.001*image[m].Mcal;
+      dMcal += 0.001*image[m].dMcal;
       Xm += image[m].Xm;
       /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */
@@ -179,6 +179,6 @@
     for (j = 0; j < Nimlist[i]; j++) {
       im = imlist[i][j];
-      image[im].Mcal = mosaic[i].Mcal;
-      image[im].dMcal = mosaic[i].dMcal;
+      image[im].Mcal = 1000.0*mosaic[i].Mcal;
+      image[im].dMcal = 1000.0*mosaic[i].dMcal;
       image[im].Xm = mosaic[i].Xm;
       image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);
@@ -292,8 +292,8 @@
 }
 
-short getMmos (int meas, int cat) {
+float getMmos (int meas, int cat) {
 
   int i;
-  short value;
+  float value;
 
   if (!MOSAICNAME[0]) return (0);
@@ -309,5 +309,5 @@
 
   int i, j, m, c, n, N, Nmax, mark, bad;
-  short Msys, Mrel, Mcal, Mgrid;
+  float Msys, Mrel, Mcal, Mgrid;
   double *list, *dlist, *Mlist, *dMlist;
   StatType stats;
@@ -351,9 +351,9 @@
       
       n = catalog[c].measure[m].averef;
-      Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
+      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, MIN_ERROR);
-      Mlist[N] = 0.001*Msys;
-      dMlist[N] = 0.001*list[N];
+      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
+      Mlist[N] = Msys;
+      dMlist[N] = list[N];
       N++;
     }
Index: /trunk/Ohana/src/relphot/src/StarOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/StarOps.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/StarOps.c	(revision 4865)
@@ -20,13 +20,13 @@
 }  
 
-short getMrel (Catalog *catalog, int meas, int cat) {
+float getMrel (Catalog *catalog, int meas, int cat) {
 
   int ave;
-  short value;
+  float value;
 
   ave = catalog[cat].measure[meas].averef;
   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;
+  value = PhotPrimary ? catalog[cat].average[ave].M_PS : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M_PS;
   return (value);
 }
@@ -35,5 +35,5 @@
 
   int i, j, k, m, N;
-  short Msys, Mcal, Mmos, Mgrid;
+  float Msys, Mcal, Mmos, Mgrid;
   StatType stats;
 
@@ -52,7 +52,7 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
+	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, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
 	N++;
       }
@@ -66,10 +66,10 @@
 
       if (PhotPrimary) {
-	catalog[i].average[j].M = stats.mean;
-	catalog[i].average[j].dM = stats.sigma;
+	catalog[i].average[j].M_PS = stats.mean;
+	catalog[i].average[j].dM_PS = stats.sigma;
 	catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       } else {
-	catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
-	catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma;
+	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].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       }      
@@ -82,5 +82,5 @@
 
   int i, j, k, m, N, Nmax;
-  short Msys, Mcal, Mmos, Mgrid;
+  float Msys, Mcal, Mmos, Mgrid;
   double *list, *dlist;
   StatType stats;
@@ -110,7 +110,7 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
+	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, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
 	N++;
       }
@@ -122,10 +122,10 @@
       /* use sigma or error in dM for output? */
       if (PhotPrimary) {
-	catalog[i].average[j].M = stats.mean;
-	catalog[i].average[j].dM = MAX (stats.sigma, stats.error);
+	catalog[i].average[j].M_PS = stats.mean;
+	catalog[i].average[j].dM_PS = MAX (stats.sigma, stats.error);
 	catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       } else {
-	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].M_PS  = stats.mean;
+	catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = MAX (stats.error, stats.sigma);
 	catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
       }      
@@ -142,5 +142,5 @@
 
   int i, j, k, m;
-  short Mcal, Mmos, Mgrid;
+  float Mcal, Mmos, Mgrid;
 
   MEAS_BAD = ID_MEAS_NOCAL;
@@ -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 = Mcal + Mmos + Mgrid;
+	catalog[i].measure[m].Mcal_PS = Mcal + Mmos + Mgrid;
       }
     }
@@ -166,5 +166,5 @@
 
   int i, j, Ndel, Nave, Ntot, mark;
-  short dM, Xm;
+  float dM, Xm;
   double Chisq, MaxScatter, MaxChisq;
   double *xlist, *slist, *dlist;
@@ -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;
+      slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
       dlist[Ntot] = 1;
       Ntot ++;
@@ -198,11 +198,11 @@
   liststats (slist, dlist, Ntot, &stats);
   MaxScatter = MAX (STAR_SCATTER, 2*stats.median);
-  fprintf (stderr, "Max Scatter: %f, Max Chisq: %f\n", 0.001*MaxScatter, MaxChisq);
+  fprintf (stderr, "Max Scatter: %f, Max Chisq: %f\n", MaxScatter, MaxChisq);
 
   Ndel = Nave = 0;
   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;
-      Xm = PhotPrimary ? catalog[i].average[j].Xm : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
+      dM = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      Xm = PhotPrimary ? catalog[i].average[j].Xm    : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
       Chisq = pow (10.0, 0.01*Xm);
       mark = (dM > MaxScatter) || (Xm == NO_MAG) || (Chisq > MaxChisq);
@@ -228,5 +228,5 @@
   int *ilist;
   double *tlist, *list, *dlist, Ns;
-  short Msys, Mcal, Mmos, Mgrid;
+  float Msys, Mcal, Mmos, Mgrid;
   StatType stats;
 
@@ -267,7 +267,7 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
+	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, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
 	N++;
       }
@@ -299,7 +299,7 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
+	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, MIN_ERROR);
+	dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
 	ilist[N] = m;
 	N++;
@@ -422,6 +422,6 @@
       if (catalog[i].average[j].code & STAR_BAD) continue;  
 
-      dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
-      list[n] = 0.001*dM;
+      dM = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      list[n] = dM;
       dlist[n] = 1;
       n++;
@@ -438,5 +438,5 @@
 
   int i, j, bin;
-  short dMrel;
+  float dMrel;
   double *xlist, *Mlist;
   Graphdata graphdata;
@@ -451,6 +451,6 @@
     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;
-      bin = 0.001*dMrel / 0.0025;
+      dMrel = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
+      bin = dMrel / 0.0025;
       bin = MAX (0, MIN (NBIN-1, bin));
       Mlist[bin] += 1.0;
@@ -482,6 +482,6 @@
     for (j = 0; j < catalog[i].Naverage; j++) {
       if (catalog[i].average[j].code & STAR_BAD) continue;
-      xlist[N] = PhotPrimary ? 0.001*catalog[i].average[j].M : 0.001*catalog[i].secfilt[PhotNsec*j+PhotSec].M;
-      value    = PhotPrimary ? catalog[i].average[j].Xm : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
+      xlist[N] = PhotPrimary ? catalog[i].average[j].M_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
+      value    = PhotPrimary ? catalog[i].average[j].Xm   : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
       if (value == NO_MAG) continue;
       ylist[N] = 0.01*value;
Index: /trunk/Ohana/src/relphot/src/args.c
===================================================================
--- /trunk/Ohana/src/relphot/src/args.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/args.c	(revision 4865)
@@ -113,5 +113,5 @@
   if ((N = get_argument (argc, argv, "-minerror"))) {
     remove_argument (N, &argc, argv);
-    MIN_ERROR = 1000.0*atof (argv[N]);
+    MIN_ERROR = atof (argv[N]);
     remove_argument (N, &argc, argv);
     /* require MIN_ERROR > 0 */
@@ -135,7 +135,7 @@
   if ((N = get_argument (argc, argv, "-instmag"))) {
     remove_argument (N, &argc, argv);
-    ImagMin = 1000*atof (argv[N]);
+    ImagMin = atof (argv[N]);
     remove_argument (N, &argc, argv);
-    ImagMax = 1000*atof (argv[N]);
+    ImagMax = atof (argv[N]);
     remove_argument (N, &argc, argv);
     ImagSelect = TRUE;
Index: /trunk/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /trunk/Ohana/src/relphot/src/bcatalog.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/bcatalog.c	(revision 4865)
@@ -5,5 +5,5 @@
   int i, j, offset, ecode;
   int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm;
-  int mag;
+  float mag;
 
   /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */
@@ -31,8 +31,8 @@
 
     if (RESET) {
-      short *p;
-      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M;
+      float *p;
+      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M_PS : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M_PS;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM;
+      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM_PS : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM_PS;
       *p = NO_MAG;
       subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW;
@@ -59,13 +59,13 @@
 
       /* select measurements by mag limit */
-      mag = iPhotCat (&catalog[0].measure[offset]);
+      mag = PhotCat (&catalog[0].measure[offset]);
       if (mag > MAG_LIM) continue;
 
       /* select measurements by measurement error */
-      if (catalog[0].measure[offset].dM > SIGMA_LIM) continue;
+      if (catalog[0].measure[offset].dM_PS > SIGMA_LIM) continue;
 
       /* select measurements by mag limit */
       if (ImagSelect) {
-	mag = iPhotInst (&catalog[0].measure[offset]);
+	mag = PhotInst (&catalog[0].measure[offset]);
 	if (mag < ImagMin) continue;
 	if (mag > ImagMax) continue;
@@ -76,5 +76,5 @@
       subcatalog[0].measure[Nmeasure].averef = Naverage;
       if (RESET) { 
-	subcatalog[0].measure[Nmeasure].Mcal = 0;
+	subcatalog[0].measure[Nmeasure].Mcal_PS = 0;
 	subcatalog[0].measure[Nmeasure].flags &= 0xff00;
 	subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR;
Index: /trunk/Ohana/src/relphot/src/plot_scatter.c
===================================================================
--- /trunk/Ohana/src/relphot/src/plot_scatter.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/plot_scatter.c	(revision 4865)
@@ -4,5 +4,5 @@
 
   int i, j, k, m, N, Ntot;
-  short Mrel, Mcal, Mmos, Mgrid;
+  float Mrel, Mcal, Mmos, Mgrid;
   double *xlist, *ylist, *ilist;
   Graphdata graphdata;
@@ -32,10 +32,8 @@
 	if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
 
-	Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M;
+	Mrel = PhotPrimary ? catalog[i].average[j].M_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
 	xlist[N] = Mrel;
-	ylist[N] = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel;
+	ylist[N] = PhotSys  (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel;
 	ilist[N] = PhotInst (&catalog[i].measure[m]);
-	xlist[N] *= 0.001;
-	ylist[N] *= 0.001;
 	N++;
       }
Index: /trunk/Ohana/src/relphot/src/setMrelFinal.c
===================================================================
--- /trunk/Ohana/src/relphot/src/setMrelFinal.c	(revision 4864)
+++ /trunk/Ohana/src/relphot/src/setMrelFinal.c	(revision 4865)
@@ -4,5 +4,6 @@
 
   int i, j, m, ecode;
-  short *p;
+  float *p;
+  short *q;
 
   /* if we reset the catalog, reset all the current measurements */
@@ -10,10 +11,10 @@
 
     for (i = 0; i < catalog[0].Naverage; i++) {
-      p = (PhotPrimary) ? &catalog[0].average[i].M : &catalog[0].secfilt[PhotNsec*i+PhotSec].M;
+      p = (PhotPrimary) ? &catalog[0].average[i].M_PS  : &catalog[0].secfilt[PhotNsec*i+PhotSec].M_PS;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM;
+      p = (PhotPrimary) ? &catalog[0].average[i].dM_PS : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM_PS;
       *p = NO_MAG;
-      p = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm;
-      *p = NO_MAG;
+      q = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm;
+      *q = NO_MAG;
 
       m = catalog[0].average[i].offset;
@@ -30,5 +31,5 @@
 	}
 	
-	catalog[0].measure[m].Mcal = 0;
+	catalog[0].measure[m].Mcal_PS = 0;
 	catalog[0].measure[m].flags &= 0xff00;
 	catalog[0].measure[m].flags &= ~ID_MEAS_POOR;
@@ -72,5 +73,5 @@
   int i, k, m, ecode, d1, d2;
   int Ntot, Ntry, Nkeep, Nskip;
-  short mag;
+  float mag;
 
   Ntot = Ntry = Nskip = Nkeep = 0;
@@ -114,5 +115,5 @@
       /* skip measurements by inst mag limit */
       if ((pass < 4) && ImagSelect) {
-	mag = iPhotInst (&catalog[0].measure[m]);
+	mag = PhotInst (&catalog[0].measure[m]);
 	if (mag < ImagMin) goto skip;
 	if (mag > ImagMax) goto skip;
Index: /trunk/Ohana/src/uniphot/include/uniphot.h
===================================================================
--- /trunk/Ohana/src/uniphot/include/uniphot.h	(revision 4864)
+++ /trunk/Ohana/src/uniphot/include/uniphot.h	(revision 4865)
@@ -30,7 +30,7 @@
 typedef struct {
   char label[64];
-  short int M;
-  short int dM;
-  short int dMsub;
+  float M;
+  float dM;
+  float dMsub;
   double v1, v2;
   Image **image;
Index: /trunk/Ohana/src/uniphot/src/update_catalog.c
===================================================================
--- /trunk/Ohana/src/uniphot/src/update_catalog.c	(revision 4864)
+++ /trunk/Ohana/src/uniphot/src/update_catalog.c	(revision 4865)
@@ -5,5 +5,5 @@
   int i, j, m, found;
   int Primary, Nsec, Nsecfilt;
-  short *Mp;
+  float *Mp;
   PhotCode *code;
 
@@ -15,5 +15,5 @@
   for (i = 0; i < catalog[0].Naverage; i++) {
     
-    Mp = Primary ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].M;
+    Mp = Primary ? &catalog[0].average[i].M_PS : &catalog[0].secfilt[i*Nsecfilt+Nsec].M_PS;
     if (*Mp != NO_MAG) *Mp += sgroup[0].M;
 
@@ -24,5 +24,5 @@
       if (code[0].type != PHOT_DEP) continue;
       if (code[0].equiv != photcode[0].code) continue;
-      catalog[0].measure[m].Mcal -= sgroup[0].M;
+      catalog[0].measure[m].Mcal_PS -= sgroup[0].M;
       found ++;
     }
