Index: /trunk/Ohana/src/addstar/doc/Changes.txt
===================================================================
--- /trunk/Ohana/src/addstar/doc/Changes.txt	(revision 4799)
+++ /trunk/Ohana/src/addstar/doc/Changes.txt	(revision 4800)
@@ -1,9 +1,7 @@
-
-2005.08.15:
-	cleanup of the minor Wall,Werror messages
 
 2005.02.24 : I am adding the mosaic two-level astrometry information to the Image table.
 
 2005.07.06 : current release is addstar-1.1
+
 	I have made a variety of fairly substantial changes since
         v1.0.  I have added autocode for the basic DVO data types.  I
@@ -23,3 +21,4 @@
         need to know about the mysql backend interface.  
 
-
+2005.08.15:
+	cleanup of the minor Wall,Werror messages
Index: /trunk/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /trunk/Ohana/src/addstar/src/find_matches.c	(revision 4799)
+++ /trunk/Ohana/src/addstar/src/find_matches.c	(revision 4800)
@@ -74,5 +74,5 @@
   
   for (i = 0; i < Nave; i++) {
-    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
+    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R_PS, catalog[0].average[i].D_PS, &tcoords);
     N2[i] = i;
     catalog[0].found[N2[i]] = -1;
@@ -146,6 +146,7 @@
       
       /** add measurements for this star **/
-      catalog[0].measure[Nmeas].dR       = 360000.0*(catalog[0].average[n].R - stars[N].R);
-      catalog[0].measure[Nmeas].dD       = 360000.0*(catalog[0].average[n].D - stars[N].D);
+      /** dR,dD now represent arcsec **/
+      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N].R);
+      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N].D);
       catalog[0].measure[Nmeas].M        = MIN (1000*stars[N].M + MTIME, NO_MAG);
       catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
@@ -216,5 +217,5 @@
     if (catalog[0].found[n] < 0) { 
       /* should the catalog star be on this image? project into image coords */
-      if (!in_image (catalog[0].average[n].R, catalog[0].average[n].D, image)) continue;
+      if (!in_image (catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, image)) continue;
       /* find last missing meas */
       if (catalog[0].average[n].Nn < 1) { /* no previous missing obs */
@@ -234,5 +235,5 @@
       }
       /* calculate time of exposure for this coordinate in the image */
-      RD_to_XY (&X, &Y, catalog[0].average[n].R, catalog[0].average[n].D, &image[0].coords);	  
+      RD_to_XY (&X, &Y, catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, &image[0].coords);	  
       catalog[0].missing[Nmiss].t  = image[0].tzero + 1e-4*Y*image[0].trate;  /* trate is in 0.1 msec / row */
       catalog[0].average[n].Nn ++;
@@ -254,6 +255,6 @@
     secz = airmass (image[0].secz, stars[N].R, stars[N].D, SiderealTime, Latitude);
 
-    catalog[0].average[Nave].R 	       = stars[N].R;
-    catalog[0].average[Nave].D 	       = stars[N].D;
+    catalog[0].average[Nave].R_PS 	       = stars[N].R;
+    catalog[0].average[Nave].D_PS 	       = stars[N].D;
     catalog[0].average[Nave].M 	       = NO_MAG;
     catalog[0].average[Nave].dM        = NO_MAG;
@@ -273,6 +274,6 @@
     }
 
-    catalog[0].measure[Nmeas].dR       = 0.0;
-    catalog[0].measure[Nmeas].dD       = 0.0;
+    catalog[0].measure[Nmeas].dR_PS       = 0.0;
+    catalog[0].measure[Nmeas].dD_PS       = 0.0;
     catalog[0].measure[Nmeas].M        = MIN (1000*stars[N].M + MTIME, NO_MAG);
     catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N].dM, NO_ERR);
@@ -298,5 +299,5 @@
     for (j = 0; (j < Noverlap) && !SKIP_MISSED; j++) {
       if (!FindMosaicForImage (overlap, Noverlap, j)) continue;
-      if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue;
+      if (!in_image (catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j])) continue;
       if (catalog[0].average[Nave].Nn < 1) {
 	catalog[0].average[Nave].missing = Nmiss;
@@ -306,5 +307,5 @@
       last_miss = Nmiss;
       /* get time of exposure of this portion of the image */
-      RD_to_XY (&X, &Y, catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j].coords);	  
+      RD_to_XY (&X, &Y, catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j].coords);	  
       catalog[0].missing[Nmiss].t  = overlap[j].tzero + 1e-4*Y*overlap[j].trate;  /* rough guess at time */
       catalog[0].average[Nave].Nn ++;
