Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/SEDfit.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/SEDfit.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/SEDfit.c	(revision 36903)
@@ -162,9 +162,12 @@
     }
 
+    double R = incat[0].average[i].R;
+    double D = incat[0].average[i].D;
+
     for (j = 0; valid && (j < Nmodel); j++) {
       n = modelRow[j];
       dvo_measure_init (&outcat[0].measure[Nmeas]);
-      outcat[0].measure[Nmeas].dR        = 0.0;
-      outcat[0].measure[Nmeas].dD        = 0.0;
+      outcat[0].measure[Nmeas].R         = R;
+      outcat[0].measure[Nmeas].D         = D;
       outcat[0].measure[Nmeas].M         = table[0].row[minFit.row][0].mags[n] + minFit.Md;
       outcat[0].measure[Nmeas].dM        = 0.0;
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches.c	(revision 36903)
@@ -160,6 +160,6 @@
 
       // the following measure elements cannot be set until here:
-      catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
-      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].average.D);
+      catalog[0].measure[Nmeas].R        = stars[N].average.R;
+      catalog[0].measure[Nmeas].D        = stars[N].average.D;
       catalog[0].measure[Nmeas].dbFlags  = 0;
       catalog[0].measure[Nmeas].averef   = n; // this must be an absolute sequence number, if partial average is loaded 
@@ -167,16 +167,18 @@
       catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
+      float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
+
       // rationalize dR:
-      if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
+      if (dRoff > +180.0*3600.0) {
 	  // average on high end of boundary, move star up
-	  stars[N].average.R += 360.0;
-	  catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
-      }
-      if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
+	  catalog[0].measure[Nmeas].R += 360.0;
+	  dRoff -= 360.0*3600.0;
+      }
+      if (dRoff < -180.0*3600.0) {
 	  // average on low end of boundary, move star down
-	  stars[N].average.R -= 360.0;
-	  catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
-      }
-      if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
+	  catalog[0].measure[Nmeas].R -= 360.0;
+	  dRoff += 360.0*3600.0;
+      }
+      if (dRoff > 10*RADIUS) {
 	  fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 
 		   catalog[0].average[n].R, catalog[0].average[n].D, 
@@ -274,6 +276,6 @@
 
       // the following measure elements cannot be set until here:
-      catalog[0].measure[Nmeas].dR       	= 0.0;
-      catalog[0].measure[Nmeas].dD       	= 0.0;
+      catalog[0].measure[Nmeas].R       	= stars[i].average.R;
+      catalog[0].measure[Nmeas].D       	= stars[i].average.D;
       catalog[0].measure[Nmeas].dbFlags 	= 0;
       catalog[0].measure[Nmeas].averef   	= Nave; // XXX EAM : must be absolute Nave if partial read
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest.c	(revision 36903)
@@ -187,6 +187,6 @@
 
     /** dR,dD now represent arcsec **/
-    catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
-    catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].average.D);
+    catalog[0].measure[Nmeas].R        = stars[N].average.R;
+    catalog[0].measure[Nmeas].D        = stars[N].average.D;
     catalog[0].measure[Nmeas].dbFlags  = 0;
     catalog[0].measure[Nmeas].averef   = n;
@@ -194,16 +194,18 @@
     catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
+    float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
+
     // rationalize dR
-    if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
+    if (dRoff > +180.0*3600.0) {
       // average on high end of boundary, move star up
-      stars[N].average.R += 360.0;
-      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
-    }
-    if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
+      catalog[0].measure[Nmeas].R += 360.0;
+      dRoff -= 360.0*3600.0;
+    }
+    if (dRoff < -180.0*3600.0) {
       // average on low end of boundary, move star down
-      stars[N].average.R -= 360.0;
-      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
-    }
-    if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
+      catalog[0].measure[Nmeas].R -= 360.0;
+      dRoff += 360.0*3600.0;
+    }
+    if (dRoff > 10*RADIUS) {
       fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 
 	       catalog[0].average[n].R, catalog[0].average[n].D, 
@@ -282,6 +284,6 @@
 
         // the following measure elements cannot be set until here:
-        catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
-        catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
+        catalog[0].measure[Nmeas].R        = stars[i].average.R;
+        catalog[0].measure[Nmeas].D        = stars[i].average.D;
         catalog[0].measure[Nmeas].dbFlags  = 0;
         catalog[0].measure[Nmeas].averef   = Nave;
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest_refstars.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest_refstars.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest_refstars.c	(revision 36903)
@@ -180,6 +180,6 @@
 
     /** *** dR,dD now in arcsec *** **/
-    catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
-    catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].average.D);
+    catalog[0].measure[Nmeas].R        = stars[N][0].average.R;
+    catalog[0].measure[Nmeas].D        = stars[N][0].average.D;
     catalog[0].measure[Nmeas].dbFlags  = 0;
     catalog[0].measure[Nmeas].averef   = n;
@@ -187,14 +187,16 @@
     catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
+    float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
+
     // rationalize dR:
-    if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
+    if (dRoff > +180.0*3600.0) {
       // average on high end of boundary, move star up
-      stars[N][0].average.R += 360.0;
-      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
-    }
-    if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
+      catalog[0].measure[Nmeas].R += 360.0;
+      dRoff -= 360.0*3600.0;
+    }
+    if (dRoff < -180.0*3600.0) {
       // average on low end of boundary, move star down
-      stars[N][0].average.R -= 360.0;
-      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
+      catalog[0].measure[Nmeas].R -= 360.0;
+      dRoff += 360.0*3600.0;
     }
 
@@ -290,6 +292,6 @@
       catalog[0].measure[Nmeas]          = stars[N][0].measure;
 
-      catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
-      catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
+      catalog[0].measure[Nmeas].R       = catalog[0].average[Nave].R;
+      catalog[0].measure[Nmeas].D       = catalog[0].average[Nave].D;
       catalog[0].measure[Nmeas].dbFlags  = 0;
       catalog[0].measure[Nmeas].averef   = Nave;
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_refstars.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_refstars.c	(revision 36903)
@@ -141,7 +141,7 @@
       catalog[0].measure[Nmeas]          = stars[N][0].measure;
 
