Index: trunk/Ohana/src/addstar/src/FilterStars.c
===================================================================
--- trunk/Ohana/src/addstar/src/FilterStars.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/FilterStars.c	(revision 15509)
@@ -49,26 +49,27 @@
     }
 
-    if (stars[N].M >= 0.001*NO_MAG) {
-      stars[N].M       = 0.001*NO_MAG;
-    } else {
-      stars[N].M       = stars[N].M + MTIME;
+    // stars->M is either NAN or a valid inst magnitude
+    // stars->dM is either NAN or a valid error
+
+    dMs  = 0.0;
+    dMx = 0.0;
+    if (SUBPIX) {
+      dMs = get_subpix (stars[N].X, stars[N].Y);
+      dMx = scat_subpix (stars[N].X, stars[N].Y);
+      if (!isnan(stars[N].dM)) {
+	stars[N].dM = hypot (stars[N].dM, dMx);
+      }
     }
 
-    if (stars[N].M > 32.77) {
-      fprintf (stderr, "*");
+    if (!isnan(stars[N].M)) {
+      stars[N].M += MTIME - dMs;
     }
-
-    stars[N].dM      = MIN (stars[N].dM, NO_ERR);
-
-    stars[N].Mgal    = MIN (stars[N].Mgal + MTIME, 0.001*NO_MAG);
+    if (!isnan(stars[N].Mgal)) {
+      stars[N].Mgal += MTIME - dMs;
+    }
+    if (!isnan(stars[N].Map)) {
+      stars[N].Map += MTIME - dMs;
+    }
     
-    if (SUBPIX) {
-      dMs = get_subpix (stars[N].X, stars[N].Y);
-      stars[N].M    -= dMs;
-      stars[N].Mgal -= dMs;
-      stars[N].Map  -= dMs;
-      dMs = scat_subpix (stars[N].X, stars[N].Y);
-      stars[N].dM = hypot (stars[N].dM, dMs);
-    }
     N ++;
   }
Index: trunk/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 15509)
@@ -135,7 +135,8 @@
   image[0].trate = 10000 * tmp;
 
-  tmp = 0;
-  gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp);
-  image[0].secz = MIN (NO_MAG, tmp);
+  image[0].secz = NAN;
+  if (gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp)) {
+    image[0].secz = tmp;
+  } 
 
   if (!gfits_scan (header, CCDNumKeyword, "%d", 1, &ccdnum)) {
Index: trunk/Ohana/src/addstar/src/ReadStarsFITS.c
===================================================================
--- trunk/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 15509)
@@ -54,4 +54,5 @@
 
   int i, Nstars, swapped;
+  double ZeroPt;
   Stars *stars = NULL;
   SMPData *smpdata = NULL;
@@ -59,17 +60,27 @@
   swapped = FALSE;
   smpdata = gfits_table_get_SMPData (table, &Nstars, &swapped);
+  ZeroPt = GetZeroPoint();
+
   /* XXX we need to check at least the size of the loaded table */
-
   // XXX use memset to zero-out the elements before setting
+
   ALLOCATE (stars, Stars, Nstars);
   for (i = 0; i < Nstars; i++) {
     stars[i].X      = smpdata[i].X;
     stars[i].Y      = smpdata[i].Y;
-    stars[i].M      = smpdata[i].M;
+
+    if ((smpdata[i].M >= ZeroPt) || isnan(smpdata[i].M)) {
+      stars[i].M    = NAN;
+      stars[i].Mgal = NAN;
+      stars[i].Map  = NAN;
+    } else {
+      stars[i].M    = smpdata[i].M;
+      stars[i].Mgal = smpdata[i].M;
+      stars[i].Map  = smpdata[i].M;
+    }
+
     stars[i].dM     = smpdata[i].dM*0.001;
     stars[i].dophot = smpdata[i].dophot;
 
-    stars[i].Mgal   = smpdata[i].M;
-    stars[i].Map    = smpdata[i].dM;
     stars[i].fx     = smpdata[i].fx;
     stars[i].fy     = smpdata[i].fy;
@@ -88,4 +99,72 @@
 
   ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL);
