Index: /trunk/Ohana/src/relastro/include/relastro.h
===================================================================
--- /trunk/Ohana/src/relastro/include/relastro.h	(revision 35104)
+++ /trunk/Ohana/src/relastro/include/relastro.h	(revision 35105)
@@ -157,4 +157,6 @@
 int    VERBOSE;
 int    VERBOSE2;
+
+int    USE_FIXED_PIXCOORDS;
 
 int    RESET;
Index: /trunk/Ohana/src/relastro/src/BrightCatalog.c
===================================================================
--- /trunk/Ohana/src/relastro/src/BrightCatalog.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/BrightCatalog.c	(revision 35105)
@@ -76,4 +76,6 @@
     GET_COLUMN(Xccd,      "X_CCD",    	float);
     GET_COLUMN(Yccd,      "Y_CCD",    	float);
+    GET_COLUMN(Xfix,      "X_FIX",    	float);
+    GET_COLUMN(Yfix,      "Y_FIX",    	float);
     GET_COLUMN(dt,        "EXPTIME",  	float);
     GET_COLUMN(t,         "TIME",     	int);
@@ -98,4 +100,6 @@
       measure[i].Xccd      = Xccd[i];
       measure[i].Yccd      = Yccd[i];
+      measure[i].Xfix      = Xfix[i];
+      measure[i].Yfix      = Yfix[i];
       measure[i].dt        = dt[i];
       measure[i].t         = t[i];
@@ -117,4 +121,6 @@
     free (Xccd    );
     free (Yccd    );
+    free (Xfix    );
+    free (Yfix    );
     free (dt      );
     free (t       );
@@ -340,6 +346,8 @@
     gfits_define_bintable_column (&theader, "E", "MAG_ERR",  "magnitude (err)",             NULL,    1.0, 0.0);
     gfits_define_bintable_column (&theader, "E", "AIRMASS",  "airmass",                	    NULL,    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "E", "X_CCD",    "ccd x coord",            	   "pix",    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "E", "Y_CCD",    "ccd y coord",            	   "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "X_CCD",    "ccd x raw coord",            "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "Y_CCD",    "ccd y raw coord",            "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "X_FIX",    "ccd x fixed coord",          "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "Y_FIX",    "ccd y fiex coord",       	   "pix",    1.0, 0.0);
     gfits_define_bintable_column (&theader, "E", "EXPTIME",  "-2.5 * log (exposure time)", "sec",    1.0, 0.0);
     gfits_define_bintable_column (&theader, "J", "TIME",     "time of exp",                "sec",    1.0, 1.0*0x8000);
@@ -363,4 +371,6 @@
     float *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
     float *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
+    float *Xfix      ; ALLOCATE (Xfix     ,  float, catalog->Nmeasure);
+    float *Yfix      ; ALLOCATE (Yfix     ,  float, catalog->Nmeasure);
     float *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
     int   *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
@@ -383,4 +393,6 @@
       Xccd[i]     = measure[i].Xccd     ;
       Yccd[i]     = measure[i].Yccd     ;
+      Xfix[i]     = measure[i].Xfix     ;
+      Yfix[i]     = measure[i].Yfix     ;
       dt[i]       = measure[i].dt       ;
       t[i] 	  = measure[i].t        ;
@@ -402,4 +414,6 @@
     gfits_set_bintable_column (&theader, &ftable, "X_CCD",    	Xccd,      catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "Y_CCD",    	Yccd,      catalog->Nmeasure);
+    gfits_set_bintable_column (&theader, &ftable, "X_FIX",    	Xfix,      catalog->Nmeasure);
+    gfits_set_bintable_column (&theader, &ftable, "Y_FIX",    	Yfix,      catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "EXPTIME",  	dt,        catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "TIME",     	t,         catalog->Nmeasure);
@@ -419,4 +433,6 @@
     free (Xccd    );
     free (Yccd    );
+    free (Xfix    );
+    free (Yfix    );
     free (dt      );
     free (t       );
@@ -453,5 +469,5 @@
     gfits_define_bintable_column (&theader, "J", "MEAN_EPOCH",  "mean epoch (PM-PAR ref)", 	         		  "", 1.0, 1.0*0x8000);
     gfits_define_bintable_column (&theader, "J", "TIME_RANGE",  "mean epoch (PM-PAR ref)", 	         		  "", 1.0, 1.0*0x8000);
-    gfits_define_bintable_column (&theader, "E", "SIGMA_POS",   "position scatter", 	                 		  "", 1.0, 0.0);   
+    gfits_define_bintable_column (&theader, "E", "STARGAL_SEP", "star/galaxy separator",                		  "", 1.0, 0.0);   
     gfits_define_bintable_column (&theader, "I", "NUMBER_POS",  "number of detections used for astrometry", 	          "", 1.0, 1.0*0x80);
     gfits_define_bintable_column (&theader, "I", "NMEASURE",    "number of psf measurements", 	                          "", 1.0, 1.0*0x80);