-      /** *** dR,dD now in arcsec *** **/
-      catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
-      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].average.D);
+      /** measure now stores R,D **/
+      catalog[0].measure[Nmeas].R        = stars[N][0].average.R;
+      catalog[0].measure[Nmeas].D        = stars[N][0].average.D;
       catalog[0].measure[Nmeas].dbFlags  = 0;
       catalog[0].measure[Nmeas].averef   = n;
@@ -149,14 +149,16 @@
       catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
+      float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
+
       // rationalize dR:
-      if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
+      if (dRoff > +180.0*3600.0) {
 	  // average on high end of boundary, move star up
-	  stars[N][0].average.R += 360.0;
-	  catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
-      }
-      if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
+	  catalog[0].measure[Nmeas].R += 360.0;
+	  dRoff -= 360.0*3600.0;
+      }
+      if (dRoff < -180.0*3600.0) {
 	  // average on low end of boundary, move star down
-	  stars[N][0].average.R -= 360.0;
-	  catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
+	  catalog[0].measure[Nmeas].R -= 360.0;
+	  dRoff += 360.0*3600.0;
       }
 
@@ -262,6 +264,6 @@
       catalog[0].measure[Nmeas]          = stars[N][0].measure;
 
-      catalog[0].measure[Nmeas].dR       = 0.0;
-      catalog[0].measure[Nmeas].dD       = 0.0;
+      catalog[0].measure[Nmeas].R        = stars[N][0].average.R;
+      catalog[0].measure[Nmeas].D        = stars[N][0].average.D;
 
       catalog[0].measure[Nmeas].t        = (stars[N][0].measure.t == 0) ? TIMEREF : stars[N][0].measure.t;      /** careful : time_t vs e_time **/
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/load2mass_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/load2mass_catalog.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/load2mass_catalog.c	(revision 36903)
@@ -17,10 +17,13 @@
   for (i = 0; i < Nstars; i+=3) {
 
+    double R = stars[i].average.R;
+    double D = stars[i].average.D;
+
     // construct an average object for this object
     // XXX for now, the output objects will have limited astrometric interpretation...
     // XXX every 3 stars represents 3 measurements and 1 average
     dvo_average_init (&catalog[0].average[Nave]);
-    catalog[0].average[Nave].R     = stars[i].average.R;
-    catalog[0].average[Nave].D     = stars[i].average.D;
+    catalog[0].average[Nave].R     = R;
+    catalog[0].average[Nave].D     = D;
     catalog[0].average[Nave].measureOffset = Nmeas;
 
@@ -33,6 +36,6 @@
       catalog[0].measure[Nmeas]           = stars[i+j].measure;
 
-      catalog[0].measure[Nmeas].dR        = 0.0;
-      catalog[0].measure[Nmeas].dD        = 0.0;
+      catalog[0].measure[Nmeas].R         = R;
+      catalog[0].measure[Nmeas].D         = D;
       catalog[0].measure[Nmeas].dt        = NAN_S_SHORT;
 
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/replace_match.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/replace_match.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/replace_match.c	(revision 36903)
@@ -12,6 +12,6 @@
     j = i + m;
     if (measure[j].photcode != star[0].measure.photcode) continue;
-    measure[j].dR = 3600.0*(average[0].R - star[0].average.R);
-    measure[j].dD = 3600.0*(average[0].D - star[0].average.D);
+    measure[j].R = star[0].average.R;
+    measure[j].D = star[0].average.D;
     measure[j].M  = star[0].measure.M;
     measure[j].dM = star[0].measure.dM;
Index: /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/update_coords.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/update_coords.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/update_coords.c	(revision 36903)
@@ -19,6 +19,6 @@
       continue;
     }
-    R = measure[m].dR;
-    D = measure[m].dD;
+    R = measure[m].R;
+    D = measure[m].D;
     r += R;
     d += D;
@@ -33,13 +33,8 @@
   r = r / Npt;  /* these are corrections in 1/100 arcsec to RA and DEC */
   d = d / Npt;
-  average[0].R -= r / 3600.0;
-  average[0].D -= d / 3600.0;
+  average[0].R = r;
+  average[0].D = d;
   m = average[0].measureOffset;  /* first measurement of this star */
-  for (i = 0; i < average[0].Nmeasure; i++) {
-    measure[m].dR -= r;
-    measure[m].dD -= d;
-    m = next[m];
-  }
-  
+
   /* measure scatter, if possible */
   if (Npt < 2) return;
@@ -47,5 +42,5 @@
   dR2 = r2 / Npt - r*r;
   dD2 = d2 / Npt - d*d;
-  average[0].ChiSqAve = sqrt (dD2 + dR2 / SQ(cos(d*RAD_DEG)));
+  average[0].ChiSqAve = 3600.0*sqrt (dD2 + dR2 / SQ(cos(d*RAD_DEG)));
   /* ChiSqAve is supposed to be a chisq */
 
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/BrightCatalog.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/BrightCatalog.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/BrightCatalog.c	(revision 36903)
@@ -68,6 +68,6 @@
  
     // need to create and assign to flat-field correction
-    GET_COLUMN(dR,        "RA_OFF",   	float);
-    GET_COLUMN(dD,        "DEC_OFF",  	float);
+    GET_COLUMN(R,         "RA",   	double);
+    GET_COLUMN(D,         "DEC",  	double);
     GET_COLUMN(M,         "MAG_SYS",  	float);
     GET_COLUMN(Mcal,      "MAG_CAL",  	float);
