Index: trunk/Ohana/src/opihi/dvo/photometry.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/photometry.c	(revision 15208)
+++ trunk/Ohana/src/opihi/dvo/photometry.c	(revision 15509)
@@ -28,5 +28,5 @@
 
 # define SETMAG(MOUT,MEAS,MODE) \
-  MOUT = NO_MAG; \
+  MOUT = NAN; \
   if (MODE == MAG_INST) MOUT = PhotInst (&MEAS);  \
   if (MODE == MAG_CAT)  MOUT = PhotCat  (&MEAS); \
@@ -588,5 +588,5 @@
   double value;
 
-  value = NO_MAG;
+  value = NAN;
 
   /* this function requires code set for certain value of param.  
@@ -594,5 +594,5 @@
 
   /* filter by average quantities (eg, chisq, Nphot, etc) */
-  if (!TestAverage (code, average, secfilt, measure)) return (NO_MAG);
+  if (!TestAverage (code, average, secfilt, measure)) return (NAN);
 
   /* assign vector values */
@@ -657,5 +657,5 @@
 	case MAG_REL:
 	case MAG_CAL:
-	  value = NO_MAG;
+	  value = NAN;
 	  for (i = 0; i < average[0].Nm; i++) {
 	      if (code[0].code != measure[i].photcode) continue;
@@ -866,5 +866,5 @@
   if (ErrSelect) {
     dM = PhotdM (code, average, secfilt);
-    if (dM > ErrValue) return (NO_MAG);
+    if (dM > ErrValue) return (NAN);
   }
   
@@ -944,5 +944,5 @@
     ALLOCATE (M, double, 1);
     mag = ExtractAverages (code, mode, average, secfilt, measure, AVE_MAG);
-    if (mag == NO_MAG) {
+    if (isnan(mag)) {
       N = 0;
     } else {
@@ -962,5 +962,5 @@
 
   int i, j, A1, A2, N1, N2, Np, Nlist, NLIST;
-  double *M1, *M2, *list, NoMag;
+  double *M1, *M2, *list;
 
   /* check for special case of measure-measure - this is needed to drop self-matches */
@@ -977,5 +977,4 @@
   ALLOCATE (list, double, NLIST);
   M1 = M2 = NULL;
-  NoMag = NO_MAG * 0.001;
 
   /* one of the two is an average, must do independently */
@@ -988,9 +987,9 @@
   if (N2 == 0) goto skip;
 
-  /* magnitudes may be NO_MAG : set delta to NO_MAG */
+  /* magnitudes may be NAN : set delta to NAN */
   for (i = 0; i < N1; i++) {
     for (j = 0; j < N2; j++) {
-      if ((M1[i] == NoMag) || (M2[j] == NoMag)) {
-	list[Nlist] = NoMag;
+      if (isnan(M1[i]) || isnan(M2[j])) {
+	list[Nlist] = NAN;
       } else {
 	list[Nlist] = M1[i] - M2[j];
@@ -1012,5 +1011,5 @@
 
   int i, j, Np0, Np1, Nlist, NLIST;
-  double *list, M1, M2, NoMag;
+  double *list, M1, M2;
   
   *nlist = 0; 
@@ -1018,5 +1017,4 @@
   NLIST = MAX (1, average[0].Nm*average[0].Nm);
   ALLOCATE (list, double, NLIST);
-  NoMag = NO_MAG * 0.001;
 
   /* must have two code values - drop this test? this is programming case, not a user case */
@@ -1044,6 +1042,6 @@
       TESTMEASURE (measure[j]);
       SETMAG(M2, measure[j], mode[1]);
-      if ((M1 == NoMag) || (M2 == NoMag)) {
-	list[Nlist] = NoMag;
+      if (isnan(M1) || isnan(M2)) {
+	list[Nlist] = NAN;
       } else {
 	list[Nlist] = M1 - M2;
