Index: /branches/eam_branches/ipp-20111122/psastro/src/psastroLoadRefstars.c
===================================================================
--- /branches/eam_branches/ipp-20111122/psastro/src/psastroLoadRefstars.c	(revision 33603)
+++ /branches/eam_branches/ipp-20111122/psastro/src/psastroLoadRefstars.c	(revision 33604)
@@ -174,4 +174,33 @@
     }
 
+    // apply a color correction
+    {
+	// from Tonry 
+	// (w-r)_obs = 0.042 + 0.166 (r-i)_obs - 0.398 (r-i)_obs^2,  (r-i)_obs < 0.5
+	// (w-r)_obs = 0.268 - 0.435 (r-i)_obs - 0.078 (r-i)_obs^2,  (r-i)_obs > 0.5
+	// thus, for (r-i < 0.5):
+	// (r - i < 0.5) : w = r + 0.042 + 0.166*(r-i) - 0.398(r-i)^2
+	// (r - i > 0.5) : w = r + 0.268 - 0.435 (r-i) - 0.078(r-i)^2
+
+	// apply a color correction
+	// XXX this is very GPC1 specific and hard-wired -- be very afraid!
+	if (!strcmp(photcode, "w")) {
+	    for (int i = 0; i < refstars->n; i++) {
+		pmAstromObj *ref = refstars->data[i];
+		float r = ref->Mag;
+		float ri = ref->Color;
+		// saturate at some valid range limits
+		ri = PS_MAX (PS_MIN(r, 2.0), -0.2);
+		float w = NAN;
+		if (ri < 0.5) {
+		    w = r + 0.042 + 0.166*(ri) - 0.398*PS_SQR(ri);
+		} else {
+		    w = r + 0.268 - 0.435*(ri) - 0.078*PS_SQR(ri);
+		}
+		ref->Mag = w;
+	    }
+	}
+    }
+
     psLogMsg ("psastro", 3, "loaded %ld reference stars : %f sec\n", refstars->n, psTimerMark ("psastro"));
 