@@ -92,6 +92,6 @@
     ALLOCATE (measure, MeasureTiny, Nrow);
     for (i = 0; i < Nrow; i++) {
-      measure[i].dR        = dR[i];
-      measure[i].dD        = dD[i];
+      measure[i].R         = R[i];
+      measure[i].D         = D[i];
       measure[i].M         = M[i];
       measure[i].Mcal      = Mcal[i];
@@ -113,6 +113,6 @@
     // fprintf (stderr, "loaded data for %lld measures\n", (long long) Nrow);
 
-    free (dR      );
-    free (dD      );
+    free (R       );
+    free (D       );
     free (M       );
     free (Mcal    );
@@ -262,6 +262,6 @@
     GET_COLUMN(Ncode, "NCODE",    short);
     GET_COLUMN(Nused, "NUSED",    short);
-    GET_COLUMN(M_20,  "MAG_20",   short);
-    GET_COLUMN(M_80,  "MAG_80",   short);
+    GET_COLUMN(Mmin,  "MAG_MIN",  float);
+    GET_COLUMN(Mmax,  "MAG_MAX",  float);
     gfits_free_header (&theader);
     gfits_free_table  (&ftable);
@@ -276,6 +276,6 @@
       secfilt[i].Ncode = Ncode[i];
       secfilt[i].Nused = Nused[i];
-      secfilt[i].M_20  = M_20[i];
-      secfilt[i].M_80  = M_80[i];
+      secfilt[i].Mmin  = Mmin[i];
+      secfilt[i].Mmax  = Mmax[i];
     }
     fprintf (stderr, "loaded data for %lld averages\n", (long long) Nrow);
@@ -287,6 +287,6 @@
     free (Ncode);
     free (Nused);
-    free (M_20 );
-    free (M_80 );
+    free (Mmin );
+    free (Mmax );
     catalog->secfilt = secfilt;
     // assert Nsecfilt * Naverage = Nrow?
@@ -363,28 +363,28 @@
 
     // create intermediate storage arrays
-    float *dR        ; ALLOCATE (dR       ,  float, catalog->Nmeasure);
-    float *dD        ; ALLOCATE (dD       ,  float, catalog->Nmeasure);
-    float *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
-    float *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
-    float *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
-    float *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
-    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);
-    int   *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
-    int   *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
-    int   *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
-    int   *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
-    int   *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
-    short *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
+    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
+    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
+    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
+    float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
+    float  *dM        ; ALLOCATE (dM       ,  float,  catalog->Nmeasure);
+    float  *airmass   ; ALLOCATE (airmass  ,  float,  catalog->Nmeasure);
+    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);
+    int    *averef    ; ALLOCATE (averef   ,  int  ,  catalog->Nmeasure);
+    int    *imageID   ; ALLOCATE (imageID  ,  int  ,  catalog->Nmeasure);
+    int    *dbFlags   ; ALLOCATE (dbFlags  ,  int  ,  catalog->Nmeasure);
+    int    *photFlags ; ALLOCATE (photFlags,  int  ,  catalog->Nmeasure);
+    int    *catID     ; ALLOCATE (catID    ,  int  ,  catalog->Nmeasure);
+    short  *photcode  ; ALLOCATE (photcode ,  short,  catalog->Nmeasure);
 
     // assign the storage arrays
     MeasureTiny *measure = catalog->measure;
     for (i = 0; i < catalog->Nmeasure; i++) {
-      dR[i]       = measure[i].dR       ;
-      dD[i]       = measure[i].dD       ;
+      R[i]        = measure[i].R        ;
+      D[i]        = measure[i].D        ;
       M[i]  	  = measure[i].M        ;
       Mcal[i]     = measure[i].Mcal     ;
@@ -406,6 +406,6 @@
 
     // add the columns to the output array
-    gfits_set_bintable_column (&theader, &ftable, "RA_OFF",   	dR,        catalog->Nmeasure);
-    gfits_set_bintable_column (&theader, &ftable, "DEC_OFF",  	dD,        catalog->Nmeasure);
+    gfits_set_bintable_column (&theader, &ftable, "RA",   	R,         catalog->Nmeasure);
+    gfits_set_bintable_column (&theader, &ftable, "DEC",  	D,         catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",  	M,         catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",  	Mcal,      catalog->Nmeasure);
@@ -425,6 +425,6 @@
     gfits_set_bintable_column (&theader, &ftable, "PHOTCODE",   photcode,  catalog->Nmeasure);
 
-    free (dR      );
-    free (dD      );
+    free (R       );
+    free (D       );
     free (M       );
     free (Mcal    );
@@ -629,6 +629,6 @@
     gfits_define_bintable_column (&theader, "I", "NCODE",    "magnitude (err)",           NULL,    1.0, 0.0);
     gfits_define_bintable_column (&theader, "I", "NUSED",    "airmass",                   NULL,    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "MAG_20",   "ccd x coord",              "pix",    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "MAG_80",   "ccd y coord",              "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG_MIN",   "ccd x coord",              "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG_MAX",   "ccd y coord",              "pix",    1.0, 0.0);
 
     // generate the output array that carries the data
@@ -646,6 +646,6 @@
     short *Ncode    ; ALLOCATE (Ncode  ,  short, Nsec);
     short *Nused    ; ALLOCATE (Nused  ,  short, Nsec);
-    short *M_20     ; ALLOCATE (M_20   ,  short, Nsec);
-    short *M_80     ; ALLOCATE (M_80   ,  short, Nsec);
+    float *Mmin     ; ALLOCATE (Mmin   ,  float, Nsec);
+    float *Mmax     ; ALLOCATE (Mmax   ,  float, Nsec);
 
     // assign the storage arrays
@@ -658,6 +658,6 @@
       Ncode [i]       = secfilt[i]. Ncode  ;
       Nused [i]       = secfilt[i]. Nused  ;
-      M_20  [i]       = secfilt[i]. M_20   ;
-      M_80  [i]       = secfilt[i]. M_80   ;
+      Mmin  [i]       = secfilt[i]. Mmin   ;
+      Mmax  [i]       = secfilt[i]. Mmax   ;
     }
 
@@ -669,6 +669,6 @@
     gfits_set_bintable_column (&theader, &ftable, "NCODE",    Ncode, Nsec);
     gfits_set_bintable_column (&theader, &ftable, "NUSED",    Nused, Nsec);
-    gfits_set_bintable_column (&theader, &ftable, "MAG_20",   M_20 , Nsec);
-    gfits_set_bintable_column (&theader, &ftable, "MAG_80",   M_80 , Nsec);
+    gfits_set_bintable_column (&theader, &ftable, "MAG_MIN",  Mmin , Nsec);
+    gfits_set_bintable_column (&theader, &ftable, "MAG_MAX",  Mmax , Nsec);
 
     free (M      );
