Index: /trunk/psModules/test/astrom/tap_pmAstrometryWCS.c
===================================================================
--- /trunk/psModules/test/astrom/tap_pmAstrometryWCS.c	(revision 10874)
+++ /trunk/psModules/test/astrom/tap_pmAstrometryWCS.c	(revision 10875)
@@ -46,7 +46,7 @@
         pmChip *chip = pmChipAlloc (NULL, "test");
 
-        // toFPA carries pixel scale (pixels per micron)
-        // toTPA carries plate scale (microns per arcsecond)
-        bool status = pmAstromReadWCS (fpa, chip, header, 25.0*PM_RAD_DEG/3600.0);
+        // toFPA carries pixel scale (microns per pixel)
+        // toSky carries plate scale (radians per micron)
+        bool status = pmAstromReadWCS (fpa, chip, header, 10.0);
         ok (status, "converted WCS keywords to FPA astrometry");
         skip_start (!status, 1, "*** WCS Conversion FAILS *** : skipping related tests");
@@ -58,17 +58,17 @@
         ok_float(fpa->toSky->R*PM_DEG_RAD, 0.0, "projection center DEC %f", fpa->toSky->R*PM_DEG_RAD);
 
-        ok_float(fpa->toSky->Xs, 25.0*PM_RAD_DEG/3600.0, "projection X scale %f", fpa->toSky->Xs);
-        ok_float(fpa->toSky->Ys, 25.0*PM_RAD_DEG/3600.0, "projection X scale %f", fpa->toSky->Ys);
+        ok_float(fpa->toSky->Xs, PM_RAD_DEG/3600.0/10.0, "projection X scale %f", fpa->toSky->Xs);
+        ok_float(fpa->toSky->Ys, PM_RAD_DEG/3600.0/10.0, "projection X scale %f", fpa->toSky->Ys);
 
-        ok_float(fpa->toTPA->x->coeff[1][0], 0.04, "TP scale (mm per pixel): %f", fpa->toTPA->x->coeff[1][0]);
-        ok_float(fpa->toTPA->y->coeff[0][1], 0.04, "TP scale (mm per pixel): %f", fpa->toTPA->x->coeff[1][0]);
+        ok_float(fpa->toTPA->x->coeff[1][0], 1.0, "TP scale (unity): %f", fpa->toTPA->x->coeff[1][0]);
+        ok_float(fpa->toTPA->y->coeff[0][1], 1.0, "TP scale (unity): %f", fpa->toTPA->x->coeff[1][0]);
 
         ok_float(chip->toFPA->x->coeff[0][0], 0.0, "ref pixel X: %f", chip->toFPA->x->coeff[0][0]);
         ok_float(chip->toFPA->y->coeff[0][0], 0.0, "ref pixel Y: %f", chip->toFPA->y->coeff[0][0]);
 
-        ok_float(chip->toFPA->x->coeff[1][0], 1.0, "CD1_1: %f", chip->toFPA->x->coeff[1][0]);
+        ok_float(chip->toFPA->x->coeff[1][0], 10.0, "CD1_1: %f", chip->toFPA->x->coeff[1][0]);
         ok_float(chip->toFPA->x->coeff[0][1], 0.0, "CD1_2: %f", chip->toFPA->x->coeff[0][1]);
         ok_float(chip->toFPA->y->coeff[1][0], 0.0, "CD2_1: %f", chip->toFPA->y->coeff[1][0]);
-        ok_float(chip->toFPA->y->coeff[0][1], 1.0, "CD2_2: %f", chip->toFPA->y->coeff[0][1]);
+        ok_float(chip->toFPA->y->coeff[0][1], 10.0, "CD2_2: %f", chip->toFPA->y->coeff[0][1]);
 
         psFree (fpa);
@@ -115,5 +115,5 @@
         // toFPA carries pixel scale (pixels per micron)
         // toTPA carries plate scale (microns per arcsecond)
-        bool status = pmAstromReadWCS (fpa, chip, header, 25.0*PM_RAD_DEG/3600.0);
+        bool status = pmAstromReadWCS (fpa, chip, header, 10.0);
         ok (status, "converted WCS keywords to FPA astrometry");
         skip_start (!status, 1, "*** WCS Conversion FAILS *** : skipping related tests");
@@ -125,17 +125,17 @@
         ok_float(fpa->toSky->R*PM_DEG_RAD, 0.0, "projection center DEC %f", fpa->toSky->R*PM_DEG_RAD);
 
-        ok_float(fpa->toSky->Xs, 25.0*PM_RAD_DEG/3600.0, "projection X scale %f", fpa->toSky->Xs);
-        ok_float(fpa->toSky->Ys, 25.0*PM_RAD_DEG/3600.0, "projection X scale %f", fpa->toSky->Ys);
+        ok_float(fpa->toSky->Xs, PM_RAD_DEG/3600.0/10.0, "projection X scale %f", fpa->toSky->Xs);
+        ok_float(fpa->toSky->Ys, PM_RAD_DEG/3600.0/10.0, "projection X scale %f", fpa->toSky->Ys);
 
