Index: /trunk/psLib/src/astro/psEarthOrientation.c
===================================================================
--- /trunk/psLib/src/astro/psEarthOrientation.c	(revision 5454)
+++ /trunk/psLib/src/astro/psEarthOrientation.c	(revision 5455)
@@ -9,6 +9,6 @@
 *  @author Robert Daniel DeSonia, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-28 02:25:22 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-02 01:07:25 $
 *
 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -54,5 +54,5 @@
 static bool eocInit()
 {
-    int nFail = 0;
+    unsigned int nFail = 0;
 
     // Read config file
@@ -158,10 +158,10 @@
 }
 
-psSphere *psAberration(psSphere *actual,
-                       const psSphere *apparent,
+psSphere *psAberration(psSphere *apparent,
+                       const psSphere *actual,
                        const psSphere *direction,
                        double speed)
 {
-    PS_ASSERT_PTR_NON_NULL(apparent, NULL);
+    PS_ASSERT_PTR_NON_NULL(actual, NULL);
     PS_ASSERT_PTR_NON_NULL(direction, NULL);
     if (fabs(speed) < DBL_EPSILON) {
@@ -171,11 +171,11 @@
     }
 
-    if (actual == NULL) {
-        actual = psSphereAlloc();
+    if (apparent == NULL) {
+        apparent = psSphereAlloc();
     } else {
-        actual->r = 0.0;
-        actual->d = 0.0;
-        actual->rErr = 0.0;
-        actual->dErr = 0.0;
+        apparent->r = 0.0;
+        apparent->d = 0.0;
+        apparent->rErr = 0.0;
+        apparent->dErr = 0.0;
     }
     psSphere *rp = psSphereAlloc();
@@ -188,12 +188,12 @@
     //    mu = apparent->r * direction->r + apparent->d * direction->d;
     psCube* directionVector = psSphereToCube(direction);
-    psCube* apparentVector = psSphereToCube(apparent);
-    mu = acos(directionVector->x*apparentVector->x +
-              directionVector->y*apparentVector->y +
-              directionVector->z*apparentVector->z);
+    psCube* actualVector = psSphereToCube(actual);
+    mu = acos(directionVector->x*actualVector->x +
+              directionVector->y*actualVector->y +
+              directionVector->z*actualVector->z);
 
     //rp = apparent - mu * direction;
-    rp->r = apparent->r - mu * direction->r;
-    rp->d = apparent->d - mu * direction->d;
+    rp->r = actual->r - mu * direction->r;
+    rp->d = actual->d - mu * direction->d;
 
     mu_p = mu + speed * ((mu * mu - 1.0) / (1.0 - speed * mu));
@@ -210,5 +210,5 @@
     r_p->d = mu_p * direction->d + a * rp->d;
 
-    *actual = *r_p;
+    *apparent = *r_p;
     /*
         psSphereRot *rot = NULL;
@@ -218,5 +218,5 @@
         double sinD = sin(direction->d);
         rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed);
-     
+
         actual = psSphereRotApply(actual, rot, apparent);
     */
@@ -224,29 +224,29 @@
     psFree(r_p);
     psFree(directionVector);
-    psFree(apparentVector);
+    psFree(actualVector);
     psFree(rpVector);
-    return actual;
-}
-
-psSphere *psGravityDeflection(psSphere *actual,
-                              psSphere *apparent,
+    return apparent;
+}
+
+psSphere *psGravityDeflection(psSphere *apparent,
+                              psSphere *actual,
                               psSphere *sun)
 {
-    PS_ASSERT_PTR_NON_NULL(apparent, NULL);
+    PS_ASSERT_PTR_NON_NULL(actual, NULL);
     PS_ASSERT_PTR_NON_NULL(sun, NULL);
 
-    // calculating the actual angle from the apparent angle and the sun position
-
-    // first, calculate the angle between the sun vector and the apparent vector
+    // calculating the apparent angle from the actual angle and the sun position
+
+    // first, calculate the angle between the sun vector and the actual vector
 
     // Moving to cartesian first:  XXX -- is this required?
     psCube* sunVector = psSphereToCube(sun);
-    psCube* apparentVector = psSphereToCube(apparent);
+    psCube* actualVector = psSphereToCube(actual);
 
     // use dot product to calculate the angle of separation
     // N.B., assuming the psSphereToCube function returns a unit vector.
-    double theta = acos(sunVector->x*apparentVector->x +
-                        sunVector->y*apparentVector->y +
-                        sunVector->z*apparentVector->z);
+    double theta = acos(sunVector->x*actualVector->x +
+                        sunVector->y*actualVector->y +
+                        sunVector->z*actualVector->z);
 
     double r0 = PS_AU * tan(theta);
@@ -259,19 +259,19 @@
         //if deflection is greater than limit, the light rays will hit the sun
         psWarning("Invalid positions.  Light ray will not be seen on earth.\n");
-        psFree(apparentVector);
+        psFree(actualVector);
         psFree(sunVector);
-        return actual;
-    }
-
-    if (actual == NULL) {
-        actual = psSphereAlloc();
+        return apparent;
+    }
+
+    if (apparent == NULL) {
+        apparent = psSphereAlloc();
     } else {
-        actual->r = 0.0;
-        actual->d = 0.0;
-        actual->rErr = 0.0;
-        actual->dErr = 0.0;
-    }
-
-    // bend the apparent vector away from the sun vector by deflection angle.
+        apparent->r = 0.0;
+        apparent->d = 0.0;
+        apparent->rErr = 0.0;
+        apparent->dErr = 0.0;
+    }
+
+    // bend the actual vector away from the sun vector by deflection angle.
     // XXX: Not sure how to do this.  Dave thinks the formula should be:
     //      theta = atan(r0/d)*tan(deflection), phi = thete/tan(deflection)
@@ -281,9 +281,9 @@
     theta = atan(r0/PS_AU) * tan(deflection);
     phi = sqrt( deflection*deflection - theta*theta );
-    actual->r = theta;
-    actual->d = phi;
-    psFree(apparentVector);
+    apparent->r = theta;
+    apparent->d = phi;
+    psFree(actualVector);
     psFree(sunVector);
-    return actual;
+    return apparent;
 }
 