Index: /trunk/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/find_matches_refstars.c	(revision 4799)
+++ /trunk/Ohana/src/addstar/src/find_matches_refstars.c	(revision 4800)
@@ -62,5 +62,5 @@
   
   for (i = 0; i < Nave; i++) {
-    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
+    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R_PS, catalog[0].average[i].D_PS, &tcoords);
     N2[i] = i;
     catalog[0].found[N2[i]] = -1;
@@ -127,6 +127,7 @@
 	
       /** add measurements for this star **/
-      catalog[0].measure[Nmeas].dR       = 360000.0*(catalog[0].average[n].R - stars[N][0].R);
-      catalog[0].measure[Nmeas].dD       = 360000.0*(catalog[0].average[n].D - stars[N][0].D);
+      /** *** dR,dD now in arcsec *** **/
+      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N][0].R);
+      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N][0].D);
       catalog[0].measure[Nmeas].M        = MIN (1000*stars[N][0].M,  NO_MAG);
       catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N][0].dM, NO_ERR);
@@ -192,6 +193,6 @@
     if (stars[N][0].found >= 0) continue;
 
-    catalog[0].average[Nave].R         = stars[N][0].R;
-    catalog[0].average[Nave].D         = stars[N][0].D;
+    catalog[0].average[Nave].R_PS         = stars[N][0].R;
+    catalog[0].average[Nave].D_PS         = stars[N][0].D;
     catalog[0].average[Nave].M         = NO_MAG;
     catalog[0].average[Nave].dM        = NO_MAG;
@@ -211,6 +212,6 @@
     }
 
-    catalog[0].measure[Nmeas].dR       = 0.0;
-    catalog[0].measure[Nmeas].dD       = 0.0;
+    catalog[0].measure[Nmeas].dR_PS       = 0.0;
+    catalog[0].measure[Nmeas].dD_PS       = 0.0;
     catalog[0].measure[Nmeas].M        = MIN (1000*stars[N][0].M,  NO_MAG);
     catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N][0].dM, NO_ERR);
Index: /trunk/Ohana/src/addstar/src/replace_match.c
===================================================================
--- /trunk/Ohana/src/addstar/src/replace_match.c	(revision 4799)
+++ /trunk/Ohana/src/addstar/src/replace_match.c	(revision 4800)
@@ -10,6 +10,6 @@
   for (i = 0; i < average[0].Nm; i++) {
     if (measure[i].source != thiscode[0].code) continue;
-    measure[i].dR       = 360000.0*(average[0].R - star[0].R);
-    measure[i].dD       = 360000.0*(average[0].D - star[0].D);
+    measure[i].dR_PS       = 3600.0*(average[0].R_PS - star[0].R);
+    measure[i].dD_PS       = 3600.0*(average[0].D_PS - star[0].D);
     measure[i].M        = MIN (1000*star[0].M,  NO_MAG);
     measure[i].dM       = MIN (1000*star[0].dM, NO_ERR);
Index: /trunk/Ohana/src/addstar/src/update_coords.c
===================================================================
--- /trunk/Ohana/src/addstar/src/update_coords.c	(revision 4799)
+++ /trunk/Ohana/src/addstar/src/update_coords.c	(revision 4800)
@@ -19,6 +19,6 @@
       continue;
     }
-    R = measure[m].dR;
-    D = measure[m].dD;
+    R = measure[m].dR_PS;
+    D = measure[m].dD_PS;
     r += R;
     d += D;
@@ -33,10 +33,10 @@
   r = r / Npt;  /* these are corrections in 1/100 arcsec to RA and DEC */
   d = d / Npt;
-  average[0].R -= r / 360000.0;
-  average[0].D -= d / 360000.0;
+  average[0].R_PS -= r / 3600.0;
+  average[0].D_PS -= d / 3600.0;
   m = average[0].offset;  /* first measurement of this star */
   for (i = 0; i < average[0].Nm; i++) {
-    measure[m].dR -= r;
-    measure[m].dD -= d;
+    measure[m].dR_PS -= r;
+    measure[m].dD_PS -= d;
     m = next[m];
   }
