Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 1462)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 1463)
@@ -11,6 +11,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-09 23:34:57 $
+*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-10 23:59:41 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -31,6 +31,7 @@
 static float arg(float x, float y);
 
-// This is the only function in this file which I understand.
-psPlane* psPlaneTransformApply(psPlane* out, const psPlaneTransform* transform, const psPlane* coords)
+psPlane* psPlaneTransformApply(psPlane* out,
+                               const psPlaneTransform* transform,
+                               const psPlane* coords)
 {
     if (out == NULL) {
@@ -50,5 +51,7 @@
 psPlane* psPlaneDistortApply(psPlane* out,
                              const psPlaneDistort* transform,
-                             const psPlane* coords, float term3, float term4)
+                             const psPlane* coords,
+                             float term3,
+                             float term4)
 {
     if (out == NULL) {
@@ -59,10 +62,12 @@
              (transform->x->coeff[1][0][0][0] * coords->x) +
              (transform->x->coeff[0][1][0][0] * coords->y) +
-             (transform->x->coeff[0][0][1][0] * term3) + (transform->x->coeff[0][0][0][1] * term4);
+             (transform->x->coeff[0][0][1][0] * term3) +
+             (transform->x->coeff[0][0][0][1] * term4);
 
     out->y = transform->y->coeff[0][0][0][0] +
              (transform->y->coeff[1][0][0][0] * coords->x) +
              (transform->y->coeff[0][1][0][0] * coords->y) +
-             (transform->y->coeff[0][0][1][0] * term3) + (transform->y->coeff[0][0][0][1] * term4);
+             (transform->y->coeff[0][0][1][0] * term3) +
+             (transform->y->coeff[0][0][0][1] * term4);
 
     return (out);
Index: /trunk/psLib/src/astronomy/Makefile
===================================================================
--- /trunk/psLib/src/astronomy/Makefile	(revision 1462)
+++ /trunk/psLib/src/astronomy/Makefile	(revision 1463)
@@ -9,6 +9,6 @@
 SRC_OBJS = psTime.o \
            psMetadata.o \
-           psCoord.o
-#           psAstrometry.o             George, this is crap code!
+           psCoord.o \
+           psAstrometry.o
 
 OBJS = $(addprefix makedir/,$(SRC_OBJS))
Index: /trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1462)
+++ /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1463)
@@ -1,3 +1,2 @@
-
 /** @file  psAstrometry.c
 *
@@ -9,6 +8,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-09 23:34:57 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-10 23:59:41 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,5 +20,4 @@
 #include "psMemory.h"
 
-static void grommitFree(psGrommit* grommit);
 static int checkValidChipCoords(double x, double y, psChip* tmpChip);
 static int checkValidImageCoords(double x, double y, psImage* tmpImage);
@@ -49,4 +47,8 @@
 }
 
+/*
+    Several members of the psGrommit data structure have no direct counterpart
+    in the psExposure structure.  How are we to determine them?
+*/
 psGrommit* psGrommitAlloc(const psExposure* exp)
 {
@@ -79,5 +81,5 @@
 }
 
-void p_psGrommitFree(psGrommit* grommit)
+void psGrommitFree(psGrommit* grommit)
 {
     psFree(grommit);
@@ -94,4 +96,7 @@
 }
 
+/*
+    XXX: do this
+*/
 int checkValidChipCoords(double x, double y, psChip* tmpChip)
 {
@@ -120,4 +125,7 @@
 }
 
+/*
+    XXX: do this
+*/
 int checkValidImageCoords(double x, double y, psImage* tmpImage)
 {
@@ -142,4 +150,5 @@
 psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip)
 {
+    int i = 0;
     psPlane* tmpCoord = NULL;
     psArray* cells;
@@ -155,5 +164,5 @@
     }
 
-    for (int i = 0; i < cells->n; i++) {
+    for (i = 0; i < cells->n; i++) {
         psCell* tmpCell = (psCell* ) cells->data[i];
         psArray* readouts = tmpCell->readouts;
@@ -210,5 +219,7 @@
 // transformation, as well as a few psPlane structs.  Can this be implemented
 // better?
-psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell)
+psSphere* psCoordCelltoSky(psSphere* out,
+                           const psPlane* in,
+                           const psCell* cell)
 {
     psPlane* tmp1 = NULL;
@@ -216,16 +227,18 @@
     psFPA* parFPA = (cell->parent)->parent;
     psGrommit* tmpGrommit = NULL;
+    float XXX1 = 0.0;
+    float XXX2 = 0.0;
+
 
     tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in);
-    tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1);
+    // XXX:
+    //
+    tmp2 = psPlaneDistortApply(tmp2, parFPA->toTangentPlane, tmp1, XXX1, XXX2);
     tmpGrommit = psGrommitAlloc(parFPA->exposure);
-    tmp3 = psCoordTPtoSky(out, tmp2, psGrommit);
-
     psFree(tmp1);
     psFree(tmp2);
     psFree(tmpGrommit);
 
-    return (psCoordTPtoSky(out, tmp2, psGrommit));
-
+    return(psCoordTPtoSky(out, tmp2, tmpGrommit));
 }
 