Index: /trunk/Ohana/src/relastro/src/ConfigInit.c
===================================================================
--- /trunk/Ohana/src/relastro/src/ConfigInit.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/ConfigInit.c	(revision 35105)
@@ -35,4 +35,8 @@
   GetConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX);
   GetConfig (config, "ADDSTAR_RADIUS",         "%lf", 0, &ADDSTAR_RADIUS);
+
+  if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS)) {
+    USE_FIXED_PIXCOORDS = FALSE;
+  }
 
   // force CATDIR to be absolute (so parallel mode will work)
Index: /trunk/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- /trunk/Ohana/src/relastro/src/ImageOps.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/ImageOps.c	(revision 35105)
@@ -178,6 +178,6 @@
 	int found = FALSE;
 	for (k = 0; (k < NphotcodesSkip) && !found; k++) {
-	  if (photcodesSkip[k][0].code == catalog[i].measure[j].photcode) found = TRUE;
-	  if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[i].measure[j].photcode)) found = TRUE;
+	  if (photcodesSkip[k][0].code == catalog[i].measureT[j].photcode) found = TRUE;
+	  if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[i].measureT[j].photcode)) found = TRUE;
 	}
 	if (found) continue;
@@ -446,6 +446,11 @@
     Measure *measure = &catalog[c].measure[m];
 
-    X = measure[0].Xccd;
-    Y = measure[0].Yccd;
+    if (USE_FIXED_PIXCOORDS) {
+      X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd;
+      Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd;
+    } else {
+      X = measure[0].Xccd;
+      Y = measure[0].Yccd;
+    }
     n = measure[0].averef;
 
@@ -570,6 +575,11 @@
     Measure *measure = &catalog[c].measure[m];
 
-    X = measure[0].Xccd;
-    Y = measure[0].Yccd;
+    if (USE_FIXED_PIXCOORDS) {
+      X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd;
+      Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd;
+    } else {
+      X = measure[0].Xccd;
+      Y = measure[0].Yccd;
+    }
     n = measure[0].averef;
 
@@ -635,6 +645,11 @@
 
     /* apply the current image transformation or use the current value of R+dR, D+dD? */
-    raw[i].X = measure[0].Xccd;
-    raw[i].Y = measure[0].Yccd;
+    if (USE_FIXED_PIXCOORDS) {
+      raw[i].X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd;
+      raw[i].Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd;
+    } else {
+      raw[i].X = measure[0].Xccd;
+      raw[i].Y = measure[0].Yccd;
+    }
 
     raw[i].Mag  = measure[0].M;
Index: /trunk/Ohana/src/relastro/src/StarMaps.c
===================================================================
--- /trunk/Ohana/src/relastro/src/StarMaps.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/StarMaps.c	(revision 35105)
@@ -73,4 +73,6 @@
     if (N < 0) continue;
 
+    // NOTE: we use Xccd,Yccd even if USE_FIXED_PIXCOORDS is true: the difference is too
+    // small to be relevant for this analysis
     xbin = measure[0].Xccd / starmap[N].Nx;
     ybin = measure[0].Yccd / starmap[N].Ny;
Index: /trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
===================================================================
--- /trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c	(revision 35105)
@@ -117,4 +117,6 @@
     if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       strcpy (command, tmpline); }
     
+    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
+
     if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
     if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
Index: /trunk/Ohana/src/relastro/src/high_speed_catalogs.c
===================================================================
--- /trunk/Ohana/src/relastro/src/high_speed_catalogs.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/high_speed_catalogs.c	(revision 35105)
@@ -154,4 +154,6 @@
     if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       	strcpy (command, tmpline); }
     
+    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
+
     if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
     if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
Index: /trunk/Ohana/src/relastro/src/load_catalogs.c
===================================================================
--- /trunk/Ohana/src/relastro/src/load_catalogs.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/load_catalogs.c	(revision 35105)
@@ -158,4 +158,6 @@
     if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       strcpy (command, tmpline); }
     
+    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
+
     if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
     if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
Index: /trunk/Ohana/src/relastro/src/relastro_objects.c
===================================================================
--- /trunk/Ohana/src/relastro/src/relastro_objects.c	(revision 35104)
+++ /trunk/Ohana/src/relastro/src/relastro_objects.c	(revision 35105)
@@ -150,4 +150,6 @@
     if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       strcpy (command, tmpline); }
     
+    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
+
     if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
     if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
