Index: trunk/psastro/src/psastroLoadRefstars.c
===================================================================
--- trunk/psastro/src/psastroLoadRefstars.c	(revision 33028)
+++ trunk/psastro/src/psastroLoadRefstars.c	(revision 33643)
@@ -180,4 +180,36 @@
     }
 
+    // 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!
+	// select the filter; default to fixed photcode and mag limit otherwise
+	pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, source); // we've already done this before
+	char *filter = psMetadataLookupStr (&status, input->fpa->concepts, "FPA.FILTERID");
+	if (!strcmp(filter, "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(ri, 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"));
 