@@ -678,6 +678,6 @@
     free (Ncode  );
     free (Nused  );
-    free (M_20   );
-    free (M_80   );
+    free (Mmin   );
+    free (Mmax   );
 
     gfits_fwrite_Theader (f, &theader);
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/ImageOps.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/ImageOps.c	(revision 36903)
@@ -406,5 +406,5 @@
   for (j = 0; j < average[0].Nmeasure; j++) {
     off = average[0].measureOffset + j;
-    fprintf (stderr, "dR, dD, mag, dMag: %f, %f, %f, %f\n", measure[off].dR, measure[off].dD, measure[off].M, measure[off].dM);
+    fprintf (stderr, "R, D, mag, dMag: %lf, %lf, %f, %f\n", measure[off].R, measure[off].D, measure[off].M, measure[off].dM);
   }
   return;
@@ -554,27 +554,28 @@
 
     // complain if the new location is far from the old location
-    if (fabs(csdec*(measure[0].dR - dR)) > DPOS_MAX_ASEC) {
+    if (fabs(csdec*(measure[0].R - R)) > DPOS_MAX_ASEC) {
       NoffRAori ++;
       if (VERBOSE2) {
-	fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measure[0].dR, dR, csdec*(measure[0].dR - dR), dD);
+	fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measure[0].R, dR, csdec*(measure[0].R - R), dD);
 	dump_measures (&average[0], catalog[c].measure);
       }
       // abort();
     }
-    if (fabs(measure[0].dD - dD) > DPOS_MAX_ASEC) {
+    if (fabs(measure[0].D - D) > DPOS_MAX_ASEC) {
       NoffDECori ++;
       if (VERBOSE2) {
-	fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measure[0].dD, dD);
+	fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measure[0].D, dD);
 	dump_measures (&average[0], catalog[c].measure);
       }      // abort();
     }
 
-    dPos += SQ(measure[0].dR - dR) + SQ(measure[0].dD - dD);
+    // XXX NOTE : apply csdec:
+    dPos += SQ(measure[0].R - R) + SQ(measure[0].D - D);
     nPos ++;
 
-    measure[0].dR = dR;
-    measure[0].dD = dD;
-    measureT[0].dR = dR;
-    measureT[0].dD = dD;
+    measure[0].R = R;
+    measure[0].D = D;
+    measureT[0].R = R;
+    measureT[0].D = D;
     
     // set the systematic error for this image:
@@ -661,16 +662,17 @@
     }
 
-    measure[0].dR = dR;
-    measure[0].dD = dD;
-
-    if (measure[0].dR > +180.0*3600.0) {
+    measure[0].R = R;
+    measure[0].D = D;
+
+    fprintf (stderr, "redo this\n")
+    if (dR > +180.0*3600.0) {
       // average on high end of boundary, move star up
       R += 360.0;
-      measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
-    }
-    if (measure[0].dR < -180.0*3600.0) {
+      measure[0].R = R;
+    }
+    if (dR < -180.0*3600.0) {
       // average on low end of boundary, move star down
       R -= 360.0;
-      measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
+      measure[0].R = R;
     }
   }
@@ -734,5 +736,5 @@
       raw[i].mask |= MARK_TOO_FEW_MEAS;
     }
-    if (!finite(measure[0].dR) || !finite(measure[0].dD)) {
+    if (!finite(measure[0].R) || !finite(measure[0].D)) {
       raw[i].mask |= MARK_NAN_POS_ERROR;
     }
@@ -880,6 +882,6 @@
       // skip measurements based on user selected criteria
       if (!MeasFilterTest(&measure[k], FALSE)) continue;
-      R[N] = measure[k].dR;
-      D[N] = measure[k].dD;
+      R[N] = measure[k].R;
+      D[N] = measure[k].D;
       dR[N] = GetAstromError (&measure[k], ERROR_MODE_RA);
       dD[N] = GetAstromError (&measure[k], ERROR_MODE_DEC);
@@ -906,6 +908,6 @@
       if (!MeasFilterTest(&measure[k], FALSE)) continue;
       
-      x = measure[k].dR - statsR.median;
-      y = measure[k].dD - statsD.median;
+      x = measure[k].R - statsR.median;
+      y = measure[k].D - statsD.median;
       theta = atan2(y,x);
       if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) + 
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/UpdateObjects.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/UpdateObjects.c	(revision 36903)
@@ -149,5 +149,5 @@
 	  char *date = ohana_sec_to_date (measure[k].t);
 	  int dbFlagsBig = measureBig ? measureBig[k].dbFlags : 0;
-	  fprintf (stderr, OFF_T_FMT" %f %f %s : 0x%08x : 0x%08x\n",  k, measure[k].dR, measure[k].dD, date, measure[k].dbFlags, dbFlagsBig);
+	  fprintf (stderr, OFF_T_FMT" %f %f %s : 0x%08x : 0x%08x\n",  k, measure[k].R, measure[k].D, date, measure[k].dbFlags, dbFlagsBig);
 	  free (date);
 	}
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/dvo_astrom_ops.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/dvo_astrom_ops.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/dvo_astrom_ops.c	(revision 36903)
@@ -1,3 +1,4 @@
 # include "relastro.h"