+  ZeroPt = GetZeroPoint();
+
+  ALLOCATE (stars, Stars, Nstars);
+  for (i = 0; i < Nstars; i++) {
+    stars[i].X       = ps1data[i].X;
+    stars[i].Y       = ps1data[i].Y;
+    stars[i].dX      = ps1data[i].dX;
+    stars[i].dY      = ps1data[i].dY;
+    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
+      stars[i].M     = NAN;
+    } else {
+      stars[i].M     = ps1data[i].M + ZeroPt;
+    }
+    stars[i].dM      = ps1data[i].dM;
+    stars[i].Mpeak   = ps1data[i].Mpeak;
+
+    stars[i].sky     = ps1data[i].sky;
+    stars[i].dsky    = ps1data[i].dSky;
+
+    stars[i].fx      = ps1data[i].fx;
+    stars[i].fy      = ps1data[i].fy;
+    stars[i].df      = ps1data[i].df;
+
+    stars[i].psfProb = ps1data[i].psfProb;
+    stars[i].psfQual = ps1data[i].psfQual;
+
+    stars[i].detID   = ps1data[i].detID;
+
+    /* these are set elsewhere */
+    stars[i].R       = 0.0;
+    stars[i].D       = 0.0;
+    stars[i].dR      = 0.0;
+    stars[i].dD      = 0.0;
+
+    stars[i].uR      = 0.0;
+    stars[i].uD      = 0.0;
+    stars[i].duR     = 0.0;
+    stars[i].duD     = 0.0;
+
+    stars[i].P       = 0.0;
+    stars[i].dP      = 0.0;
+
+    stars[i].Mcal    = 0;
+    stars[i].t       = 0;
+    stars[i].dt      = 0;
+    stars[i].airmass = 0;
+    stars[i].code    = 0;
+    stars[i].found   = 0;
+
+    /* these are not used */
+    stars[i].Map     = NAN;
+    stars[i].Mgal    = NAN;
+    stars[i].dophot  = 0;
+  }    
+  *nstars = Nstars;
+  return (stars);
+}
+
+// XXX I need to make the IPP I/O functions and these functions
+// consistent wrt ZERO_POINT....
+Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) {
+
+  int i, Nstars;
+  double ZeroPt;
+  Stars *stars;
+  PS1_DEV_1 *ps1data;
+
+  ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL);
   ZeroPt = GetZeroPoint();
 
@@ -111,72 +190,4 @@
     stars[i].df      = ps1data[i].df;
 
-    stars[i].psfProb = ps1data[i].psfProb;
-    stars[i].psfQual = ps1data[i].psfQual;
-
-    stars[i].detID   = ps1data[i].detID;
-
-    /* these are set elsewhere */
-    stars[i].R       = 0.0;
-    stars[i].D       = 0.0;
-    stars[i].dR      = 0.0;
-    stars[i].dD      = 0.0;
-
-    stars[i].uR      = 0.0;
-    stars[i].uD      = 0.0;
-    stars[i].duR     = 0.0;
-    stars[i].duD     = 0.0;
-
-    stars[i].P       = 0.0;
-    stars[i].dP      = 0.0;
-
-    stars[i].Mcal    = 0;
-    stars[i].t       = 0;
-    stars[i].dt      = 0;
-    stars[i].airmass = 0;
-    stars[i].code    = 0;
-    stars[i].found   = 0;
-
-    /* these are not used */
-    stars[i].Map     = 0.001*NO_MAG;
-    stars[i].Mgal    = 0.001*NO_MAG;
-    stars[i].dophot  = 0;
-  }    
-  *nstars = Nstars;
-  return (stars);
-}
-
-// XXX I need to make the IPP I/O functions and these functions
-// consistent wrt ZERO_POINT....
-Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) {
-
-  int i, Nstars;
-  double ZeroPt;
-  Stars *stars;
-  PS1_DEV_1 *ps1data;
-
-  ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL);
-  ZeroPt = GetZeroPoint();
-
-  ALLOCATE (stars, Stars, Nstars);
-  for (i = 0; i < Nstars; i++) {
-    stars[i].X       = ps1data[i].X;
-    stars[i].Y       = ps1data[i].Y;
-    stars[i].dX      = ps1data[i].dX;
-    stars[i].dY      = ps1data[i].dY;
-    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
-	stars[i].M   = 0.001*NO_MAG;
-    } else {
-	stars[i].M   = ps1data[i].M + ZeroPt;
-    }
-    stars[i].dM      = ps1data[i].dM;
-    stars[i].Mpeak   = ps1data[i].Mpeak;
-
-    stars[i].sky     = ps1data[i].sky;
-    stars[i].dsky    = ps1data[i].dSky;
-
-    stars[i].fx      = ps1data[i].fx;
-    stars[i].fy      = ps1data[i].fy;
-    stars[i].df      = ps1data[i].df;
-
     stars[i].psfProb   = ps1data[i].psfProb;
     stars[i].psfQual   = ps1data[i].psfQual;