Index: /trunk/psLib/src/astro/psEarthOrientation.h
===================================================================
--- /trunk/psLib/src/astro/psEarthOrientation.h	(revision 5454)
+++ /trunk/psLib/src/astro/psEarthOrientation.h	(revision 5455)
@@ -9,6 +9,6 @@
 *  @author Robert Daniel DeSonia, MHPCC
 *
-*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-28 02:25:22 $
+*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-02 01:07:25 $
 *
 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -56,6 +56,6 @@
  */
 psSphere *psAberration(
-    psSphere *actual,                  ///< actual position of star
-    const psSphere *apparent,          ///< apparent position of star
+    psSphere *apparent,                ///< apparent position of star
+    const psSphere *actual,            ///< actual position of star
     const psSphere *direction,         ///< direction of motion of observer
     double speed                       ///< speed of motion of observer
@@ -72,6 +72,6 @@
  */
 psSphere *psGravityDeflection(
+    psSphere *apparent,                ///< apparent position of star
     psSphere *actual,                  ///< actual position of star
-    psSphere *apparent,                ///< apparent position of star
     psSphere *sun                      ///< position of the sun
 );
Index: /trunk/psLib/src/types/psMetadata.h
===================================================================
--- /trunk/psLib/src/types/psMetadata.h	(revision 5454)
+++ /trunk/psLib/src/types/psMetadata.h	(revision 5455)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-29 00:05:53 $
+*  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-02 01:07:25 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -709,5 +709,5 @@
  *  returned.
  *
- *  @return char*:           Value of metadata item.
+ *  @return psString:           Value of metadata item.
  */
 psString psMetadataLookupStr(
Index: /trunk/psLib/test/astro/tst_psEarthOrientation.c
===================================================================
--- /trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 5454)
+++ /trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 5455)
@@ -1,11 +1,10 @@
 /** @file  tst_psEarthOrientation.c
 *
-*  @brief The code will go on ...
-*
+*  @brief The code will perform earth orientation calculations and sphere rotations.
 *
 *  @author d-Rob, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-28 02:25:22 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-02 01:07:25 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -43,21 +42,21 @@
 psS32 testAberration(void)
 {
-    psSphere *actual = NULL;
-    psSphere *apparent = psSphereAlloc();
+    psSphere *apparent = NULL;
+    psSphere *actual = psSphereAlloc();
     psSphere *direction = psSphereAlloc();
     psSphere *empty = NULL;
 
-    apparent->r = 0.2;
-    apparent->d = 0.2;
+    actual->r = 0.2;
+    actual->d = 0.2;
     direction->r = 0.2035;
     direction->d = 0.2035;
 
-    empty = psAberration(empty, actual, direction, 0.1);
+    empty = psAberration(empty, apparent, direction, 0.1);
     if (empty != NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, false,
-                "psAberration failed to return NULL for NULL apparent input.\n");
+                "psAberration failed to return NULL for NULL actual input.\n");
         return 1;
     }
-    empty = psAberration(empty, apparent, actual, 0.1);
+    empty = psAberration(empty, actual, apparent, 0.1);
     if (empty != NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, false,
@@ -66,9 +65,9 @@
     }
 
-    actual = psAberration(actual, apparent, direction, 0.4);
-    printf("\nactual = r,d  = %.8g, %.8g\n", actual->r, actual->d);
+    apparent = psAberration(apparent, actual, direction, 0.4);
+    printf("\napparent = r,d  = %.8g, %.8g\n", apparent->r, apparent->d);
 
+    psFree(apparent);
     psFree(actual);
-    psFree(apparent);
     psFree(direction);
 
@@ -79,6 +78,6 @@
 {
 
-    psSphere *actual = NULL;
-    psSphere *apparent = psSphereAlloc();
+    psSphere *actual = psSphereAlloc();
+    psSphere *apparent = NULL;
     psSphere *sun = psSphereAlloc();
     psSphere *empty = NULL;
@@ -86,14 +85,14 @@
     sun->r = 0.2;
     sun->d = 0.2;
-    apparent->r = 0.2035;
-    apparent->d = 0.2035;
+    actual->r = 0.2035;
+    actual->d = 0.2035;
 
-    empty = psGravityDeflection(empty, actual, sun);
+    empty = psGravityDeflection(apparent, empty, sun);
     if (empty != NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                "psGravityDeflection Failed to return NULL for NULL apparent input sphere.\n");
+                "psGravityDeflection Failed to return NULL for NULL actual input sphere.\n");
         return 1;
     }
-    empty = psGravityDeflection(empty, apparent, actual);
+    empty = psGravityDeflection(apparent, actual, empty);
     if (empty != NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
@@ -102,8 +101,8 @@
     }
 
-    actual = psGravityDeflection(actual, apparent, sun);
-    psSphere *result = psSphereSetOffset(apparent, actual, PS_SPHERICAL, PS_RADIAN);
-    printf("\nApparent r,d = %.13g,%.13g    Actual r,d = %.13g, %.13g \n",
-           apparent->r, apparent->d, result->r, result->d);
+    apparent = psGravityDeflection(apparent, actual, sun);
+    psSphere *result = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN);
+    printf("\nActual r,d = %.13g,%.13g    Apparent r,d = %.13g, %.13g \n",
+           actual->r, actual->d, result->r, result->d);
     psFree(result);
     psFree(actual);
Index: /trunk/psLib/test/astro/tst_psSphereOps.c
===================================================================
--- /trunk/psLib/test/astro/tst_psSphereOps.c	(revision 5454)
+++ /trunk/psLib/test/astro/tst_psSphereOps.c	(revision 5455)
@@ -1,11 +1,10 @@
 /** @file  tst_psSphereOps.c
 *
-*  @brief The code will ..... Work ....
-*
+*  @brief The code will perform sphere rotations and transformations.
 *
 *  @author d-Rob, MHPCC
 *
-*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-28 02:25:22 $
+*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-02 01:07:25 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -14,4 +13,5 @@
 #include "psTest.h"
 #include "pslib_strict.h"
+
 static psS32 testSphereRotAlloc(void);
 static psS32 testSphereRotQuat(void);
@@ -275,10 +275,8 @@
                     RAD_TO_DEG(galactic->r),RAD_TO_DEG(galactic->d),
                     l[x], b[x]);
-            printf("togal- %lf,%lf,%lf,%lf   fromgal- %lf,%lf,%lf,%lf\n",
-                   toGalactic->q0, toGalactic->q1, toGalactic->q2, toGalactic->q3,
-                   fromGalactic->q0, fromGalactic->q1, fromGalactic->q2, fromGalactic->q3);
             return 3;
         }
-        if (fabs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE ||
+        if ( (fabs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE &&
+                fabs(RAD_TO_DEG(icrsFromGalactic->d) - 90.0) > TOLERANCE ) ||
                 fabs(RAD_TO_DEG(icrsFromGalactic->d) - delta[x]) > TOLERANCE) {
             psError(PS_ERR_UNKNOWN, false,
Index: /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr
===================================================================
--- /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr	(revision 5454)
+++ /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr	(revision 5455)
@@ -6,5 +6,5 @@
 
 <DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO)
-    Unallowable operation: apparent is NULL.
+    Unallowable operation: actual is NULL.
 <DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO)
     Unallowable operation: direction is NULL.
@@ -19,5 +19,5 @@
 
 <DATE><TIME>|<HOST>|E|psGravityDeflection (FILE:LINENO)
-    Unallowable operation: apparent is NULL.
+    Unallowable operation: actual is NULL.
 <DATE><TIME>|<HOST>|E|psGravityDeflection (FILE:LINENO)
     Unallowable operation: sun is NULL.
Index: /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout
===================================================================
--- /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout	(revision 5454)
+++ /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout	(revision 5455)
@@ -1,4 +1,4 @@
 
-actual = r,d  = 0.10218436, 0.10218436
+apparent = r,d  = 0.10218436, 0.10218436
 
-Apparent r,d = 0.2035,0.2035    Actual r,d = 0.2035000000002, 0.2035000000391 
+Actual r,d = 0.2035,0.2035    Apparent r,d = 0.2035000000002, 0.2035000000391 
Index: /trunk/psLib/test/astro/verified/tst_psSphereOps.stderr
===================================================================
--- /trunk/psLib/test/astro/verified/tst_psSphereOps.stderr	(revision 5454)
+++ /trunk/psLib/test/astro/verified/tst_psSphereOps.stderr	(revision 5455)
@@ -1,23 +1,23 @@
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{psSphereRotAlloc()}                                *
+*            TestPoint: psSphereOps{psSphereRotAlloc()}                            *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
 
 
----> TESTPOINT PASSED (psCoord{psSphereRotAlloc()} | tst_psSphereOps.c)
+---> TESTPOINT PASSED (psSphereOps{psSphereRotAlloc()} | tst_psSphereOps.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{psSphereRotQuat()}                                 *
+*            TestPoint: psSphereOps{psSphereRotQuat()}                             *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
 
 
----> TESTPOINT PASSED (psCoord{psSphereRotQuat()} | tst_psSphereOps.c)
+---> TESTPOINT PASSED (psSphereOps{psSphereRotQuat()} | tst_psSphereOps.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{psSphereRotApply()}                                *
+*            TestPoint: psSphereOps{psSphereRotApply()}                            *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
@@ -32,20 +32,18 @@
     Unallowable operation: coord is NULL.
 
----> TESTPOINT PASSED (psCoord{psSphereRotApply()} | tst_psSphereOps.c)
+---> TESTPOINT PASSED (psSphereOps{psSphereRotApply()} | tst_psSphereOps.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{psSphereRotApplyCel()}                             *
+*            TestPoint: psSphereOps{psSphereRotApplyCel()}                         *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
 
-<DATE><TIME>|<HOST>|E|testSphereRotApplyCelestial (FILE:LINENO)
-    ICRS for Galactic tranformation incorrect.  Result is (180,90), expected (0,90)
 
----> TESTPOINT PASSED (psCoord{psSphereRotApplyCel()} | tst_psSphereOps.c)
+---> TESTPOINT PASSED (psSphereOps{psSphereRotApplyCel()} | tst_psSphereOps.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{psSphereRotPrecess()}                              *
+*            TestPoint: psSphereOps{psSphereRotPrecess()}                          *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
@@ -64,22 +62,21 @@
     Unallowable operation: coords is NULL.
 
----> TESTPOINT PASSED (psCoord{psSphereRotPrecess()} | tst_psSphereOps.c)
+---> TESTPOINT PASSED (psSphereOps{psSphereRotPrecess()} | tst_psSphereOps.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{testSphereToFromCube()}                            *
+*            TestPoint: psSphereOps{testSphereOffset()}                            *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
 
+<DATE><TIME>|<HOST>|E|psSphereSetOffset (FILE:LINENO)
+    Unallowable operation: position is NULL.
+<DATE><TIME>|<HOST>|E|psSphereSetOffset (FILE:LINENO)
+    Unallowable operation: offset is NULL.
+<DATE><TIME>|<HOST>|E|psSphereGetOffset (FILE:LINENO)
+    Unallowable operation: position1 is NULL.
+<DATE><TIME>|<HOST>|E|psSphereGetOffset (FILE:LINENO)
+    Unallowable operation: position2 is NULL.
 
----> TESTPOINT PASSED (psCoord{testSphereToFromCube()} | tst_psSphereOps.c)
+---> TESTPOINT PASSED (psSphereOps{testSphereOffset()} | tst_psSphereOps.c)
 
-/***************************** TESTPOINT ******************************************\
-*             TestFile: tst_psSphereOps.c                                          *
-*            TestPoint: psCoord{testSphereOffset()}                                *
-*             TestType: Positive                                                   *
-\**********************************************************************************/
-
-
----> TESTPOINT PASSED (psCoord{testSphereOffset()} | tst_psSphereOps.c)
-