+/* the Measure carries the instantaneous mean position at the epoch t */ 
 
 double getMeanR (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
@@ -5,6 +6,79 @@
   double ra;
 
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  ra = average[0].R - measure[0].dR / 3600.0;
+  // old: ra = average[0].R - measure[0].dR / 3600.0;
+  if (!measure) return NAN;
+  ra = measure[0].R;
+
+  return (ra);
+}
+
+double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+
+  double dec;
+
+  // old: dec = average[0].D - measure[0].dD / 3600.0;
+  if (!measure) return NAN;
+  dec = measure[0].D;
+
+  return (dec);
+}
+
+int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+
+  // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0;
+  if (!measure) return FALSE;
+  measure[0].R = ra_fit;
+
+  return (TRUE);
+}
+
+int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+
+  // old: measure[0].dD += (dec_fit - average[0].D) * 3600.0;
+  if (!measure) return FALSE;
+  measure[0].D = dec_fit;
+
+  return (TRUE);
+}
+
+double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) {
+
+  double ra;
+
+  // old: ra = average[0].R - measure[0].dR / 3600.0;
+  if (!measure) return NAN;
+  ra = measure[0].R;
+
+  return (ra);
+}
+
+double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) {
+
+  double dec;
+
+  // old: dec = average[0].D - measure[0].dD / 3600.0;
+  if (!measure) return NAN;
+  dec = measure[0].D;
+
+  return (dec);
+}
+
+int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) {
+
+  // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0;
+  if (!measure) return TRUE;
+  measure[0].R = ra_fit;
+
+  return (TRUE);
+}
+
+int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) {
+
+  // measure[0].dD += (dec_fit - average[0].D) * 3600.0;
+  if (!measure) return TRUE;
+  measure[0].D = dec_fit;
+
+  return (TRUE);
+}
 
   /* possible corrections to mean ra:
@@ -18,169 +92,2 @@
   */
 