@@ -213,6 +224,6 @@
 
     /* these are not used */
-    stars[i].Map     = 0.001*NO_MAG;
-    stars[i].Mgal    = 0.001*NO_MAG;
+    stars[i].Map     = NAN;
+    stars[i].Mgal    = NAN;
     stars[i].dophot  = 0;
   }    
Index: trunk/Ohana/src/addstar/src/ReadStarsTEXT.c
===================================================================
--- trunk/Ohana/src/addstar/src/ReadStarsTEXT.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/ReadStarsTEXT.c	(revision 15509)
@@ -10,6 +10,9 @@
   char *buffer, *c, *c2;
   double tmp;
+  double ZeroPt;
   Stars *stars;
   
+  ZeroPt = GetZeroPoint();
+
   /* load in stars by blocks of 1000 */
   N = 0;
@@ -66,4 +69,7 @@
       dparse (&stars[N].Y,  2, &buffer[j*BYTES_STAR]);
       dparse (&stars[N].M,  3, &buffer[j*BYTES_STAR]);
+      if ((stars[N].M > ZeroPt) || isnan(stars[N].M)) {
+	stars[N].M = NAN;
+      }
 
       /* cmp files carry dM in millimags */
Index: trunk/Ohana/src/addstar/src/SEDfit.c
===================================================================
--- trunk/Ohana/src/addstar/src/SEDfit.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/SEDfit.c	(revision 15509)
@@ -161,5 +161,5 @@
     outcat[0].average[Nave].Nm        = 0;
     outcat[0].average[Nave].Nn        = 0;
-    outcat[0].average[Nave].Xp        = NO_MAG;
+    outcat[0].average[Nave].Xp        = NAN_S_SHORT;
     outcat[0].average[Nave].offset    = Nmeas;
     outcat[0].average[Nave].missing   = -1;
@@ -167,7 +167,7 @@
 
     for (j = 0; j < Nsec; j++) {
-      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;
+      outcat[0].secfilt[Nave*Nsec+j].M  = NAN;
+      outcat[0].secfilt[Nave*Nsec+j].dM = NAN;
+      outcat[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT;
     }
 
@@ -183,5 +183,5 @@
       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].M        = table[0].row[minFit.row][0].mags[n] + minFit.Md;
       outcat[0].measure[Nmeas].dM       = 0.0;
       outcat[0].measure[Nmeas].Mcal     = 0;
@@ -193,9 +193,9 @@
       outcat[0].measure[Nmeas].dt       = 0xffff;
 
-      outcat[0].measure[Nmeas].Mgal     = NO_MAG;
+      outcat[0].measure[Nmeas].Mgal     = NAN;
       outcat[0].measure[Nmeas].airmass  = 0;
-      outcat[0].measure[Nmeas].FWx         = NO_MAG;
-      outcat[0].measure[Nmeas].FWy         = NO_ERR;
-      outcat[0].measure[Nmeas].theta       = NO_ERR;
+      outcat[0].measure[Nmeas].FWx      = NAN_S_SHORT;
+      outcat[0].measure[Nmeas].FWy      = NAN_S_SHORT;
+      outcat[0].measure[Nmeas].theta    = NAN_S_SHORT;
 
       outcat[0].average[Nave].Nm++;