Index: /trunk/Ohana/src/gastro/src/gptolemy.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gptolemy.c	(revision 4799)
+++ /trunk/Ohana/src/gastro/src/gptolemy.c	(revision 4800)
@@ -41,6 +41,6 @@
   /* select all entries, ignore magnitudes */
   for (i = 0; i < catalog.Naverage; i++, nstar++) {
-    stars[0][nstar].X = catalog.average[i].R;
-    stars[0][nstar].Y = catalog.average[i].D;
+    stars[0][nstar].X = catalog.average[i].R_PS;
+    stars[0][nstar].Y = catalog.average[i].D_PS;
     stars[0][nstar].mag = 0.001*catalog.measure[catalog.average[i].offset].M;
   }
@@ -49,6 +49,6 @@
 # if (0)  
   for (i = 0; i < catalog.Naverage; i++, nstar++) {
-    stars[0][nstar].X = catalog.average[i].R;
-    stars[0][nstar].Y = catalog.average[i].D;
+    stars[0][nstar].X = catalog.average[i].R_PS;
+    stars[0][nstar].Y = catalog.average[i].D_PS;
     GotIt = FALSE;
     if (catalog.average[i].M != NO_MAG) {
Index: /trunk/Ohana/src/gastro2/src/gptolemy2.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/gptolemy2.c	(revision 4799)
+++ /trunk/Ohana/src/gastro2/src/gptolemy2.c	(revision 4800)
@@ -39,6 +39,6 @@
   /* select all entries, ignore magnitudes */
   for (i = 0; i < catalog.Naverage; i++, nstar++) {
-    stars[nstar].R = catalog.average[i].R;
-    stars[nstar].D = catalog.average[i].D;
+    stars[nstar].R = catalog.average[i].R_PS;
+    stars[nstar].D = catalog.average[i].D_PS;
     stars[nstar].M = 0.001*catalog.measure[catalog.average[i].offset].M;
   }
Index: /trunk/Ohana/src/libautocode/def/average-elixir.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average-elixir.d	(revision 4800)
+++ /trunk/Ohana/src/libautocode/def/average-elixir.d	(revision 4800)
@@ -0,0 +1,19 @@
+STRUCT  Average
+EXTNAME DVO_AVERAGE
+TYPE    BINTABLE
+SIZE    32
+
+# elements of data structure / FITS table
+
+FIELD R,              RA,         float,            RA,                	       	  decimal degrees 
+FIELD D,              DEC,        float,            DEC,               	       	  decimal degrees 
+FIELD M,              MAG,        short,            primary mag,       	       	  millimag
+FIELD Nm,             NMEAS,      unsigned short,   number of measures
+FIELD Nn,             NMISS,      unsigned short,   number of missings
+FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
+FIELD Xm,             CHISQ_MAG,  short, 	    chisq for primary mag,        [1000*value]  ?
+FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
+FIELD offset,         offset,     int,     	    offset to first measurement
+FIELD missing,        missing,    int,     	    offset to first missing obs
+FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
+FIELD Xg,             Xg,         short,            best chisq value
Index: /trunk/Ohana/src/libautocode/def/average.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average.d	(revision 4799)
+++ /trunk/Ohana/src/libautocode/def/average.d	(revision 4800)
@@ -2,10 +2,10 @@
 EXTNAME DVO_AVERAGE
 TYPE    BINTABLE
-SIZE    32
+SIZE    40
 
 # elements of data structure / FITS table
 
-FIELD R,              RA,         float,            RA,                	       	  decimal degrees 
-FIELD D,              DEC,        float,            DEC,               	       	  decimal degrees 
+FIELD R_PS,              RA,         double,            RA,                	       	  decimal degrees 
+FIELD D_PS,              DEC,        double,            DEC,               	       	  decimal degrees 
 FIELD M,              MAG,        short,            primary mag,       	       	  millimag
 FIELD Nm,             NMEAS,      unsigned short,   number of measures
Index: /trunk/Ohana/src/libautocode/def/measure-elixir.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure-elixir.d	(revision 4800)
+++ /trunk/Ohana/src/libautocode/def/measure-elixir.d	(revision 4800)
@@ -0,0 +1,23 @@
+STRUCT  Measure
+EXTNAME DVO_MEASURE
+TYPE    BINTABLE
+SIZE    32
+
+# elements of data structure / FITS table
+
+FIELD dR,             D_RA,       short,          RA offset,                	  1/100 arcsec
+FIELD dD,             D_DEC,      short,          DEC offset,               	  1/100 arcsec
+FIELD M,              MAG,        short,          catalog mag,       	       	  millimag
+FIELD Mcal,           Mcal,       short,          image cal mag,	          millimag
+FIELD Mgal,           Mgal,       short,          galaxy mag,			  millimag
+FIELD airmass,        airmass,    short,          (airmass - 1),		  milliairmass
+FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec 
+FIELD dM,             dM,         unsigned char,  mag error,                      millimag
+FIELD fwy,            fwy,        unsigned char,  object fwhm minor/major ratio
+FIELD theta,          theta,      unsigned char,  angle wrt ccd X dir,            (0xff/360) deg
+FIELD dophot,         dophot,     char,           dophot type
+FIELD source,         source,     unsigned short, photcode
+FIELD t,              t,          unsigned int,   time in seconds (UNIX)
+FIELD averef,         averef,     unsigned int,   reference to average entry      
+FIELD dt,             dt,         short,          exposure time,                  2500*log(exptime)
+FIELD flags,          flags,      unsigned short, flags for various uses  
Index: /trunk/Ohana/src/libautocode/def/measure-panstarrs.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure-panstarrs.d	(revision 4800)
+++ /trunk/Ohana/src/libautocode/def/measure-panstarrs.d	(revision 4800)
@@ -0,0 +1,23 @@
+STRUCT  Measure
+EXTNAME DVO_MEASURE
+TYPE    BINTABLE
+SIZE    32
+
+# elements of data structure / FITS table
+
+FIELD dR,             D_RA,       short,          RA offset,                	  1/100 arcsec
+FIELD dD,             D_DEC,      short,          DEC offset,               	  1/100 arcsec
+FIELD M,              MAG,        short,          catalog mag,       	       	  millimag
+FIELD Mcal,           Mcal,       short,          image cal mag,	          millimag
+FIELD Mgal,           Mgal,       short,          galaxy mag,			  millimag
+FIELD airmass,        airmass,    short,          (airmass - 1),		  milliairmass
+FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec 
+FIELD dM,             dM,         unsigned char,  mag error,                      millimag
+FIELD fwy,            fwy,        unsigned char,  object fwhm minor/major ratio
+FIELD theta,          theta,      unsigned char,  angle wrt ccd X dir,            (0xff/360) deg
+FIELD dophot,         dophot,     char,           dophot type
+FIELD source,         source,     unsigned short, photcode
+FIELD t,              t,          unsigned int,   time in seconds (UNIX)
+FIELD averef,         averef,     unsigned int,   reference to average entry      
+FIELD dt,             dt,         short,          exposure time,                  2500*log(exptime)
+FIELD flags,          flags,      unsigned short, flags for various uses  
Index: /trunk/Ohana/src/libautocode/def/measure.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure.d	(revision 4799)
+++ /trunk/Ohana/src/libautocode/def/measure.d	(revision 4800)
@@ -2,10 +2,15 @@
 EXTNAME DVO_MEASURE
 TYPE    BINTABLE
-SIZE    32
+SIZE    36
 
 # elements of data structure / FITS table
 
-FIELD dR,             D_RA,       short,          RA offset,                	  1/100 arcsec
-FIELD dD,             D_DEC,      short,          DEC offset,               	  1/100 arcsec
+# these are the entries from the Elixir DB format:
+# FIELD dR,             D_RA,      short,          RA offset,                	  1/100 arcsec
+# FIELD dD,             D_DEC,     short,          DEC offset,               	  1/100 arcsec
+# replace these with the above names 
+FIELD dR_PS,             D_RA,   float,          RA offset,                	  arcsec
+FIELD dD_PS,             D_DEC,  float,          DEC offset,               	  arcsec
+
 FIELD M,              MAG,        short,          catalog mag,       	       	  millimag
 FIELD Mcal,           Mcal,       short,          image cal mag,	          millimag
Index: /trunk/Ohana/src/libautocode/doc/notes.txt
===================================================================
--- /trunk/Ohana/src/libautocode/doc/notes.txt	(revision 4799)
+++ /trunk/Ohana/src/libautocode/doc/notes.txt	(revision 4800)
@@ -14,6 +14,4 @@
     - fits_fread_datatable_NAME
     - fits_fwrite_datatable_NAME
-
-  
 
 FITS db APIs
@@ -112,2 +110,29 @@
   - unlock file
 
+
+---
+
+DVO tables
+
+I am converting all DVO tables to have an internal representation of
+the table with the necessary precision (ie, double for RA & DEC, etc),
+and a set of external representations in which the precision and
+available columns are truncated to fit a specific representation.  the
+autocode tables then include the internal name (ie, measure.d) and the
+external versions (ie, measure-elixir.d, etc).  
+
+To pursue this, I have modifed the definion of measure.d to replace,
+eg, dR with dR_PS.  I am now compiling all of ohana and looking for
+places where the new name is needed in the code, stopping the
+compilation.  (In the process, I am being forced to clean up the
+relphot - at least - coding problems: unused variables, undeclared
+functions, etc).  After I have made the changes, I will search for all
+instances of dR_PS and return them to their original.
+
+The only things to watch for in this process are units for the
+values.  In the older code, the value of measure.dR was interpreted as
+1/100th of an arcsec.  Everywhere this was the interpretation must be
+changed to make the value represent 1 arcsec.  This will also be an
+issue for the internal magnitude representations, which all use
+millimags...
+
Index: /trunk/Ohana/src/mosastro/src/gptolemy.c
===================================================================
--- /trunk/Ohana/src/mosastro/src/gptolemy.c	(revision 4799)
+++ /trunk/Ohana/src/mosastro/src/gptolemy.c	(revision 4800)
@@ -29,6 +29,6 @@
   for (i = 0; i < catalog.Naverage; i++) {
     bzero (&stars[i], sizeof(StarData));
-    stars[i].R 	 = catalog.average[i].R;
-    stars[i].D 	 = catalog.average[i].D;
+    stars[i].R 	 = catalog.average[i].R_PS;
+    stars[i].D 	 = catalog.average[i].D_PS;
     stars[i].Mag = 0.001*catalog.measure[catalog.average[i].offset].M;
   }
Index: /trunk/Ohana/src/opihi/dvo/calextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/calextract.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/calextract.c	(revision 4800)
@@ -103,6 +103,6 @@
       vec[Nm ][0].elements[N] = M2;
       vec[NC ][0].elements[N] = color;
-      vec[NR ][0].elements[N] = catalog.average[i].R;
-      vec[ND ][0].elements[N] = catalog.average[i].D;
+      vec[NR ][0].elements[N] = catalog.average[i].R_PS;
+      vec[ND ][0].elements[N] = catalog.average[i].D_PS;
       vec[Nd1][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], AVE_dMAG);
       vec[Nd2][0].elements[N] = dM2;
Index: /trunk/Ohana/src/opihi/dvo/calmextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/calmextract.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/calmextract.c	(revision 4800)
@@ -138,6 +138,6 @@
 	vec[Nc ][0].elements[N] = color;
 	vec[Ns ][0].elements[N] = Nstar;
-	vec[NR ][0].elements[N] = catalog.average[i].R;
-	vec[ND ][0].elements[N] = catalog.average[i].D;
+	vec[NR ][0].elements[N] = catalog.average[i].R_PS;
+	vec[ND ][0].elements[N] = catalog.average[i].D_PS;
       }
       Nstar ++; 