-  return (ra);
-}
-
-double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
-
-  double dec;
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  dec = average[0].D - measure[0].dD / 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (dec);
-}
-
-int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
-
-  /* math to get from new fitted position to new measure offset
-     ra_obs = average[0].R - measure[0].dR / 3600.0;
-     measure[0].dR = (ra_fit - ra_obs) * 3600.0;
-     measure[0].dR = (ra_fit - average[0].R + measure[0].dR/3600) * 3600.0
-     measure[0].dR = (ra_fit - average[0].R) * 3600.0 + measure[0].dR;
-  */
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  measure[0].dR += (ra_fit - average[0].R) * 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (TRUE);
-}
-
-int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
-
-  /* math to get from new fitted position to new measure offset
-     dec_obs = average[0].D - measure[0].dD / 3600.0;
-     measure[0].dD = (dec_fit - dec_obs) * 3600.0;
-     measure[0].dD = (dec_fit - average[0].D + measure[0].dD/3600) * 3600.0
-     measure[0].dD = (dec_fit - average[0].D) * 3600.0 + measure[0].dD;
-  */
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  measure[0].dD += (dec_fit - average[0].D) * 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (TRUE);
-}
-
-double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) {
-
-  double ra;
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  ra = average[0].R - measure[0].dR / 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (ra);
-}
-
-double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) {
-
-  double dec;
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  dec = average[0].D - measure[0].dD / 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (dec);
-}
-
-int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) {
-
-  if (!measure) return TRUE;
-
-  /* math to get from new fitted position to new measure offset
-     ra_obs = average[0].R - measure[0].dR / 3600.0;
-     measure[0].dR = (ra_fit - ra_obs) * 3600.0;
-     measure[0].dR = (ra_fit - average[0].R + measure[0].dR/3600) * 3600.0
-     measure[0].dR = (ra_fit - average[0].R) * 3600.0 + measure[0].dR;
-  */
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  measure[0].dR += (ra_fit - average[0].R) * 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (TRUE);
-}
-
-int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) {
-
-  if (!measure) return TRUE;
-
-  /* math to get from new fitted position to new measure offset
-     dec_obs = average[0].D - measure[0].dD / 3600.0;
-     measure[0].dD = (dec_fit - dec_obs) * 3600.0;
-     measure[0].dD = (dec_fit - average[0].D + measure[0].dD/3600) * 3600.0
-     measure[0].dD = (dec_fit - average[0].D) * 3600.0 + measure[0].dD;
-  */
-
-  /* the measure carries the instantaneous mean position at the epoch t */ 
-  measure[0].dD += (dec_fit - average[0].D) * 3600.0;
-
-  /* possible corrections to mean ra:
-
-  - proper-motion and parallax
-  - abberation
-  - precession and nutation, etc
-  - refraction
-  - DCR
-
-  */
-
-  return (TRUE);
-}
-
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/high_speed_objects.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/high_speed_objects.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/high_speed_objects.c	(revision 36903)
@@ -241,7 +241,7 @@
 	  for(i1=0;i1<catalog[0].average[nv[l]].Nmeasure;i1++) {
 	      catalogOut.measure[Nmatchmeas]=catalog[0].measure[m+i1];
-	      /*Set offset RA and Dec wrt correct average value*/
-	      catalogOut.measure[Nmatchmeas].dR=catalog[0].measure[m+i1].dR+3600.0*(catalog[0].average[nv[0]].R-catalog[0].average[nv[l]].R);
-	      catalogOut.measure[Nmatchmeas].dD=catalog[0].measure[m+i1].dD+3600.0*(catalog[0].average[nv[0]].D-catalog[0].average[nv[l]].D);
+	      // DROP no longer necessary to repoint R,D
+	      // catalogOut.measure[Nmatchmeas].dR=catalog[0].measure[m+i1].dR+3600.0*(catalog[0].average[nv[0]].R-catalog[0].average[nv[l]].R);
+	      // catalogOut.measure[Nmatchmeas].dD=catalog[0].measure[m+i1].dD+3600.0*(catalog[0].average[nv[0]].D-catalog[0].average[nv[l]].D);
 	      catalogOut.measure[Nmatchmeas].averef = Nmatch;
 	      Nmatchmeasobj++;
@@ -297,7 +297,7 @@
   // XXX require a set or not?  assert (Nset > 0);
 
-  if (!finite(measure[0].dR)) return FALSE;
-  if (!finite(measure[0].dD)) return FALSE;
-  if (!finite(measure[0].M))  return FALSE;
+  if (!finite(measure[0].R)) return FALSE;
+  if (!finite(measure[0].D)) return FALSE;
+  if (!finite(measure[0].M)) return FALSE;
   
   float dX = GetAstromError (measure, ERROR_MODE_RA);
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/hpm_objects.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/hpm_objects.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/hpm_objects.c	(revision 36903)
@@ -240,7 +240,7 @@
       for (k = 0; k < catalog[0].average[nj].Nmeasure; k++) {
 	testcat.measure[Nmatchmeas] = catalog[0].measure[m+k];
-	/* Set offset RA and Dec wrt correct average value*/
-	testcat.measure[Nmatchmeas].dR = catalog[0].measure[m+k].dR + 3600.0*(catalog[0].average[ni].R - catalog[0].average[nj].R);
-	testcat.measure[Nmatchmeas].dD = catalog[0].measure[m+k].dD + 3600.0*(catalog[0].average[ni].D - catalog[0].average[nj].D);
+	// DROP: was needed when dR,dD were relative to average.R,D
+	// testcat.measure[Nmatchmeas].R = catalog[0].measure[m+k].R;
+	// testcat.measure[Nmatchmeas].D = catalog[0].measure[m+k].D;
 	testcat.measure[Nmatchmeas].averef = 0;
 	Nmatchmeas++;
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastroVisual.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastroVisual.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastroVisual.c	(revision 36903)
@@ -418,5 +418,5 @@
 			       StatType statsR, StatType statsD, double thresh) {
     
-  float *Din, *Rin, *Dout, *Rout;
+  double *Din, *Rin, *Dout, *Rout;
   double xmin, xmax, ymin, ymax, range;
   float xCirc[100], yCirc[100];
@@ -451,17 +451,17 @@
     meas = catalog[0].measure[m];
     if (!MeasFilterTest(&meas, FALSE)) continue;
-    xmin = MIN(xmin, meas.dR);
-    xmax = MAX(xmax, meas.dR);
-    ymin = MIN(ymin, meas.dD);
-    ymax = MAX(ymax, meas.dD);
+    xmin = MIN(xmin, meas.R);
+    xmax = MAX(xmax, meas.R);
+    ymin = MIN(ymin, meas.D);
+    ymax = MAX(ymax, meas.D);
     
     if (meas.dbFlags & ID_MEAS_POOR_ASTROM) {
-      Rout[Nout] = (float)(meas.dR);
-      Dout[Nout] = (float)(meas.dD);
+      Rout[Nout] = (meas.R);
+      Dout[Nout] = (meas.D);
       fprintf(stderr, "r: %f\td: %f\t outlier: 1\n", Rout[Nout], Dout[Nout]);
       Nout++;
     } else {
-      Rin[Nin] = (float)(meas.dR);
-      Din[Nin] = (float)(meas.dD);
+      Rin[Nin] = (meas.R);
+      Din[Nin] = (meas.D);
       fprintf(stderr, "r: %f\td: %f\t outlier: 0\n", Rin[Nin], Din[Nin]);
       Nin++;
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastro_merge_source.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastro_merge_source.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastro_merge_source.c	(revision 36903)
@@ -100,11 +100,12 @@
       catalog_src.measure[m].averef = index_dst;
 
+      // OLD CODE: when measure.dR,dD were relative to average.R,D it was necessary to modify them
       // get the instantaneous positions:
-      double R = catalog_src.average[index_src].R - catalog_src.measure[m].dR / 3600.0;
-      double D = catalog_src.average[index_src].D - catalog_src.measure[m].dD / 3600.0;
+      // DROP double R = catalog_src.average[index_src].R - catalog_src.measure[m].dR / 3600.0;
+      // DROP double D = catalog_src.average[index_src].D - catalog_src.measure[m].dD / 3600.0;
 
       // update the offset coordinates to match the new source
-      catalog_src.measure[m].dR = 3600.0*(catalog_src.average[index_dst].R - R);
-      catalog_src.measure[m].dD = 3600.0*(catalog_src.average[index_dst].D - D);
+      // DROP catalog_src.measure[m].dR = 3600.0*(catalog_src.average[index_dst].R - R);
+      // DROP catalog_src.measure[m].dD = 3600.0*(catalog_src.average[index_dst].D - D);
     }
 
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/BrightCatalog.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/BrightCatalog.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/BrightCatalog.c	(revision 36903)
@@ -63,6 +63,6 @@
  
     // need to create and assign to flat-field correction
-    GET_COLUMN(dR,        "RA_OFF",   	float);
-    GET_COLUMN(dD,        "DEC_OFF",  	float);
+    GET_COLUMN(R,         "RA",   	double);
+    GET_COLUMN(D,         "DEC",  	double);
     GET_COLUMN(M,         "MAG_SYS",  	float);
     GET_COLUMN(Mcal,      "MAG_CAL",  	float);
@@ -85,6 +85,6 @@
     ALLOCATE (measure, MeasureTiny, Nrow);
     for (i = 0; i < Nrow; i++) {
-      measure[i].dR        = dR[i];
-      measure[i].dD        = dD[i];
+      measure[i].R         = R[i];
+      measure[i].D         = D[i];
       measure[i].M         = M[i];
       measure[i].Mcal      = Mcal[i];
@@ -105,6 +105,6 @@
     fprintf (stderr, "loaded data for %lld measure\n", (long long) Nrow);
 
-    free (dR      );
-    free (dD      );
+    free (R       );
+    free (D       );
     free (M       );
     free (Mcal    );
@@ -136,6 +136,6 @@
  
     // need to create and assign to flat-field correction
-    GET_COLUMN(R,             "RA",   	   double);
-    GET_COLUMN(D,             "DEC",  	   double);
+    GET_COLUMN(R,             "RA",   	     double);
+    GET_COLUMN(D,             "DEC",  	     double);
     GET_COLUMN(Nmeasure,      "NMEAS",       int);
     GET_COLUMN(measureOffset, "MEASURE_OFF", int);
@@ -188,6 +188,6 @@
     GET_COLUMN(Ncode, "NCODE",    short);
     GET_COLUMN(Nused, "NUSED",    short);
-    GET_COLUMN(M_20,  "MAG_20",   short);
-    GET_COLUMN(M_80,  "MAG_80",   short);
+    GET_COLUMN(Mmin,  "MAG_MIN",  float);
+    GET_COLUMN(Mmax,  "MAG_MAX",  float);
     gfits_free_header (&theader);
     gfits_free_table  (&ftable);
@@ -202,6 +202,6 @@
       secfilt[i].Ncode = Ncode[i];
       secfilt[i].Nused = Nused[i];
-      secfilt[i].M_20  = M_20[i];
-      secfilt[i].M_80  = M_80[i];
+      secfilt[i].Mmin  = Mmin[i];
+      secfilt[i].Mmax  = Mmax[i];
     }
     fprintf (stderr, "loaded data for %lld secfilt\n", (long long) Nrow);
@@ -213,6 +213,6 @@
     free (Ncode);
     free (Nused);
-    free (M_20 );
-    free (M_80 );
+    free (Mmin );
+    free (Mmax );
     catalog->secfilt = secfilt;
     // assert Nsecfilt * Naverage = Nrow?
@@ -265,6 +265,6 @@
     gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY");
 
-    gfits_define_bintable_column (&theader, "E", "RA_OFF",   "ra offset",                  "arcsec", 1.0, 0.0);
-    gfits_define_bintable_column (&theader, "E", "DEC_OFF",  "dec offset",                 "arcsec", 1.0, 0.0);
+    gfits_define_bintable_column (&theader, "D", "RA",       "ra",                         "degree", 1.0, 0.0);
+    gfits_define_bintable_column (&theader, "D", "DEC",      "dec",                        "degree", 1.0, 0.0);
     gfits_define_bintable_column (&theader, "E", "MAG_SYS",  "magnitude (sys)",             NULL,    1.0, 0.0);
     gfits_define_bintable_column (&theader, "E", "MAG_CAL",  "magnitude (cal)",             NULL,    1.0, 0.0);
@@ -286,26 +286,26 @@
 
     // create intermediate storage arrays
-    float *dR        ; ALLOCATE (dR       ,  float, catalog->Nmeasure);
-    float *dD        ; ALLOCATE (dD       ,  float, catalog->Nmeasure);
-    float *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
-    float *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
-    float *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
-    float *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
-    float *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
-    float *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
-    float *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
-    int   *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
-    int   *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
-    int   *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
-    int   *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
-    int   *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
-    int   *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
-    short *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
+    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
+    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
+    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
+    float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
+    float  *dM        ; ALLOCATE (dM       ,  float,  catalog->Nmeasure);
+    float  *airmass   ; ALLOCATE (airmass  ,  float,  catalog->Nmeasure);
+    float  *Xccd      ; ALLOCATE (Xccd     ,  float,  catalog->Nmeasure);
+    float  *Yccd      ; ALLOCATE (Yccd     ,  float,  catalog->Nmeasure);
+    float  *dt        ; ALLOCATE (dt       ,  float,  catalog->Nmeasure);
+    int    *t         ; ALLOCATE (t        ,  int  ,  catalog->Nmeasure);
+    int    *averef    ; ALLOCATE (averef   ,  int  ,  catalog->Nmeasure);
+    int    *imageID   ; ALLOCATE (imageID  ,  int  ,  catalog->Nmeasure);
+    int    *dbFlags   ; ALLOCATE (dbFlags  ,  int  ,  catalog->Nmeasure);
+    int    *photFlags ; ALLOCATE (photFlags,  int  ,  catalog->Nmeasure);
+    int    *catID     ; ALLOCATE (catID    ,  int  ,  catalog->Nmeasure);
+    short  *photcode  ; ALLOCATE (photcode ,  short,  catalog->Nmeasure);
 
     // assign the storage arrays
     MeasureTiny *measure = catalog->measure;
     for (i = 0; i < catalog->Nmeasure; i++) {
-      dR[i]       = measure[i].dR       ;
-      dD[i]       = measure[i].dD       ;
+      R[i]        = measure[i].R       ;
+      D[i]        = measure[i].D       ;
       M[i]  	  = measure[i].M        ;
       Mcal[i]     = measure[i].Mcal     ;
@@ -325,6 +325,6 @@
 
     // add the columns to the output array
-    gfits_set_bintable_column (&theader, &ftable, "RA_OFF",   	dR,        catalog->Nmeasure);
-    gfits_set_bintable_column (&theader, &ftable, "DEC_OFF",  	dD,        catalog->Nmeasure);
+    gfits_set_bintable_column (&theader, &ftable, "RA",   	R,         catalog->Nmeasure);
+    gfits_set_bintable_column (&theader, &ftable, "DEC",  	D,         catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",  	M,         catalog->Nmeasure);
     gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",  	Mcal,      catalog->Nmeasure);
@@ -342,6 +342,6 @@
     gfits_set_bintable_column (&theader, &ftable, "PHOTCODE",   photcode,  catalog->Nmeasure);
 
-    free (dR      );
-    free (dD      );
+    free (R       );
+    free (D       );
     free (M       );
     free (Mcal    );
@@ -428,12 +428,12 @@
     gfits_create_table_header (&theader, "BINTABLE", "SECFILT");
 
-    gfits_define_bintable_column (&theader, "E", "MAG",      "ra offset",                "arcsec", 1.0, 0.0);
-    gfits_define_bintable_column (&theader, "E", "MAG_ERR",  "dec offset",               "arcsec", 1.0, 0.0);
-    gfits_define_bintable_column (&theader, "E", "MAG_CHI",  "magnitude (sys)",           NULL,    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "J", "FLAGS",    "magnitude (cal)",           NULL,    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "NCODE",    "magnitude (err)",           NULL,    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "NUSED",    "airmass",                   NULL,    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "MAG_20",   "ccd x coord",              "pix",    1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "MAG_80",   "ccd y coord",              "pix",    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG",      "",              "arcsec", 1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG_ERR",  "",              "arcsec", 1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG_CHI",  "",              NULL,    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "J", "FLAGS",    "",              NULL,    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "I", "NCODE",    "",              NULL,    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "I", "NUSED",    "",              NULL,    1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG_MIN",  "min valid mag", "mag",   1.0, 0.0);
+    gfits_define_bintable_column (&theader, "E", "MAG_MAX",  "max valid mag", "mag",   1.0, 0.0);
 
     // generate the output array that carries the data
@@ -451,6 +451,6 @@
     short *Ncode    ; ALLOCATE (Ncode  ,  short, Nsec);
     short *Nused    ; ALLOCATE (Nused  ,  short, Nsec);
-    short *M_20     ; ALLOCATE (M_20   ,  short, Nsec);
-    short *M_80     ; ALLOCATE (M_80   ,  short, Nsec);
+    float *Mmin     ; ALLOCATE (Mmin   ,  float, Nsec);
+    float *Mmax     ; ALLOCATE (Mmax   ,  float, Nsec);
 
     // assign the storage arrays
@@ -463,6 +463,6 @@
       Ncode [i]       = secfilt[i]. Ncode  ;
       Nused [i]       = secfilt[i]. Nused  ;
-      M_20  [i]       = secfilt[i]. M_20   ;
-      M_80  [i]       = secfilt[i]. M_80   ;
+      Mmin  [i]       = secfilt[i]. Mmin   ;
+      Mmax  [i]       = secfilt[i]. Mmax   ;
     }
 
@@ -474,6 +474,6 @@
     gfits_set_bintable_column (&theader, &ftable, "NCODE",    Ncode, Nsec);
     gfits_set_bintable_column (&theader, &ftable, "NUSED",    Nused, Nsec);
-    gfits_set_bintable_column (&theader, &ftable, "MAG_20",   M_20 , Nsec);
-    gfits_set_bintable_column (&theader, &ftable, "MAG_80",   M_80 , Nsec);
+    gfits_set_bintable_column (&theader, &ftable, "MAG_MIN",  Mmin , Nsec);
+    gfits_set_bintable_column (&theader, &ftable, "MAG_MAX",  Mmax , Nsec);
 
     free (M      );
@@ -483,6 +483,6 @@
     free (Ncode  );
     free (Nused  );
-    free (M_20   );
-    free (M_80   );
+    free (Mmin   );
+    free (Mmax   );
 
     gfits_fwrite_Theader (f, &theader);
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/MosaicOps.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/MosaicOps.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/MosaicOps.c	(revision 36903)
@@ -1782,5 +1782,5 @@
 void plot_mosaic_fields (Catalog *catalog) {
 
-  off_t i, j, m, c, N, ave, Nimage;
+  off_t i, j, m, c, N, Nimage;
   double *xlist, *ylist;
   // double Xmin, Xmax, Ymin, Ymax;
@@ -1812,7 +1812,7 @@
       if (catalog[c].measureT[m].dbFlags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue;
 
-      ave = catalog[c].measureT[m].averef;
-      xlist[N] = catalog[c].averageT[ave].R - catalog[c].measureT[m].dR / 3600.0;
-      ylist[N] = catalog[c].averageT[ave].D - catalog[c].measureT[m].dD / 3600.0;
+      // ave = catalog[c].measureT[m].averef;
+      xlist[N] = catalog[c].measureT[m].R;
+      ylist[N] = catalog[c].measureT[m].D;
       N++;
     }
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/bcatalog.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/bcatalog.c	(revision 36903)
@@ -55,4 +55,6 @@
     if (RESET) {
       int Ns;
+
+# if (0)      
       DVOSecfiltFlags secfiltBits = 
 	ID_SECF_STAR_FEW | 
@@ -66,4 +68,6 @@
 	ID_SECF_USE_UBERCAL |
 	ID_SECF_OBJ_EXT;
+# endif
+
       for (Ns = 0; Ns < Nphotcodes; Ns++) {
 
@@ -71,15 +75,18 @@
 	int Nsec = GetPhotcodeNsec(thisCode);
 
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M      = NAN;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Map    = NAN;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].dM     = NAN;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Mstdev = NAN_S_SHORT;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Xm     = NAN;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_20   = NAN_S_SHORT;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_80   = NAN_S_SHORT;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Ncode  = 0;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Nused  = 0;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~secfiltBits;
-	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].ubercalDist = 1000;
+	fprintf (stderr, "really use dvo_secfilt_init?");
+	dvo_secfilt_init (&subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec]);
+
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M      = NAN;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Map    = NAN;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].dM     = NAN;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Mstdev = NAN_S_SHORT;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Xm     = NAN;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_20   = NAN_S_SHORT;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_80   = NAN_S_SHORT;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Ncode  = 0;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Nused  = 0;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~secfiltBits;
+	// subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].ubercalDist = 1000;
       }
     }
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setExclusions.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setExclusions.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setExclusions.c	(revision 36903)
@@ -35,6 +35,6 @@
 	/* select measurements by mag limit */
 	if (AreaSelect) {
-	  r = catalog[i].averageT[j].R + catalog[i].measureT[m].dR / 3600.0;
-	  d = catalog[i].averageT[j].D + catalog[i].measureT[m].dD / 3600.0;
+	  r = catalog[i].measureT[m].R;
+	  d = catalog[i].measureT[m].D;
 	  if ((coords = getCoords (m, i)) == NULL) goto markbad;
 	  RD_to_XY (&x, &y, r, d, coords);
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setMrelCatalog.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setMrelCatalog.c	(revision 36902)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setMrelCatalog.c	(revision 36903)
@@ -350,6 +350,6 @@
       secfilt[Nsec].Nused = psfstats->Nmeas;
 
-      secfilt[Nsec].M_80 = 1000 * psfstats->Upper80;
-      secfilt[Nsec].M_20 = 1000 * psfstats->Lower20;
+      secfilt[Nsec].Mmax = 1000 * psfstats->max;
+      secfilt[Nsec].Mmin = 1000 * psfstats->min;
 
       // NOTE : use the modified weight for apmags as well as psf mags
@@ -581,8 +581,8 @@
 
     // need to put in AB mag factor to get to Janskies (or uJy?)
-    secfilt[Nsec].FluxPSF   = zpFactor * measure[k].FluxPSF;  
-    secfilt[Nsec].dFluxPSF  = zpFactor * measure[k].dFluxPSF; 
-    secfilt[Nsec].FluxKron  = zpFactor * measure[k].FluxKron; 
-    secfilt[Nsec].dFluxKron = zpFactor * measure[k].dFluxKron;
+    secfilt[Nsec].FpsfStk   = zpFactor * measure[k].FluxPSF;  
+    secfilt[Nsec].dFpsfStk  = zpFactor * measure[k].dFluxPSF; 
+    secfilt[Nsec].FkronStk  = zpFactor * measure[k].FluxKron; 
+    secfilt[Nsec].dFkronStk = zpFactor * measure[k].dFluxKron;
 
     secfilt[Nsec].stackDetectID = ID;