-        ok_float(fpa->toTPA->x->coeff[1][0], 0.04, "TP scale (mm per pixel): %f", fpa->toTPA->x->coeff[1][0]);
-        ok_float(fpa->toTPA->y->coeff[0][1], 0.04, "TP scale (mm per pixel): %f", fpa->toTPA->x->coeff[1][0]);
+        ok_float(fpa->toTPA->x->coeff[1][0], 1.0, "TP scale (unity): %f", fpa->toTPA->x->coeff[1][0]);
+        ok_float(fpa->toTPA->y->coeff[0][1], 1.0, "TP scale (unity): %f", fpa->toTPA->x->coeff[1][0]);
 
-        ok_float(chip->toFPA->x->coeff[0][0], -10.0, "ref pixel X: %f", chip->toFPA->x->coeff[0][0]);
-        ok_float(chip->toFPA->y->coeff[0][0], -10.0, "ref pixel Y: %f", chip->toFPA->y->coeff[0][0]);
+        ok_float(chip->toFPA->x->coeff[0][0], -100.0, "ref pixel X: %f", chip->toFPA->x->coeff[0][0]);
+        ok_float(chip->toFPA->y->coeff[0][0], -100.0, "ref pixel Y: %f", chip->toFPA->y->coeff[0][0]);
 
-        ok_float(chip->toFPA->x->coeff[1][0], 1.0, "CD1_1: %f", chip->toFPA->x->coeff[1][0]);
+        ok_float(chip->toFPA->x->coeff[1][0], 10.0, "CD1_1: %f", chip->toFPA->x->coeff[1][0]);
         ok_float(chip->toFPA->x->coeff[0][1], 0.0, "CD1_2: %f", chip->toFPA->x->coeff[0][1]);
         ok_float(chip->toFPA->y->coeff[1][0], 0.0, "CD2_1: %f", chip->toFPA->y->coeff[1][0]);
-        ok_float(chip->toFPA->y->coeff[0][1], 1.0, "CD2_2: %f", chip->toFPA->y->coeff[0][1]);
+        ok_float(chip->toFPA->y->coeff[0][1], 10.0, "CD2_2: %f", chip->toFPA->y->coeff[0][1]);
 
         psFree (fpa);
Index: /trunk/psModules/test/astrom/tap_pmAstrometryWCS_DVO3.c
===================================================================
--- /trunk/psModules/test/astrom/tap_pmAstrometryWCS_DVO3.c	(revision 10874)
+++ /trunk/psModules/test/astrom/tap_pmAstrometryWCS_DVO3.c	(revision 10875)
@@ -49,6 +49,6 @@
     coords.crpix1 = 0.0;
     coords.crpix2 = 0.0;
-    coords.cdelt1 = 1.0/3600;
-    coords.cdelt2 = 1.0/3600;
+    coords.cdelt1 = 1.0/3600.0;
+    coords.cdelt2 = 1.0/3600.0;
     coords.pc1_1  = 1.0;
     coords.pc1_2  = 0.0;
@@ -65,5 +65,5 @@
     pmChip *chip = pmChipAlloc (fpa, NULL);
 
-    bool status = pmAstromReadWCS (fpa, chip, header1, PM_RAD_DEG*10.0/3600.0);
+    bool status = pmAstromReadWCS (fpa, chip, header1, 10.0);
 
     ok (status, "converted WCS keywords to WCS astrometry");
@@ -139,6 +139,6 @@
     coords.crpix1 = 0.0;
     coords.crpix2 = 0.0;
-    coords.cdelt1 = 1.0/3600;
-    coords.cdelt2 = 1.0/3600;
+    coords.cdelt1 = 1.0/3600.0;
+    coords.cdelt2 = 1.0/3600.0;
     coords.pc1_1  = 0.9;
     coords.pc1_2  = 0.1;
@@ -156,5 +156,5 @@
     pmChip *chip = pmChipAlloc (fpa, NULL);
 
-    bool status = pmAstromReadWCS (fpa, chip, header1, PM_RAD_DEG*10.0/3600.0);
+    bool status = pmAstromReadWCS (fpa, chip, header1, 10.0);
 
     ok (status, "converted WCS keywords to WCS astrometry");
@@ -231,6 +231,6 @@
     coords.crpix1 = 0.0;
     coords.crpix2 = 0.0;