Index: /trunk/Ohana/src/opihi/dvo/catalog.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/catalog.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/catalog.c	(revision 4800)
@@ -196,6 +196,6 @@
 	dparse (&D, Ad, tbuffer);
 	dparse (&M, Am, tbuffer);
-	catalog.average[nstar].R = R;
-	catalog.average[nstar].D = D;
+	catalog.average[nstar].R_PS = R;
+	catalog.average[nstar].D_PS = D;
 	catalog.average[nstar].M = M * 1000.0;
 	nstar++;
@@ -238,6 +238,6 @@
 	  dparse (&D, Ad, &tbuffer[i*Bytes_Star]);
 	  dparse (&M, Am, &tbuffer[i*Bytes_Star]);
-	  catalog.average[nstar].R = R;
-	  catalog.average[nstar].D = D;
+	  catalog.average[nstar].R_PS = R;
+	  catalog.average[nstar].D_PS = D;
 	  catalog.average[nstar].M = M * 1000.0;
 	  nstar++;
@@ -288,6 +288,6 @@
 	  dparse (&D, 2, &tbuffer[i*BYTES_STAR]);
 	  dparse (&M, 3, &tbuffer[i*BYTES_STAR]);
-	  catalog.average[nstar].R = R;
-	  catalog.average[nstar].D = D;
+	  catalog.average[nstar].R_PS = R;
+	  catalog.average[nstar].D_PS = D;
 	  catalog.average[nstar].M = M * 1000.0;
 	  nstar++;