Index: trunk/Ohana/src/addstar/src/calibrate.c
===================================================================
--- trunk/Ohana/src/addstar/src/calibrate.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/calibrate.c	(revision 15509)
@@ -54,5 +54,5 @@
 
   found0 = found1 = found2 = FALSE;
-  CalM0 = CalM1 = CalM2 = dCalM = NO_MAG;
+  CalM0 = CalM1 = CalM2 = dCalM = NAN;
 
   // we have two options here: 
Index: trunk/Ohana/src/addstar/src/fakeimage.c
===================================================================
--- trunk/Ohana/src/addstar/src/fakeimage.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/fakeimage.c	(revision 15509)
@@ -128,5 +128,5 @@
 
     image[i+1].Mcal = 0.0;
-    image[i+1].Xm   = NO_MAG;
+    image[i+1].Xm   = NAN_S_SHORT;
     image[i+1].code = 0;
     memset (image[i+1].dummy, 0, sizeof(image[i+1].dummy));
@@ -187,5 +187,5 @@
   image[0].ccdnum = 0xff;
   image[0].Mcal = 0.0;
-  image[0].Xm   = NO_MAG;
+  image[0].Xm   = NAN_S_SHORT;
   image[0].code = 0;
   memset (image[0].dummy, 0, sizeof(image[0].dummy));
Index: trunk/Ohana/src/addstar/src/find_matches.c
===================================================================
--- trunk/Ohana/src/addstar/src/find_matches.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/find_matches.c	(revision 15509)
@@ -194,7 +194,7 @@
 
       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);
+      catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
+      catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
+      catalog[0].measure[Nmeas].theta    = (0xffff/360.0)*stars[N].df;
 	
       /* adds the measurement to the calibration if appropriate color terms are found */
@@ -207,7 +207,7 @@
       /* in UPDATE mode, this value is not saved; use relphot to recalculate */
       if (Nsec > -1) { 
-	  if (catalog[0].secfilt[n*Nsecfilt+Nsec].M != NO_MAG) {
-	      catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
-	  }
+	if (isnan(catalog[0].secfilt[n*Nsecfilt+Nsec].M)) {
+	  catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
+	}
       }
 
@@ -282,7 +282,7 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      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].secfilt[Nave*Nsecfilt+j].M  = NAN;
+      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN;
+      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT;
     }
 
@@ -320,7 +320,7 @@
 
     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);
+    catalog[0].measure[Nmeas].FWx      	= 100*stars[N].fx;
+    catalog[0].measure[Nmeas].FWy      	= 100*stars[N].fy;
+    catalog[0].measure[Nmeas].theta    	= (0xffff/360.0)*stars[N].df;
     /* XXX replace df here with theta, right? */
 
Index: trunk/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- trunk/Ohana/src/addstar/src/find_matches_closest.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/find_matches_closest.c	(revision 15509)
@@ -214,14 +214,17 @@
 
     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 saturate range for FWx, FWy, theta
+    // XXX convert to unsigned int for these...
+    catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
+    catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
+    catalog[0].measure[Nmeas].theta    = (0xffff/360.0)*stars[N].df;
 	
     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
     /* in UPDATE mode, this value is not saved; use relphot to recalculate */
     if (Nsec > -1) { 
-	if (catalog[0].secfilt[n*Nsecfilt+Nsec].M != NO_MAG) {
-	    catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
-	}
+      if (isnan(catalog[0].secfilt[n*Nsecfilt+Nsec].M)) {
+	catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
+      }
     }
 
@@ -281,7 +284,7 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      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].secfilt[Nave*Nsecfilt+j].M  = NAN;
+      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN;
+      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT;
     }
 
@@ -319,7 +322,7 @@
 
     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);
+    catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
+    catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
+    catalog[0].measure[Nmeas].theta    = (0xffff/360.0)*stars[N].df;
 
     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
Index: trunk/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- trunk/Ohana/src/addstar/src/find_matches_refstars.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/find_matches_refstars.c	(revision 15509)
@@ -133,6 +133,6 @@
       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].M        = stars[N][0].M;