-    coords.cdelt1 = 1.0/3600;
-    coords.cdelt2 = 1.0/3600;
+    coords.cdelt1 = 1.0/3600.0;
+    coords.cdelt2 = 1.0/3600.0;
     coords.pc1_1  = 1.0;
     coords.pc1_2  = 0.0;
@@ -249,5 +249,5 @@
     pmChip *chip = pmChipAlloc (fpa, NULL);
 
-    bool status = pmAstromReadWCS (fpa, chip, header1, PM_RAD_DEG*10.0/3600.0);
+    bool status = pmAstromReadWCS (fpa, chip, header1, 10.0);
 
     ok (status, "converted WCS keywords to WCS astrometry");
@@ -324,6 +324,6 @@
     coords.crpix1 = 20.0;
     coords.crpix2 = 50.0;
-    coords.cdelt1 = 1.0/3600;
-    coords.cdelt2 = 1.0/3600;
+    coords.cdelt1 = 1.0/3600.0;
+    coords.cdelt2 = 1.0/3600.0;
     coords.pc1_1  = 1.0;
     coords.pc1_2  = 0.0;
@@ -340,5 +340,5 @@
     pmChip *chip = pmChipAlloc (fpa, NULL);
 
-    bool status = pmAstromReadWCS (fpa, chip, header1, PM_RAD_DEG*10.0/3600.0);
+    bool status = pmAstromReadWCS (fpa, chip, header1, 10.0);
 
     ok (status, "converted WCS keywords to WCS astrometry");
@@ -414,6 +414,6 @@
     coords.crpix1 = 50.0;
     coords.crpix2 = -20.0;
-    coords.cdelt1 = 1.0/3600;
-    coords.cdelt2 = 1.0/3600;
+    coords.cdelt1 = 1.0/3600.0;
+    coords.cdelt2 = 1.0/3600.0;
     coords.pc1_1  = 0.9;
     coords.pc1_2  = 0.1;
@@ -431,5 +431,5 @@
     pmChip *chip = pmChipAlloc (fpa, NULL);
 
-    bool status = pmAstromReadWCS (fpa, chip, header1, PM_RAD_DEG*10.0/3600.0);
+    bool status = pmAstromReadWCS (fpa, chip, header1, 10.0);
 
     ok (status, "converted WCS keywords to WCS astrometry");
@@ -506,6 +506,6 @@
     coords.crpix1 = 20.0;
     coords.crpix2 = 50.0;
-    coords.cdelt1 = 1.0/3600;
-    coords.cdelt2 = 1.0/3600;
+    coords.cdelt1 = 1.0/3600.0;
+    coords.cdelt2 = 1.0/3600.0;
     coords.pc1_1  = 1.0;
     coords.pc1_2  = 0.0;
@@ -524,5 +524,5 @@
     pmChip *chip = pmChipAlloc (fpa, NULL);
 
-    bool status = pmAstromReadWCS (fpa, chip, header1, PM_RAD_DEG*10.0/3600.0);
+    bool status = pmAstromReadWCS (fpa, chip, header1, 10.0);
 
     ok (status, "converted WCS keywords to WCS astrometry");
@@ -530,5 +530,5 @@
 
     psMetadata *header2 = psMetadataAlloc();
-    status = pmAstromWriteWCS (header2, fpa, chip, 0.001);
+    status = pmAstromWriteWCS (header2, fpa, chip, 0.00001);
 
     pmAstromWCS *wcs = pmAstromWCSfromHeader(header2);
@@ -564,6 +564,8 @@
                 bSky->r += 2*M_PI;
 
-            ok_float(aSky->r*PM_DEG_RAD, bSky->r*PM_DEG_RAD, "coordinate match: %f vs %f (delta = %f)", aSky->r*PM_DEG_RAD, bSky->r*PM_DEG_RAD, aSky->r*PM_DEG_RAD - bSky->r*PM_DEG_RAD);
-            ok_float(aSky->d*PM_DEG_RAD, bSky->d*PM_DEG_RAD, "coordinate match: %f vs %f (delta = %f)", aSky->d*PM_DEG_RAD, bSky->d*PM_DEG_RAD, aSky->d*PM_DEG_RAD - bSky->d*PM_DEG_RAD);
+            // XXX we are getting round-off errors as a result of the wcs transformation
+            // having terms in units of pix/degree. for now require 10mas on this
+            ok_float_tol(aSky->r*PM_DEG_RAD, bSky->r*PM_DEG_RAD, 0.01/3600.0, "coordinate match: %f vs %f (delta = %f)", aSky->r*PM_DEG_RAD, bSky->r*PM_DEG_RAD, aSky->r*PM_DEG_RAD - bSky->r*PM_DEG_RAD);
+            ok_float_tol(aSky->d*PM_DEG_RAD, bSky->d*PM_DEG_RAD, 0.01/3600.0, "coordinate match: %f vs %f (delta = %f)", aSky->d*PM_DEG_RAD, bSky->d*PM_DEG_RAD, aSky->d*PM_DEG_RAD - bSky->d*PM_DEG_RAD);
         }
     }