@@ -347,7 +347,7 @@
 	if (LimExclude && (Zvec.elements[N] > 0.99)) continue;
 	if (Zvec.elements[N] < 0.011) continue;
-	while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
-	while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
-	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N ++;
+	while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
+	while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
+	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS, catalog.average[i].D_PS, &graphmode.coords)) N ++;
       }
       break;
@@ -362,7 +362,7 @@
 	if (Zvec.elements[N] == 0.01) 
 	  continue;
-	while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
-	while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
-	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N++;
+	while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
+	while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
+	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS, catalog.average[i].D_PS, &graphmode.coords)) N++;
       }
       break;
@@ -377,7 +377,7 @@
 	if (Zvec.elements[N] == 0.01) 
 	  continue;
-	while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
-	while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
-	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N++;
+	while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
+	while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
+	if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS, catalog.average[i].D_PS, &graphmode.coords)) N++;
       }
       break;
Index: /trunk/Ohana/src/opihi/dvo/cmatch.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/cmatch.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/cmatch.c	(revision 4800)
@@ -85,6 +85,6 @@
       dparse (&D, 2, &tbuffer[i*BYTES_STAR]);
       dparse (&M, 3, &tbuffer[i*BYTES_STAR]);
-      catalog2.average[nstar].R = R;
-      catalog2.average[nstar].D = D;
+      catalog2.average[nstar].R_PS = R;
+      catalog2.average[nstar].D_PS = D;
       catalog2.average[nstar].M = M * 1000.0;
       nstar++;