@@ -247,24 +260,34 @@
 psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit)
 {
-    extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB);
-    double AOB;
-    double ZOB;
-    double HOB;
-    double DOB;
-    double ROB;
-
-    if (out == NULL) {
-        out = (psPlane* ) psAlloc(sizeof(psPlane));
-    }
-
-    sla_AOPQK(psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB);
-    out->x = XXX;
-    out->y = XXX;
-    return (out);
-}
-
+    /*
+        extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB);
+        double AOB;
+        double ZOB;
+        double HOB;
+        double DOB;
+        double ROB;
+     
+        if (out == NULL) {
+            out = (psPlane* ) psAlloc(sizeof(psPlane));
+        }
+     
+        sla_AOPQK(psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB);
+        out->x = XXX;
+        out->y = XXX;
+        return (out);
+    */
+    return(NULL);
+}
+
+
+/*
+    XXX: What are the XXX1 and XXX2 args supposed to be?
+*/
 psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa)
 {
-    return (psPlaneTransformApply(out, fpa->fromTangentPlane, in));
+    float XXX1 = 0.0;
+    float XXX2 = 0.0;
+
+    return (psPlaneDistortApply(out, fpa->fromTangentPlane, in, XXX1, XXX2));
 }
 
@@ -281,5 +304,10 @@
 psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell)
 {
-    out = psCoordSkytoTP(out, in, tmpGrommit);
+    psGrommit* XXXGrommit = NULL;
+    psFPA *whichFPA = NULL;
+    psChip *whichChip = NULL;
+    psCell *whichCell = NULL;
+
+    out = psCoordSkytoTP(out, in, XXXGrommit);
     out = psCoordTPtoFPA(out, out, whichFPA);
     out = psCoordFPAtoChip(out, out, whichChip);
Index: /trunk/psLib/src/astronomy/psAstrometry.h
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.h	(revision 1462)
+++ /trunk/psLib/src/astronomy/psAstrometry.h	(revision 1463)
@@ -9,6 +9,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-09 23:40:54 $
+*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-10 23:59:41 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -132,6 +132,6 @@
  *
  *  A chip consists of one or more cells (according to the number of amplifiers
- *  on the CCD). It contains a pointer to the chip's metadata, and a pointer    
- *  to the parent focal plane.  For astrometry, ot contains a coordinate
+ *  on the CCD). It contains a pointer to the chip's metadata, and a pointer
+ *  to the parent focal plane.  For astrometry, it contains a coordinate
  *  transform from the chip to the focal plane, and vis-versa.
  *
@@ -238,4 +238,6 @@
                          );
 
+void psGrommitFree(psGrommit *grommit);
+
 psCell* psCellinFPA(psCell* out, const psPlane* coord, const psFPA* FPA);
 
Index: /trunk/psLib/src/astronomy/psCoord.c
===================================================================
--- /trunk/psLib/src/astronomy/psCoord.c	(revision 1462)
+++ /trunk/psLib/src/astronomy/psCoord.c	(revision 1463)
@@ -11,6 +11,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-09 23:34:57 $
+*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-10 23:59:41 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -31,6 +31,7 @@
 static float arg(float x, float y);
 
-// This is the only function in this file which I understand.
-psPlane* psPlaneTransformApply(psPlane* out, const psPlaneTransform* transform, const psPlane* coords)
+psPlane* psPlaneTransformApply(psPlane* out,
+                               const psPlaneTransform* transform,
+                               const psPlane* coords)
 {
     if (out == NULL) {
@@ -50,5 +51,7 @@
 psPlane* psPlaneDistortApply(psPlane* out,
                              const psPlaneDistort* transform,
-                             const psPlane* coords, float term3, float term4)
+                             const psPlane* coords,
+                             float term3,
+                             float term4)
 {
     if (out == NULL) {
@@ -59,10 +62,12 @@
              (transform->x->coeff[1][0][0][0] * coords->x) +
              (transform->x->coeff[0][1][0][0] * coords->y) +
-             (transform->x->coeff[0][0][1][0] * term3) + (transform->x->coeff[0][0][0][1] * term4);
+             (transform->x->coeff[0][0][1][0] * term3) +
+             (transform->x->coeff[0][0][0][1] * term4);
 
     out->y = transform->y->coeff[0][0][0][0] +
              (transform->y->coeff[1][0][0][0] * coords->x) +
              (transform->y->coeff[0][1][0][0] * coords->y) +
-             (transform->y->coeff[0][0][1][0] * term3) + (transform->y->coeff[0][0][0][1] * term4);
+             (transform->y->coeff[0][0][1][0] * term3) +
+             (transform->y->coeff[0][0][0][1] * term4);
 
     return (out);