@@ -601,35 +603,35 @@
 
     // center coords (R,D)
-    psMetadataAddF32 (header, PS_LIST_TAIL, "CRVAL1", PS_META_REPLACE, "", coords[0].crval1);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "CRVAL2", PS_META_REPLACE, "", coords[0].crval2);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "CRVAL1", PS_META_REPLACE, "", coords[0].crval1);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "CRVAL2", PS_META_REPLACE, "", coords[0].crval2);
 
     // center coords (X,Y)
-    psMetadataAddF32 (header, PS_LIST_TAIL, "CRPIX1", PS_META_REPLACE, "", coords[0].crpix1);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "CRPIX2", PS_META_REPLACE, "", coords[0].crpix2);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "CRPIX1", PS_META_REPLACE, "", coords[0].crpix1);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "CRPIX2", PS_META_REPLACE, "", coords[0].crpix2);
 
     // degrees per pixel
-    psMetadataAddF32 (header, PS_LIST_TAIL, "CDELT1",  PS_META_REPLACE, "", coords[0].cdelt1);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "CDELT2",  PS_META_REPLACE, "", coords[0].cdelt2);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "CDELT1",  PS_META_REPLACE, "", coords[0].cdelt1);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "CDELT2",  PS_META_REPLACE, "", coords[0].cdelt2);
 
     // rotation matrix
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PC001001", PS_META_REPLACE, "", coords[0].pc1_1);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PC001002", PS_META_REPLACE, "", coords[0].pc1_2);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PC002001", PS_META_REPLACE, "", coords[0].pc2_1);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PC002002", PS_META_REPLACE, "", coords[0].pc2_2);
-
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X2Y0", PS_META_REPLACE, "", coords[0].polyterms[0][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X1Y1", PS_META_REPLACE, "", coords[0].polyterms[1][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X0Y2", PS_META_REPLACE, "", coords[0].polyterms[2][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X2Y0", PS_META_REPLACE, "", coords[0].polyterms[0][1]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X1Y1", PS_META_REPLACE, "", coords[0].polyterms[1][1]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X0Y2", PS_META_REPLACE, "", coords[0].polyterms[2][1]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X3Y0", PS_META_REPLACE, "", coords[0].polyterms[3][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X2Y1", PS_META_REPLACE, "", coords[0].polyterms[4][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X1Y2", PS_META_REPLACE, "", coords[0].polyterms[5][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA1X0Y3", PS_META_REPLACE, "", coords[0].polyterms[6][0]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X3Y0", PS_META_REPLACE, "", coords[0].polyterms[3][1]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X2Y1", PS_META_REPLACE, "", coords[0].polyterms[4][1]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X1Y2", PS_META_REPLACE, "", coords[0].polyterms[5][1]);
-    psMetadataAddF32 (header, PS_LIST_TAIL, "PCA2X0Y3", PS_META_REPLACE, "", coords[0].polyterms[6][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PC001001", PS_META_REPLACE, "", coords[0].pc1_1);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PC001002", PS_META_REPLACE, "", coords[0].pc1_2);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PC002001", PS_META_REPLACE, "", coords[0].pc2_1);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PC002002", PS_META_REPLACE, "", coords[0].pc2_2);
+
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X2Y0", PS_META_REPLACE, "", coords[0].polyterms[0][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X1Y1", PS_META_REPLACE, "", coords[0].polyterms[1][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X0Y2", PS_META_REPLACE, "", coords[0].polyterms[2][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X2Y0", PS_META_REPLACE, "", coords[0].polyterms[0][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X1Y1", PS_META_REPLACE, "", coords[0].polyterms[1][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X0Y2", PS_META_REPLACE, "", coords[0].polyterms[2][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X3Y0", PS_META_REPLACE, "", coords[0].polyterms[3][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X2Y1", PS_META_REPLACE, "", coords[0].polyterms[4][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X1Y2", PS_META_REPLACE, "", coords[0].polyterms[5][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA1X0Y3", PS_META_REPLACE, "", coords[0].polyterms[6][0]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X3Y0", PS_META_REPLACE, "", coords[0].polyterms[3][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X2Y1", PS_META_REPLACE, "", coords[0].polyterms[4][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X1Y2", PS_META_REPLACE, "", coords[0].polyterms[5][1]);
+    psMetadataAddF64 (header, PS_LIST_TAIL, "PCA2X0Y3", PS_META_REPLACE, "", coords[0].polyterms[6][1]);
 
     psMetadataAddS32 (header, PS_LIST_TAIL, "NPLYTERM", PS_META_REPLACE, "", coords[0].Npolyterms);