+      catalog[0].measure[Nmeas].dM       = stars[N][0].dM;
       catalog[0].measure[Nmeas].Mcal     = 0;
       catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
@@ -143,9 +143,9 @@
       catalog[0].measure[Nmeas].dt       = 0xffff;
 
-      catalog[0].measure[Nmeas].Mgal     = NO_MAG;
+      catalog[0].measure[Nmeas].Mgal     = NAN;
       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;
+      catalog[0].measure[Nmeas].FWx      = NAN_S_SHORT;
+      catalog[0].measure[Nmeas].FWy      = NAN_S_SHORT;
+      catalog[0].measure[Nmeas].theta    = NAN_S_SHORT;
 	
       catalog[0].measure[Nmeas].photFlags = 0;
@@ -254,13 +254,13 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      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].secfilt[Nave*Nsecfilt+j].M  = NAN;
+      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN;
+      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT;
     }
 
     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].M        = stars[N][0].M;
+    catalog[0].measure[Nmeas].dM       = stars[N][0].dM;
     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 **/
@@ -291,8 +291,8 @@
 
     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;
+    catalog[0].measure[Nmeas].Mgal     = NAN;
+    catalog[0].measure[Nmeas].FWx      = NAN_S_SHORT;
+    catalog[0].measure[Nmeas].FWy      = NAN_S_SHORT;
+    catalog[0].measure[Nmeas].theta    = NAN_S_SHORT;
 
     catalog[0].measure[Nmeas].Xccd     = 0.0;
Index: trunk/Ohana/src/addstar/src/load2mass_catalog.c
===================================================================
--- trunk/Ohana/src/addstar/src/load2mass_catalog.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/load2mass_catalog.c	(revision 15509)
@@ -34,5 +34,5 @@
     catalog[0].average[Nave].Nm        = 0;
     catalog[0].average[Nave].Nn        = 0;
-    catalog[0].average[Nave].Xp        = NO_MAG;
+    catalog[0].average[Nave].Xp        = NAN_S_SHORT;
     catalog[0].average[Nave].offset    = Nmeas;
     catalog[0].average[Nave].missing   = -1;
@@ -40,7 +40,7 @@
 
     for (j = 0; j < Nsec; j++) {
-      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;
+      catalog[0].secfilt[Nave*Nsec+j].M  = NAN;
+      catalog[0].secfilt[Nave*Nsec+j].dM = NAN;
+      catalog[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT;
     }
 
@@ -49,6 +49,6 @@
       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].M        = stars[i+j].M;
+      catalog[0].measure[Nmeas].dM       = stars[i+j].dM;
       catalog[0].measure[Nmeas].Mcal     = 0;
       catalog[0].measure[Nmeas].t        = stars[i+j].t;
@@ -59,9 +59,9 @@
       catalog[0].measure[Nmeas].dt       = 0xffff;
 
-      catalog[0].measure[Nmeas].Mgal     = NO_MAG;
+      catalog[0].measure[Nmeas].Mgal     = NAN;
       catalog[0].measure[Nmeas].airmass  = 0;
-      catalog[0].measure[Nmeas].FWx         = NO_MAG;
-      catalog[0].measure[Nmeas].FWy         = NO_ERR;
-      catalog[0].measure[Nmeas].theta       = NO_ERR;
+      catalog[0].measure[Nmeas].FWx      = NAN_S_SHORT;
+      catalog[0].measure[Nmeas].FWy      = NAN_S_SHORT;
+      catalog[0].measure[Nmeas].theta    = NAN_S_SHORT;
 
       catalog[0].average[Nave].Nm++;
Index: trunk/Ohana/src/addstar/src/replace_match.c
===================================================================
--- trunk/Ohana/src/addstar/src/replace_match.c	(revision 15487)
+++ trunk/Ohana/src/addstar/src/replace_match.c	(revision 15509)
@@ -8,9 +8,9 @@
   for (i = 0; i < average[0].Nm; i++) {
     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;
+    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  = star[0].M;
+    measure[i].dM = star[0].dM;
+    star[0].found = average[0].offset + i;
     return (TRUE);
   }