Index: /trunk/Ohana/src/opihi/dvo/compare.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/compare.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/compare.c	(revision 4800)
@@ -19,5 +19,5 @@
   for (i = j = 0; (i < catlog1[0].Naverage) && (j < catlog2[0].Naverage);) {
     
-    dX = catlog1[0].average[i].R - catlog2[0].average[j].R;
+    dX = catlog1[0].average[i].R_PS - catlog2[0].average[j].R_PS;
 
     if (!(i % 100))
@@ -32,10 +32,10 @@
       first_j = j;
       for (j = first_j; (fabs (dX) < radius) && (j < catlog2[0].Naverage); j++) {
-	dX = catlog1[0].average[i].R - catlog2[0].average[j].R;
-	dY = catlog1[0].average[i].D - catlog2[0].average[j].D;
+	dX = catlog1[0].average[i].R_PS - catlog2[0].average[j].R_PS;
+	dY = catlog1[0].average[i].D_PS - catlog2[0].average[j].D_PS;
 	dR = hypot (dX, dY);
 	if (dR < radius) {
-	   rvec[0].elements[Nmatch] = catlog1[0].average[i].R;
-	   dvec[0].elements[Nmatch] = catlog1[0].average[i].D;
+	   rvec[0].elements[Nmatch] = catlog1[0].average[i].R_PS;
+	   dvec[0].elements[Nmatch] = catlog1[0].average[i].D_PS;
 	   mvec[0].elements[Nmatch] = catlog1[0].average[i].M;
 	  drvec[0].elements[Nmatch] = dX;
Index: /trunk/Ohana/src/opihi/dvo/dmt.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dmt.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/dmt.c	(revision 4800)
@@ -97,6 +97,6 @@
       Yvec.elements[N] = (dmt1 + dmt2) / 2.0;
       if (SaveVectors) {
-	Rvec.elements[N] = catalog.average[i].R;
-	Dvec.elements[N] = catalog.average[i].D;
+	Rvec.elements[N] = catalog.average[i].R_PS;
+	Dvec.elements[N] = catalog.average[i].D_PS;
 	Zvec.elements[N] = M0;
       }
Index: /trunk/Ohana/src/opihi/dvo/dvomisc.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dvomisc.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/dvomisc.c	(revision 4800)
@@ -15,6 +15,6 @@
   
   for (i = 0; i < Naverage; i++) {
-    A = average[i].R;
-    D = average[i].D;
+    A = average[i].R_PS;
+    D = average[i].D_PS;
     SD =  cos(RAD_DEG*A + zeta)*sin(theta)*cos(RAD_DEG*D) + cos(theta)*sin(RAD_DEG*D);
     CD = sqrt (1 - SD*SD);
@@ -28,6 +28,6 @@
       RA += 360;
     
-    average[i].R = RA;
-    average[i].D = DEC; 
+    average[i].R_PS = RA;
+    average[i].D_PS = DEC; 
   }
 
@@ -59,6 +59,6 @@
     j = (l << 1) + 1;
     while (j <= ir) {
-      if (j < ir && ave[j].R < ave[j+1].R) j++;
-      if (tmp.R < ave[j].R) {
+      if (j < ir && ave[j].R_PS < ave[j+1].R_PS) j++;
+      if (tmp.R_PS < ave[j].R_PS) {
 	ave[i] = ave[j];
 	j += (i=j) + 1;
Index: /trunk/Ohana/src/opihi/dvo/gstar.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/gstar.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/gstar.c	(revision 4800)
@@ -81,6 +81,6 @@
   /* stars are not guaranteed to be sorted in RA or in DEC, so first sort the list */
   for (i = 0; i < Nstars; i++) {
-    RA[i] = catalog.average[i].R;
-    DEC[i] = catalog.average[i].D;
+    RA[i] = catalog.average[i].R_PS;
+    DEC[i] = catalog.average[i].D_PS;
     N1[i] = i;
   }
@@ -127,5 +127,5 @@
       k = N1[i];
       fprintf (GetOutfile(), "star: %d\n", k);
-      fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D, 
+      fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R_PS, catalog.average[k].D_PS, 
 	       catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm,
 	       0.01*catalog.average[k].Xp, catalog.average[k].code);
@@ -164,5 +164,5 @@
 	    fprintf (GetOutfile(), "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n", 
 		     Mcat, Mrel, 0.001*catalog.measure[m].dM,
-		     date, 0.01*catalog.measure[m].dR, 0.01*catalog.measure[m].dD,
+		     date, catalog.measure[m].dR_PS, catalog.measure[m].dD_PS,
 		     catalog.measure[m].dophot, catalog.measure[m].flags,
 		     catalog.measure[m].source, GetPhotcodeNamebyCode (catalog.measure[m].source));
Index: /trunk/Ohana/src/opihi/dvo/imdata.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/imdata.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/imdata.c	(revision 4800)
@@ -134,5 +134,5 @@
 	if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
 	n = catalog.measure[i].averef;
-	vec[0].elements[N] = catalog.average[n].R - catalog.measure[i].dR / 360000.0;
+	vec[0].elements[N] = catalog.average[n].R_PS - catalog.measure[i].dR_PS / 3600.0;
 	N++;
 	CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
@@ -143,5 +143,5 @@
 	if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
 	n = catalog.measure[i].averef;
-	vec[0].elements[N] = catalog.average[n].D - catalog.measure[i].dD / 360000.0;
+	vec[0].elements[N] = catalog.average[n].D_PS - catalog.measure[i].dD_PS / 3600.0;
 	N++;
 	CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
Index: /trunk/Ohana/src/opihi/dvo/lcurve.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/lcurve.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/lcurve.c	(revision 4800)
@@ -101,6 +101,6 @@
   /* stars are not guaranteed to be sorted in RA or in DEC, so first sort the list */
   for (i = 0; i < Nstars; i++) {
-    RA[i] = catalog.average[i].R;
-    DEC[i] = catalog.average[i].D;
+    RA[i] = catalog.average[i].R_PS;
+    DEC[i] = catalog.average[i].D_PS;
     N1[i] = i;
   }
Index: /trunk/Ohana/src/opihi/dvo/lightcurve.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/lightcurve.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/lightcurve.c	(revision 4800)
@@ -78,6 +78,6 @@
   /* stars are not guaranteed to be sorted in RA or in DEC, so first sort the list */
   for (i = 0; i < Nstars; i++) {
-    RA[i] = catalog.average[i].R;
-    DEC[i] = catalog.average[i].D;
+    RA[i] = catalog.average[i].R_PS;
+    DEC[i] = catalog.average[i].D_PS;
     N1[i] = i;
   }
Index: /trunk/Ohana/src/opihi/dvo/photometry.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/photometry.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/photometry.c	(revision 4800)
@@ -564,8 +564,8 @@
   switch (param) {
     case AVE_RA:
-      value = average[0].R;
+      value = average[0].R_PS;
       break;
     case AVE_DEC:
-      value = average[0].D;
+      value = average[0].D_PS;
       break;
     case AVE_NMEAS:
@@ -1057,8 +1057,8 @@
       break;
     case MEAS_RA: /* OK */
-      value = average[0].R - measure[0].dR / 360000.0;
+      value = average[0].R_PS - measure[0].dR_PS / 3600.0;
       break;
     case MEAS_DEC: /* OK */
-      value = average[0].D - measure[0].dD / 360000.0;
+      value = average[0].D_PS - measure[0].dD_PS / 3600.0;
       break;
     case MEAS_dMAG: /* OK */
@@ -1078,8 +1078,8 @@
       break;
     case MEAS_dR: /* OK */
-      value = 0.01*measure[0].dR;
+      value = measure[0].dR_PS;
       break;
     case MEAS_dD: /* OK */
-      value = 0.01*measure[0].dD;
+      value = measure[0].dD_PS;
       break;
     case MEAS_FWHM: /* OK */
@@ -1093,6 +1093,6 @@
       break;
     case MEAS_XCCD: /* OK */
-      ra  = average[0].R - measure[0].dR / 360000.0;
-      dec = average[0].D - measure[0].dD / 360000.0;
+      ra  = average[0].R_PS - measure[0].dR_PS / 3600.0;
+      dec = average[0].D_PS - measure[0].dD_PS / 3600.0;
       image = MatchImage (measure[0].t, measure[0].source);
       if (image == NULL) break;
@@ -1101,6 +1101,6 @@
       break;
     case MEAS_YCCD: /* OK */
-      ra  = average[0].R - measure[0].dR / 360000.0;
-      dec = average[0].D - measure[0].dD / 360000.0;
+      ra  = average[0].R_PS - measure[0].dR_PS / 3600.0;
+      dec = average[0].D_PS - measure[0].dD_PS / 3600.0;
       image = MatchImage (measure[0].t, measure[0].source);
       if (image == NULL) break;
@@ -1109,6 +1109,6 @@
       break;
     case MEAS_XMOSAIC: /* OK */
-      ra  = average[0].R - measure[0].dR / 360000.0;
-      dec = average[0].D - measure[0].dD / 360000.0;
+      ra  = average[0].R_PS - measure[0].dR_PS / 3600.0;
+      dec = average[0].D_PS - measure[0].dD_PS / 3600.0;
       mosaic = MatchMosaic (measure[0].t, measure[0].source);
       if (mosaic == NULL) break;
@@ -1117,6 +1117,6 @@
       break;
     case MEAS_YMOSAIC: /* OK */
-      ra  = average[0].R - measure[0].dR / 360000.0;
-      dec = average[0].D - measure[0].dD / 360000.0;
+      ra  = average[0].R_PS - measure[0].dR_PS / 3600.0;
+      dec = average[0].D_PS - measure[0].dD_PS / 3600.0;
       mosaic = MatchMosaic (measure[0].t, measure[0].source);
       if (mosaic == NULL) break;
Index: /trunk/Ohana/src/opihi/dvo/pmeasure.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/pmeasure.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/pmeasure.c	(revision 4800)
@@ -121,6 +121,6 @@
     for (N = i = 0; i < catalog.Naverage; i++) {
       if (IDclip && (catalog.average[i].code != IDchoice)) continue;
-      while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
-      while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
+      while (catalog.average[i].R_PS < Rmin) catalog.average[i].R_PS += 360.0;
+      while (catalog.average[i].R_PS > Rmax) catalog.average[i].R_PS -= 360.0;
       m = catalog.average[i].offset;
       for (k = 0; k < catalog.average[i].Nm; k++) {
@@ -134,5 +134,5 @@
 	if (LimExclude && (Zvec.elements[N] > 0.99)) continue;
 	if (Zvec.elements[N] < 0.011) continue;
-	fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R - 2.777e-6*catalog.measure[m+k].dR, catalog.average[i].D - 2.777e-6*catalog.measure[m+k].dD, &graphmode.coords);
+	fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R_PS - catalog.measure[m+k].dR_PS/3600.0, catalog.average[i].D_PS - catalog.measure[m+k].dD_PS/3600.0, &graphmode.coords);
 	N ++;
       }
Index: /trunk/Ohana/src/opihi/dvo/subpix.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/subpix.c	(revision 4799)
+++ /trunk/Ohana/src/opihi/dvo/subpix.c	(revision 4800)
@@ -61,6 +61,6 @@
   ALLOCATE (index, int, Nstars);
   for (i = 0; i < Nstars; i++) {
-    RA[i] = catalog.average[i].R;
-    DEC[i] = catalog.average[i].D;
+    RA[i] = catalog.average[i].R_PS;
+    DEC[i] = catalog.average[i].D_PS;
     index[i] = i;
   }
