IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4601


Ignore:
Timestamp:
Jul 22, 2005, 4:44:50 PM (21 years ago)
Author:
desonia
Message:

* empty log message *

Location:
trunk/psLib/test
Files:
1 added
28 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/Makefile.am

    r4550 r4601  
    99        tst_psTime_02 \
    1010        tst_psTime_03 \
    11         tst_psTime_04
    12 #       tst_psCoord
     11        tst_psTime_04 \
     12        tst_psCoord   \
     13        tst_psSphereOps
    1314
    1415tst_psTime_01_SOURCES = tst_psTime_01.c
     
    1718tst_psTime_04_SOURCES = tst_psTime_04.c
    1819tst_psCoord_SOURCES = tst_psCoord.c
     20tst_psSphereOps_SOURCES = tst_psSphereOps.c
    1921tst_psCoord01_SOURCES = tst_psCoord01.c
    2022
  • trunk/psLib/test/astro/tst_psCoord.c

    r4581 r4601  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-07-20 01:21:13 $
     8*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-07-23 02:44:09 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1414#include "psTest.h"
    1515#include "pslib_strict.h"
    16 static psS32 testSphereRotAlloc(void);
    1716static psS32 testPlaneTransformAlloc(void);
    1817static psS32 testPlaneDistortAlloc(void);
    1918static psS32 testPlaneTransformApply(void);
    2019static psS32 testPlaneDistortApply(void);
    21 static psS32 testSphereRotApply1(void);
    22 static psS32 testSphereRotApply2(void);
    23 static psS32 testSphereRotApply3(void);
    24 static psS32 testSphereRotApply4(void);
    25 static psS32 testSphereRotApply5(void);
    26 static psS32 testSphereRotICRSToEcliptic(void);
    27 static psS32 testSphereRotEclipticToICRS(void);
    28 static psS32 testSphereRotICRSToGalactic(void);
    29 static psS32 testSphereRotGalacticToICRS(void);
    30 static psS32 testSphereRotPrecess(void);
     20
    3121testDescription tests[] = {
    32                               {testSphereRotAlloc, 819, "psSphereRotAlloc()", 0, false},
    3322                              {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false},
    3423                              {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false},
    3524                              {testPlaneTransformApply, 831, "psPlaneTransformApply()", 0, false},
    3625                              {testPlaneDistortApply, 832, "psPlaneDistortApply()", 0, false},
    37                               {testSphereRotApply1, 820, "psSphereRotApply()", 0, false},
    38                               {testSphereRotApply2, 820, "psSphereRotApply()", 0, false},
    39                               {testSphereRotApply3, 820, "psSphereRotApply()", 0, false},
    40                               {testSphereRotApply4, 820, "psSphereRotApply()", 0, false},
    41                               {testSphereRotApply5, 820, "psSphereRotApply()", 0, false},
    42                               {testSphereRotICRSToEcliptic, 821, "psSphereRotICRSToEcliptic()", 0, false},
    43                               {testSphereRotEclipticToICRS, 822, "psSphereRotEclipticToICRS()", 0, false},
    44                               {testSphereRotICRSToGalactic, 824, "psSphereRotICRSToGalactic()", 0, false},
    45                               {testSphereRotGalacticToICRS, 823, "psSphereRotGalacticToICRS()", 0, false},
    46                               {testSphereRotPrecess, 825, "psSphereRotPrecess()", 0, false},
    4726                              {NULL}
    4827                          };
     
    5332
    5433    return ( ! runTestSuite( stderr, "psCoord", tests, argc, argv ) );
    55 }
    56 
    57 #define DEG_INC   30.0
    58 
    59 #define MJD_1900  15021.0        // Modified Julian Day 1/1/1900 00:00:00
    60 #define MJD_2000  51544.0        // Modified Julian Day 1/1/2000 00:00:00
    61 #define MJD_2100  88069.0        // Modified Julian Day 1/1/2100 00:00:00
    62 
    63 #define ERROR_TOL   0.0001
    64 
    65 #define ALPHA_P 1.0
    66 #define DELTA_P 2.0
    67 #define PHI_P 3.0
    68 
    69 psS32 testSphereRotAlloc( void )
    70 {
    71     // Allocate data structure
    72     psSphereRot* myST = psSphereRotAlloc(ALPHA_P, DELTA_P, PHI_P);
    73 
    74     // Verify null not returned
    75     if(myST == NULL) {
    76         psError(PS_ERR_UNKNOWN,true,"Returned NULL with valid parameters");
    77         return 1;
    78     }
    79     // Verify sin member is updated
    80     double vx = cos(DELTA_P)*cos(ALPHA_P);
    81     double vy = cos(DELTA_P)*sin(ALPHA_P);
    82     double vz = sin(DELTA_P);
    83     double q0 = vx * sin(PHI_P/2.0);
    84     double q1 = vy * sin(PHI_P/2.0);
    85     double q2 = vz * sin(PHI_P/2.0);
    86     double q3 = cos(PHI_P/2.0);
    87 
    88     if (FLT_EPSILON < fabs(q0 - myST->q0)) {
    89         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q0, q0);
    90         return 2;
    91     }
    92     if (FLT_EPSILON < fabs(q1 - myST->q1)) {
    93         psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f\n", myST->q1, q1);
    94         return 3;
    95     }
    96     if (FLT_EPSILON < fabs(q2 - myST->q2)) {
    97         psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f\n", myST->q2, q2);
    98         return 4;
    99     }
    100     if (FLT_EPSILON < fabs(q3 - myST->q3)) {
    101         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q3, q3);
    102         return 5;
    103     }
    104 
    105     // Free data structure
    106     psFree(myST);
    107 
    108     return 0;
    10934}
    11035
     
    445370}
    446371
    447 // We do a simple identity transformation on a few RA, DEC pairs.
    448 psS32 testSphereRotApply1( void )
    449 {
    450     psSphere *in = psSphereAlloc();
    451     psSphere *out = psSphereAlloc();
    452     psSphere *temp = NULL;
    453     psSphere *rc = NULL;
    454     psSphereRot *myST = psSphereRotAlloc(0.0, 0.0, 0.0);
    455 
    456     for (float r=0.0;r<180.0;r+=DEG_INC) {
    457         for (float d=0.0;d<90.0;d+=DEG_INC) {
    458             in->r = DEG_TO_RAD(r);
    459             in->d = DEG_TO_RAD(d);
    460             in->rErr = 0.0;
    461             in->dErr = 0.0;
    462 
    463             if(psSphereRotApply(out, myST, in) != out) {
    464                 psError(PS_ERR_UNKNOWN,true,"Did not return output pointer.");
    465                 return 1;
    466             }
    467             if (ERROR_TOL < fabs(out->r - in->r)) {
    468                 psError(PS_ERR_UNKNOWN,true,"out->r is %f, should be %f\n", out->r, in->r);
    469                 return 2;
    470             }
    471             if (ERROR_TOL < fabs(out->d - in->d)) {
    472                 psError(PS_ERR_UNKNOWN,true,"out->d is %f, should be %f\n", out->d, in->d);
    473                 return 3;
    474             }
    475         }
    476     }
    477 
    478     // Verify new sphere object is created if out parameter NULL
    479     temp = psSphereRotApply(NULL, myST, in);
    480     if ( temp == NULL) {
    481         psError(PS_ERR_UNKNOWN,true,"Returned NULL when out parameter was null");
    482         return 4;
    483     }
    484     psFree(temp);
    485 
    486     // Verify NULL returned if transform structure null
    487     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
    488     rc = psSphereRotApply(NULL, NULL, in);
    489     if (rc != NULL) {
    490         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply() did not return NULL.");
    491         return 5;
    492     }
    493 
    494     // Verify NULL returned when input sphere is NULL
    495     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
    496     rc = psSphereRotApply(NULL, myST, NULL);
    497     if (rc != NULL) {
    498         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply() did not return NULL");
    499         return 6;
    500     }
    501 
    502     psFree(myST);
    503     psFree(out);
    504     psFree(in);
    505 
    506     return 0;
    507 }
    508 
    509 /******************************************************************************
    510 testSphereRotApply2(): This test verifies that psSphereRotApply()
    511 works properly.  We create two psSphereRots: a forward transform and a
    512 reverse transform (which is the mathematical inverse of the forward transform).
    513 We apply both transforms to several spherical coordinates and ensure that the
    514 original input coordinate is obtained after applying both transforms.
    515  
    516 XXX: We currently test the alpha and delta offsets independently.  Attempts to
    517 test them both concurrently failed.  Determine why this is.  Are the following
    518 spherical transforms not mathematical inverses?
    519     psSphereRotAlloc(X, Y, 0.0)
    520     psSphereRotAlloc(-X, -Y, 0.0)
    521  *****************************************************************************/
    522 #define ERROR_PERCENT 0.01
    523 psS32 testSphereRotApply2( void )
    524 {
    525     psS32 testStatus = 0;
    526     psSphere in;
    527     psSphere out;
    528     psSphere out2;
    529     psSphereRot *mySphereRotForward = NULL;
    530     psSphereRot *mySphereRotReverse = NULL;
    531 
    532 
    533     mySphereRotForward = psSphereRotAlloc(DEG_TO_RAD(22.0),
    534                                           0.0,
    535                                           0.0);
    536     mySphereRotReverse = psSphereRotAlloc(DEG_TO_RAD(-22.0),
    537                                           0.0,
    538                                           0.0);
    539 
    540     for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
    541         for (float d=0.1;d<90.0;d+=(DEG_INC/5.0)) {
    542             in.r = DEG_TO_RAD(r);
    543             in.d = DEG_TO_RAD(d);
    544             in.rErr = 0.0;
    545             in.dErr = 0.0;
    546 
    547             psSphereRotApply(&out, mySphereRotForward, &in);
    548             psSphereRotApply(&out2, mySphereRotReverse, &out);
    549 
    550             if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
    551                     (fabs((in.d - out2.d) / in.d) > ERROR_PERCENT)) {
    552                 printf("ERROR: \n");
    553                 printf("Input  coords (R, D) are (%f, %f)\n", in.r, in.d);
    554                 printf("Output coords (R, D) are (%f, %f)\n", out2.r, out2.d);
    555                 testStatus = 4;
    556             }
    557         }
    558     }
    559     psFree(mySphereRotForward);
    560     psFree(mySphereRotReverse);
    561 
    562     mySphereRotForward = psSphereRotAlloc(0.0,
    563                                           DEG_TO_RAD(33.0),
    564                                           0.0);
    565     mySphereRotReverse = psSphereRotAlloc(0.0,
    566                                           DEG_TO_RAD(-33.0),
    567                                           0.0);
    568     for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
    569         for (float d=0.1;d<90.0;d+=(DEG_INC/5.0)) {
    570             in.r = DEG_TO_RAD(r);
    571             in.d = DEG_TO_RAD(d);
    572             in.rErr = 0.0;
    573             in.dErr = 0.0;
    574 
    575             psSphereRotApply(&out, mySphereRotForward, &in);
    576             psSphereRotApply(&out2, mySphereRotReverse, &out);
    577 
    578             if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
    579                     (fabs((in.d - out2.d) / in.d) > ERROR_PERCENT)) {
    580                 printf("ERROR: \n");
    581                 printf("Input  coords (R, D) are (%f, %f)\n", in.r, in.d);
    582                 printf("Output coords (R, D) are (%f, %f)\n", out2.r, out2.d);
    583                 testStatus = 4;
    584             }
    585         }
    586     }
    587     psFree(mySphereRotForward);
    588     psFree(mySphereRotReverse);
    589 
    590     return(testStatus);
    591 }
    592 
    593 // Test point 1  ADD  ICRS(0,0) to Galactic (96.337272,-60.188553)
    594 //                              to Ecliptic (0,0) with T=1
    595 #define SPHERE_COORD_TP1_GAL_R           1.681409       //  96.337272 degrees
    596 #define SPHERE_COORD_TP1_GAL_D          -1.050488       // -60.188553 degrees
    597 #define SPHERE_COORD_TP1_ECL_R           0.0
    598 #define SPHERE_COORD_TP1_ECL_D           0.0
    599 #define SPHERE_COORD_TP1_INVERSE_R       0.0
    600 #define SPHERE_COORD_TP1_INVERSE_D       0.0
    601 
    602 // Test point 2 ADD  ICRS(0,90) to Galactic (122.93192, 27.12825)
    603 //                              to Ecliptic (90,66.560719) with T=1
    604 #define SPHERE_COORD_TP2_GAL_R           2.145567       // 122.93192 degrees
    605 #define SPHERE_COORD_TP2_GAL_D           0.473477       // 27.12825  degrees
    606 #define SPHERE_COORD_TP2_ECL_R           1.570796       // 90        degrees
    607 #define SPHERE_COORD_TP2_ECL_D           1.161704       // 66.560719 degrees
    608 #define SPHERE_COORD_TP2_INVERSE_R       0.0            // 0         degrees
    609 #define SPHERE_COORD_TP2_INVERSE_D       1.570796       // 90        degrees
    610 
    611 // Test point 3 ADD  ICRS(180,30) to Galactic (195.639488, 78.353806)
    612 //                                to Ecliptic (167.072470, 27.308813) with T=2
    613 #define SPHERE_COORD_TP3_GAL_R           3.414553       // 195.639488 degrees
    614 #define SPHERE_COORD_TP3_GAL_D           1.367532       // 78.353806  degrees
    615 #define SPHERE_COORD_TP3_ECL_R           2.915965       // 167.07247  degrees
    616 #define SPHERE_COORD_TP3_ECL_D           0.476629       // 27.308813  degrees
    617 #define SPHERE_COORD_TP3_INVERSE_R       3.141593       // 180.0      degrees
    618 #define SPHERE_COORD_TP3_INVERSE_D       0.523599       // 30.0       degrees
    619 
    620 psS32 testSphereRotApply3( void)
    621 {
    622 
    623     psSphereRot*  testTransform;
    624     psSphere*           inputCoord = psSphereAlloc();
    625     psSphere*           outputCoord = NULL;
    626     psSphere*           inverseOutputCoord = NULL;
    627 
    628     inputCoord->r = SPHERE_COORD_TP1_INVERSE_R;
    629     inputCoord->d = SPHERE_COORD_TP1_INVERSE_D;
    630     inputCoord->rErr = 0.0;
    631     inputCoord->dErr = 0.0;
    632 
    633     // Set test date time to 1/1/2000 00:00:00
    634     psTime* testDateTime = psTimeFromMJD(MJD_2000);
    635 
    636     // Create transform ICRS to Galactic
    637     testTransform = psSphereRotICRSToGalactic();
    638 
    639     // Perform transform from ICRS to Galactic
    640     outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    641     // Verify output not NULL and member values set correctly
    642     if(outputCoord == NULL) {
    643         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    644         return 1;
    645     }
    646     if(fabs(outputCoord->r - SPHERE_COORD_TP1_GAL_R) > ERROR_TOL) {
    647         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    648                 outputCoord->r, SPHERE_COORD_TP1_GAL_R);
    649         return 2;
    650     }
    651     if(fabs(outputCoord->d - SPHERE_COORD_TP1_GAL_D) > ERROR_TOL) {
    652         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    653                 outputCoord->d, SPHERE_COORD_TP1_GAL_D);
    654         return 3;
    655     }
    656     psFree(testTransform);
    657 
    658     // Create inverse transform Galactic to ICRS
    659     testTransform = psSphereRotGalacticToICRS();
    660 
    661     // Perform transform from Galactic to ICRS
    662     inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    663     // Verify output not NULL and member values set correctly
    664     if(inverseOutputCoord == NULL) {
    665         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    666         return 4;
    667     }
    668 
    669     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP1_INVERSE_R) > ERROR_TOL) {
    670         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    671                 inverseOutputCoord->r, SPHERE_COORD_TP1_INVERSE_R);
    672         return 5;
    673     }
    674     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP1_INVERSE_D) > ERROR_TOL) {
    675         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    676                 inverseOutputCoord->d, SPHERE_COORD_TP1_INVERSE_D);
    677         return 6;
    678     }
    679     psFree(testTransform);
    680 
    681     // Create transform ICRS to Ecliptic
    682     testTransform = psSphereRotICRSToEcliptic(testDateTime);
    683 
    684     // Perform transform from ICRS to Ecliptic
    685     outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    686     // Verify output not NULL and member values set correctly
    687     if(outputCoord == NULL) {
    688         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    689         return 7;
    690     }
    691     if(fabs(outputCoord->r - SPHERE_COORD_TP1_ECL_R) > ERROR_TOL) {
    692         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    693                 outputCoord->r, SPHERE_COORD_TP1_ECL_R);
    694         return 8;
    695     }
    696     if(fabs(outputCoord->d - SPHERE_COORD_TP1_ECL_D) > ERROR_TOL) {
    697         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    698                 outputCoord->d, SPHERE_COORD_TP1_ECL_D);
    699         return 9;
    700     }
    701     psFree(testTransform);
    702 
    703     // Create inverse transform Ecliptic to ICRS
    704     testTransform = psSphereRotEclipticToICRS(testDateTime);
    705 
    706     // Perform transform from Ecliptic to ICRS
    707     inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    708     // Verify output not NULL and member values set correctly
    709     if(inverseOutputCoord == NULL) {
    710         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    711         return 10;
    712     }
    713     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP1_INVERSE_R) > ERROR_TOL) {
    714         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    715                 inverseOutputCoord->r, SPHERE_COORD_TP1_INVERSE_R);
    716         return 11;
    717     }
    718     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP1_INVERSE_D) > ERROR_TOL) {
    719         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    720                 inverseOutputCoord->d, SPHERE_COORD_TP1_INVERSE_D);
    721         return 12;
    722     }
    723     psFree(testTransform);
    724 
    725     psFree(testDateTime);
    726     psFree(outputCoord);
    727     psFree(inputCoord);
    728     psFree(inverseOutputCoord);
    729 
    730     return 0;
    731 }
    732 
    733 psS32 testSphereRotApply4( void)
    734 {
    735 
    736     psSphereRot*  testTransform;
    737     psSphere*           inputCoord = psSphereAlloc();
    738     psSphere*           outputCoord = NULL;
    739     psSphere*           inverseOutputCoord = NULL;
    740 
    741     inputCoord->r = SPHERE_COORD_TP2_INVERSE_R;
    742     inputCoord->d = SPHERE_COORD_TP2_INVERSE_D;
    743     inputCoord->rErr = 0.0;
    744     inputCoord->dErr = 0.0;
    745 
    746     // Set test date time to 1/1/2000 00:00:00
    747     psTime* testDateTime = psTimeFromMJD(MJD_2000);
    748 
    749     // Create transform ICRS to Galactic
    750     testTransform = psSphereRotICRSToGalactic();
    751 
    752     // Perform transform from ICRS to Galactic
    753     outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    754     // Verify output not NULL and member values set correctly
    755     if(outputCoord == NULL) {
    756         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    757         return 1;
    758     }
    759     if(fabs(outputCoord->r - SPHERE_COORD_TP2_GAL_R) > ERROR_TOL) {
    760         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    761                 outputCoord->r, SPHERE_COORD_TP2_GAL_R);
    762         return 2;
    763     }
    764     if(fabs(outputCoord->d - SPHERE_COORD_TP2_GAL_D) > ERROR_TOL) {
    765         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    766                 outputCoord->d, SPHERE_COORD_TP2_GAL_D);
    767         return 3;
    768     }
    769     psFree(testTransform);
    770 
    771     // Create inverse transform Galactic to ICRS
    772     testTransform = psSphereRotGalacticToICRS();
    773 
    774     // Perform transform from Galactic to ICRS
    775     inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    776     // Verify output not NULL and member values set correctly
    777     if(inverseOutputCoord == NULL) {
    778         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    779         return 4;
    780     }
    781     // atan2 function introduces some error with y close to zero, increased error tolerance
    782     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP2_INVERSE_R) > ERROR_TOL+0.1) {
    783         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    784                 inverseOutputCoord->r, SPHERE_COORD_TP2_INVERSE_R);
    785         return 5;
    786     }
    787     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP2_INVERSE_D) > ERROR_TOL) {
    788         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    789                 inverseOutputCoord->d, SPHERE_COORD_TP2_INVERSE_D);
    790         return 6;
    791     }
    792     psFree(testTransform);
    793 
    794     // Create transform ICRS to Ecliptic
    795     testTransform = psSphereRotICRSToEcliptic(testDateTime);
    796 
    797     // Perform transform from ICRS to Ecliptic
    798     outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    799     // Verify output not NULL and member values set correctly
    800     if(outputCoord == NULL) {
    801         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    802         return 7;
    803     }
    804     if(fabs(outputCoord->r - SPHERE_COORD_TP2_ECL_R) > ERROR_TOL) {
    805         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    806                 outputCoord->r, SPHERE_COORD_TP2_ECL_R);
    807         return 8;
    808     }
    809     if(fabs(outputCoord->d - SPHERE_COORD_TP2_ECL_D) > ERROR_TOL) {
    810         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    811                 outputCoord->d, SPHERE_COORD_TP2_ECL_D);
    812         return 9;
    813     }
    814     psFree(testTransform);
    815 
    816     // Create inverse transform Ecliptic to ICRS
    817     testTransform = psSphereRotEclipticToICRS(testDateTime);
    818 
    819     // Perform transform from Ecliptic to ICRS
    820     inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    821     // Verify output not NULL and member values set correctly
    822     if(inverseOutputCoord == NULL) {
    823         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    824         return 10;
    825     }
    826     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP2_INVERSE_R) > ERROR_TOL) {
    827         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    828                 inverseOutputCoord->r, SPHERE_COORD_TP2_INVERSE_R);
    829         return 11;
    830     }
    831     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP2_INVERSE_D) > ERROR_TOL) {
    832         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    833                 inverseOutputCoord->d, SPHERE_COORD_TP2_INVERSE_D);
    834         return 12;
    835     }
    836     psFree(testTransform);
    837 
    838     psFree(testDateTime);
    839     psFree(outputCoord);
    840     psFree(inputCoord);
    841     psFree(inverseOutputCoord);
    842 
    843     return 0;
    844 }
    845 
    846 psS32 testSphereRotApply5( void)
    847 {
    848     psSphereRot*  testTransform;
    849     psSphere*           inputCoord = psSphereAlloc();
    850     psSphere*           outputCoord = NULL;
    851     psSphere*           inverseOutputCoord = NULL;
    852 
    853     inputCoord->r = SPHERE_COORD_TP3_INVERSE_R;
    854     inputCoord->d = SPHERE_COORD_TP3_INVERSE_D;
    855     inputCoord->rErr = 0.0;
    856     inputCoord->dErr = 0.0;
    857 
    858     // Set test date time to 1/1/2100 00:00:00
    859     psTime* testDateTime = psTimeFromMJD(MJD_2100);
    860 
    861     // Create transform ICRS to Galactic
    862     testTransform = psSphereRotICRSToGalactic();
    863 
    864     // Perform transform from ICRS to Galactic
    865     outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    866     // Verify output not NULL and member values set correctly
    867     if(outputCoord == NULL) {
    868         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    869         return 1;
    870     }
    871     if(fabs(outputCoord->r - SPHERE_COORD_TP3_GAL_R) > ERROR_TOL) {
    872         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    873                 outputCoord->r, SPHERE_COORD_TP3_GAL_R);
    874         return 2;
    875     }
    876     if(fabs(outputCoord->d - SPHERE_COORD_TP3_GAL_D) > ERROR_TOL) {
    877         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    878                 outputCoord->d, SPHERE_COORD_TP3_GAL_D);
    879         return 3;
    880     }
    881     psFree(testTransform);
    882 
    883     // Create inverse transform Galactic to ICRS
    884     testTransform = psSphereRotGalacticToICRS();
    885 
    886     // Perform transform from Galactic to ICRS
    887     inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    888     // Verify output not NULL and member values set correctly
    889     if(inverseOutputCoord == NULL) {
    890         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    891         return 4;
    892     }
    893     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP3_INVERSE_R) > ERROR_TOL+0.1) {
    894         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    895                 inverseOutputCoord->r, SPHERE_COORD_TP3_INVERSE_R);
    896         return 5;
    897     }
    898     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP3_INVERSE_D) > ERROR_TOL) {
    899         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    900                 inverseOutputCoord->d, SPHERE_COORD_TP3_INVERSE_D);
    901         return 6;
    902     }
    903     psFree(testTransform);
    904 
    905     // Create transform ICRS to Ecliptic
    906     testTransform = psSphereRotICRSToEcliptic(testDateTime);
    907 
    908     // Perform transform from ICRS to Ecliptic
    909     outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    910     // Verify output not NULL and member values set correctly
    911     if(outputCoord == NULL) {
    912         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    913         return 7;
    914     }
    915     if(fabs(outputCoord->r - SPHERE_COORD_TP3_ECL_R) > ERROR_TOL) {
    916         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    917                 outputCoord->r, SPHERE_COORD_TP3_ECL_R);
    918         return 8;
    919     }
    920     if(fabs(outputCoord->d - SPHERE_COORD_TP3_ECL_D) > ERROR_TOL) {
    921         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    922                 outputCoord->d, SPHERE_COORD_TP3_ECL_D);
    923         return 9;
    924     }
    925     psFree(testTransform);
    926 
    927     // Create inverse transform Ecliptic to ICRS
    928     testTransform = psSphereRotEclipticToICRS(testDateTime);
    929 
    930     // Perform transform from Ecliptic to ICRS
    931     inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    932     // Verify output not NULL and member values set correctly
    933     if(inverseOutputCoord == NULL) {
    934         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    935         return 10;
    936     }
    937     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP3_INVERSE_R) > ERROR_TOL) {
    938         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    939                 inverseOutputCoord->r, SPHERE_COORD_TP3_INVERSE_R);
    940         return 11;
    941     }
    942     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP3_INVERSE_D) > ERROR_TOL) {
    943         psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    944                 inverseOutputCoord->d, SPHERE_COORD_TP3_INVERSE_D);
    945         return 12;
    946     }
    947     psFree(testTransform);
    948 
    949     psFree(testDateTime);
    950     psFree(outputCoord);
    951     psFree(inputCoord);
    952     psFree(inverseOutputCoord);
    953 
    954     return 0;
    955 }
    956 
    957 #define SPHERE_PRECESS_TP1_R            0.0               //    0.0       degrees
    958 #define SPHERE_PRECESS_TP1_D            0.0               //    0.0       degrees
    959 #define SPHERE_PRECESS_TP1_EXPECT_R     6.238453          //  357.437     degrees
    960 #define SPHERE_PRECESS_TP1_EXPECT_D    -0.019426          //   -1.113     degrees
    961 #define SPHERE_PRECESS_TP2_R            0.0               //    0.0       degrees
    962 #define SPHERE_PRECESS_TP2_D            1.570796          //   90.0       degrees
    963 #define SPHERE_PRECESS_TP2_EXPECT_R     6.260828          //  358.719     degrees
    964 #define SPHERE_PRECESS_TP2_EXPECT_D     1.551353          //   88.886     degrees
    965 #define SPHERE_PRECESS_TP3_R            3.141593          //  180.0       degrees
    966 #define SPHERE_PRECESS_TP3_D            0.523599          //   30.0       degrees
    967 #define SPHERE_PRECESS_TP3_EXPECT_R     3.096616          //  177.423     degrees
    968 #define SPHERE_PRECESS_TP3_EXPECT_D     0.543024          //   31.113     degrees
    969 
    970 psS32 testSphereRotPrecess( void )
    971 {
    972     psSphere*     inputCoord  = psSphereAlloc();
    973     psSphere*     outputCoord = NULL;
    974     psTime*       fromTime    = psTimeFromMJD(MJD_2100);
    975     psTime*       toTime      = psTimeFromMJD(MJD_1900);
    976 
    977     // Set input coordinate
    978     inputCoord->r = SPHERE_PRECESS_TP1_R;
    979     inputCoord->d = SPHERE_PRECESS_TP1_D;
    980     inputCoord->rErr = 0.0;
    981     inputCoord->dErr = 0.0;
    982 
    983     // Calculate precess
    984     outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
    985     // Verify return is not NULL
    986     if(outputCoord == NULL) {
    987         psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
    988         return 1;
    989     }
    990     // Verify return with expected values
    991     if( fabs(outputCoord->r - SPHERE_PRECESS_TP1_EXPECT_R) > ERROR_TOL) {
    992         psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",
    993                 outputCoord->r,SPHERE_PRECESS_TP1_EXPECT_R);
    994         return 2;
    995     }
    996     if( fabs(outputCoord->d - SPHERE_PRECESS_TP1_EXPECT_D) > ERROR_TOL) {
    997         psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",
    998                 outputCoord->d,SPHERE_PRECESS_TP1_EXPECT_D);
    999         return 3;
    1000     }
    1001     psFree(outputCoord);
    1002 
    1003     // Set input coordinate
    1004     inputCoord->r = SPHERE_PRECESS_TP2_R;
    1005     inputCoord->d = SPHERE_PRECESS_TP2_D;
    1006     inputCoord->rErr = 0.0;
    1007     inputCoord->dErr = 0.0;
    1008 
    1009     // Calculate precess
    1010     outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
    1011     // Verify return is not NULL
    1012     if(outputCoord == NULL) {
    1013         psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
    1014         return 4;
    1015     }
    1016     // Verify return with expected values
    1017     if( fabs(outputCoord->r - SPHERE_PRECESS_TP2_EXPECT_R) > ERROR_TOL) {
    1018         psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",
    1019                 outputCoord->r,SPHERE_PRECESS_TP2_EXPECT_R);
    1020         return 5;
    1021     }
    1022     if( fabs(outputCoord->d - SPHERE_PRECESS_TP2_EXPECT_D) > ERROR_TOL) {
    1023         psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",
    1024                 outputCoord->d,SPHERE_PRECESS_TP2_EXPECT_D);
    1025         return 6;
    1026     }
    1027     psFree(outputCoord);
    1028 
    1029     // Set input coordinate
    1030     inputCoord->r = SPHERE_PRECESS_TP3_R;
    1031     inputCoord->d = SPHERE_PRECESS_TP3_D;
    1032     inputCoord->rErr = 0.0;
    1033     inputCoord->dErr = 0.0;
    1034 
    1035     // Calculate precess
    1036     outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
    1037     // Verify return is not NULL
    1038     if(outputCoord == NULL) {
    1039         psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
    1040         return 7;
    1041     }
    1042     // Verify return with expected values
    1043     if( fabs(outputCoord->r - SPHERE_PRECESS_TP3_EXPECT_R) > ERROR_TOL) {
    1044         psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",
    1045                 outputCoord->r,SPHERE_PRECESS_TP3_EXPECT_R);
    1046         return 8;
    1047     }
    1048     if( fabs(outputCoord->d - SPHERE_PRECESS_TP3_EXPECT_D) > ERROR_TOL) {
    1049         psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",
    1050                 outputCoord->d,SPHERE_PRECESS_TP3_EXPECT_D);
    1051         return 9;
    1052     }
    1053     psFree(outputCoord);
    1054 
    1055     // Invoke precess with invalid parameter
    1056     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1057     outputCoord = psSpherePrecess(inputCoord, fromTime, NULL);
    1058     if(outputCoord != NULL) {
    1059         psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
    1060         return 10;
    1061     }
    1062 
    1063     // Invoke precess with invalid parameter
    1064     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1065     outputCoord = psSpherePrecess(inputCoord, NULL, toTime);
    1066     if(outputCoord != NULL) {
    1067         psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
    1068         return 11;
    1069     }
    1070 
    1071     // Invoke precess with invalid parameter
    1072     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1073     outputCoord = psSpherePrecess(NULL, fromTime, toTime);
    1074     if(outputCoord != NULL) {
    1075         psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
    1076         return 12;
    1077     }
    1078 
    1079     // Free objects
    1080     psFree(fromTime);
    1081     psFree(toTime);
    1082     psFree(inputCoord);
    1083 
    1084     return 0;
    1085 }
    1086 
    1087 psS32 testSphereRotICRSToEcliptic( void )
    1088 {
    1089     psF64  expectedQ0 = 0.0;
    1090     psF64  expectedQ1 = 0.0;
    1091     psF64  expectedQ2 = 0.0;
    1092     psF64  expectedQ3 = 0.0;
    1093 
    1094     // Set test date time to 1/1/2000 00:00:00
    1095     psTime* testDateTime = psTimeFromMJD(MJD_2000);
    1096 
    1097     // Invoke function to set psSphereRota objec
    1098     psSphereRot *myST = psSphereRotICRSToEcliptic(testDateTime);
    1099 
    1100     // Verify expected values for the specified time
    1101     if (ERROR_TOL < fabs(expectedQ0 - myST->q0)) {
    1102         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f",
    1103                 myST->q0, expectedQ0);
    1104         return 1;
    1105     }
    1106     if (ERROR_TOL < fabs(expectedQ1 - myST->q1)) {
    1107         psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f",
    1108                 myST->q1, expectedQ1);
    1109         return 2;
    1110     }
    1111     if (ERROR_TOL < fabs(expectedQ2 - myST->q2)) {
    1112         psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f",
    1113                 myST->q2, expectedQ2);
    1114         return 3;
    1115     }
    1116     if (ERROR_TOL < fabs(expectedQ3 - myST->q3)) {
    1117         psError(PS_ERR_UNKNOWN,true,"myST->q3 is %f, should be %f",
    1118                 myST->q3, expectedQ3);
    1119         return 4;
    1120     }
    1121     psFree(myST);
    1122     psFree(testDateTime);
    1123 
    1124     // Set test date time to 1/1/2100 00:00:00
    1125     testDateTime = psTimeFromMJD(MJD_2100);
    1126 
    1127     // Invoke function to set psSphereRota objec
    1128     myST = psSphereRotICRSToEcliptic(testDateTime);
    1129 
    1130     // Verify expected values for the specified time
    1131     // Verify expected values for the specified time
    1132     if (ERROR_TOL < fabs(expectedQ0 - myST->q0)) {
    1133         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f",
    1134                 myST->q0, expectedQ0);
    1135         return 5;
    1136     }
    1137     if (ERROR_TOL < fabs(expectedQ1 - myST->q1)) {
    1138         psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f",
    1139                 myST->q1, expectedQ1);
    1140         return 6;
    1141     }
    1142     if (ERROR_TOL < fabs(expectedQ2 - myST->q2)) {
    1143         psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f",
    1144                 myST->q2, expectedQ2);
    1145         return 7;
    1146     }
    1147     if (ERROR_TOL < fabs(expectedQ3 - myST->q3)) {
    1148         psError(PS_ERR_UNKNOWN,true,"myST->q3 is %f, should be %f",
    1149                 myST->q3, expectedQ3);
    1150         return 8;
    1151     }
    1152     psFree(myST);
    1153     psFree(testDateTime);
    1154 
    1155     // Verify if argument psTime is NULL, function returns NULL and error message generated
    1156     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1157     myST = psSphereRotICRSToEcliptic(NULL);
    1158     if (myST != NULL) {
    1159         psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToEcliptic() did not return NULL.");
    1160         return 9;
    1161     }
    1162 
    1163     // Verify if argument psTime is less than 1900, function return NULL and error msg generated
    1164     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1165     testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
    1166     myST = psSphereRotICRSToEcliptic(testDateTime);
    1167     if (myST != NULL) {
    1168         psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToEcliptic() did not return NULL.");
    1169         return 10;
    1170     }
    1171     psFree(testDateTime);
    1172 
    1173     return 0;
    1174 }
    1175 
    1176 
    1177 psS32 testSphereRotEclipticToICRS( void )
    1178 {
    1179     psF64  expectedPhiP = 0.0;
    1180     psF64  expectedAlphaP = 0.0;
    1181     psF64  expectedCosDeltaP = 0.0;
    1182     psF64  expectedSinDeltaP = 0.0;
    1183 
    1184     // Set test date time to 1/1/2000 00:00:00
    1185     psTime* testDateTime = psTimeFromMJD(MJD_2000);
    1186 
    1187     // Invoke function to set psSphereRota object
    1188     psSphereRot *myST = psSphereRotEclipticToICRS(testDateTime);
    1189 
    1190     // Verify expected values for the specified time
    1191     if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
    1192         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
    1193                 myST->sinDeltaP, expectedSinDeltaP);
    1194         return 1;
    1195     }
    1196     if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
    1197         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
    1198                 myST->cosDeltaP, expectedCosDeltaP);
    1199         return 2;
    1200     }
    1201     if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
    1202         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
    1203                 myST->alphaP, expectedAlphaP);
    1204         return 3;
    1205     }
    1206     if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
    1207         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
    1208                 myST->phiP, expectedPhiP);
    1209         return 4;
    1210     }
    1211     psFree(myST);
    1212     psFree(testDateTime);
    1213 
    1214     expectedCosDeltaP = EXPECT_COS_DELTAP_2100;
    1215     expectedSinDeltaP = -EXPECT_SIN_DELTAP_2100;
    1216 
    1217     // Set test date time to 1/1/2100 00:00:00
    1218     testDateTime = psTimeFromMJD(MJD_2100);
    1219 
    1220     // Invoke function to set psSphereRota objec
    1221     myST = psSphereRotEclipticToICRS(testDateTime);
    1222 
    1223     // Verify expected values for the specified time
    1224     if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
    1225         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
    1226                 myST->sinDeltaP, expectedSinDeltaP);
    1227         return 5;
    1228     }
    1229     if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
    1230         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
    1231                 myST->cosDeltaP, expectedCosDeltaP);
    1232         return 6;
    1233     }
    1234     if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
    1235         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
    1236                 myST->alphaP, expectedAlphaP);
    1237         return 7;
    1238     }
    1239     if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
    1240         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
    1241                 myST->phiP, expectedPhiP);
    1242         return 8;
    1243     }
    1244     psFree(myST);
    1245     psFree(testDateTime);
    1246 
    1247     // Verify if argument psTime is NULL, function returns NULL and error message generated
    1248     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1249     myST = psSphereRotEclipticToICRS(NULL);
    1250     if (myST != NULL) {
    1251         psError(PS_ERR_UNKNOWN,true,"psSphereRotEclipticICRS() did not return NULL.");
    1252         return 9;
    1253     }
    1254 
    1255     // Verify if argument psTime is less than 1900, function return NULL and error msg generated
    1256     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1257     testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
    1258     myST = psSphereRotEclipticToICRS(testDateTime);
    1259     if (myST != NULL) {
    1260         psError(PS_ERR_UNKNOWN,true,"psSphereRotEclipticToICRS() did not return NULL.");
    1261         return 10;
    1262     }
    1263     psFree(testDateTime);
    1264 
    1265     return 0;
    1266 }
    1267 
    1268 #define ITG_EXPECT_ALPHAP      4.93683
    1269 #define ITG_EXPECT_SINDELTAP   0.88999
    1270 #define ITG_EXPECT_COSDELTAP   0.45598
    1271 #define ITG_EXPECT_PHIP        0.57477
    1272 
    1273 psS32 testSphereRotICRSToGalactic( void )
    1274 {
    1275     // Invoke function
    1276     psSphereRot *myST = psSphereRotICRSToGalactic();
    1277 
    1278     // Verify did not return NULL
    1279     if(myST == NULL) {
    1280         psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToGalactic returned NULL");
    1281         return 1;
    1282     }
    1283     // Verify returned structure has members set properly
    1284     if (ERROR_TOL < fabs(ITG_EXPECT_SINDELTAP - myST->sinDeltaP)) {
    1285         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
    1286                 myST->sinDeltaP, ITG_EXPECT_SINDELTAP);
    1287         return 2;
    1288     }
    1289     if (ERROR_TOL < fabs(ITG_EXPECT_COSDELTAP - myST->cosDeltaP)) {
    1290         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
    1291                 myST->cosDeltaP, ITG_EXPECT_COSDELTAP);
    1292         return 3;
    1293     }
    1294     if (ERROR_TOL < fabs(ITG_EXPECT_ALPHAP - myST->alphaP)) {
    1295         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
    1296                 myST->alphaP, ITG_EXPECT_ALPHAP);
    1297         return 4;
    1298     }
    1299     if (ERROR_TOL < fabs(ITG_EXPECT_PHIP - myST->phiP)) {
    1300         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
    1301                 myST->phiP, ITG_EXPECT_PHIP);
    1302         return 5;
    1303     }
    1304     // Free data structure created
    1305     psFree(myST);
    1306 
    1307     return 0;
    1308 }
    1309 
    1310 #define GTI_EXPECT_PHIP        4.93683
    1311 #define GTI_EXPECT_SINDELTAP  -0.88999
    1312 #define GTI_EXPECT_COSDELTAP   0.45598
    1313 #define GTI_EXPECT_ALPHAP      0.57477
    1314 
    1315 psS32 testSphereRotGalacticToICRS( void )
    1316 {
    1317     // Invoke function
    1318     psSphereRot *myST = psSphereRotGalacticToICRS();
    1319 
    1320     // Verify did not return NULL
    1321     if(myST == NULL) {
    1322         psError(PS_ERR_UNKNOWN,true,"psSphereRotGalacticToICRS returned NULL");
    1323         return 1;
    1324     }
    1325     // Verify returned structure has members set properly
    1326     if (ERROR_TOL < fabs(GTI_EXPECT_SINDELTAP - myST->sinDeltaP)) {
    1327         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
    1328                 myST->sinDeltaP, GTI_EXPECT_SINDELTAP);
    1329         return 2;
    1330     }
    1331     if (ERROR_TOL < fabs(GTI_EXPECT_COSDELTAP - myST->cosDeltaP)) {
    1332         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
    1333                 myST->cosDeltaP, GTI_EXPECT_COSDELTAP);
    1334         return 3;
    1335     }
    1336     if (ERROR_TOL < fabs(GTI_EXPECT_ALPHAP - myST->alphaP)) {
    1337         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
    1338                 myST->alphaP, GTI_EXPECT_ALPHAP);
    1339         return 4;
    1340     }
    1341     if (ERROR_TOL < fabs(GTI_EXPECT_PHIP - myST->phiP)) {
    1342         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
    1343                 myST->phiP, GTI_EXPECT_PHIP);
    1344         return 5;
    1345     }
    1346     // Free data structure created
    1347     psFree(myST);
    1348 
    1349     return 0;
    1350 }
    1351 
  • trunk/psLib/test/astro/verified/tst_psCoord.stderr

    r4547 r4601  
    1 /***************************** TESTPOINT ******************************************\
    2 *             TestFile: tst_psCoord.c                                              *
    3 *            TestPoint: psCoord{psSphereTransformAlloc()}                          *
    4 *             TestType: Positive                                                   *
    5 \**********************************************************************************/
    6 
    7 
    8 ---> TESTPOINT PASSED (psCoord{psSphereTransformAlloc()} | tst_psCoord.c)
    9 
    101/***************************** TESTPOINT ******************************************\
    112*             TestFile: tst_psCoord.c                                              *
     
    10091---> TESTPOINT PASSED (psCoord{psPlaneDistortApply()} | tst_psCoord.c)
    10192
    102 /***************************** TESTPOINT ******************************************\
    103 *             TestFile: tst_psCoord.c                                              *
    104 *            TestPoint: psCoord{psSphereTransformApply()}                          *
    105 *             TestType: Positive                                                   *
    106 \**********************************************************************************/
    107 
    108 <DATE><TIME>|<HOST>|I|testSphereTransformApply1
    109     Following should generate an error
    110 <DATE><TIME>|<HOST>|E|psSphereTransformApply (FILE:LINENO)
    111     Unallowable operation: transform is NULL.
    112 <DATE><TIME>|<HOST>|I|testSphereTransformApply1
    113     Following should generate an error
    114 <DATE><TIME>|<HOST>|E|psSphereTransformApply (FILE:LINENO)
    115     Unallowable operation: coord is NULL.
    116 
    117 ---> TESTPOINT PASSED (psCoord{psSphereTransformApply()} | tst_psCoord.c)
    118 
    119 /***************************** TESTPOINT ******************************************\
    120 *             TestFile: tst_psCoord.c                                              *
    121 *            TestPoint: psCoord{psSphereTransformApply()}                          *
    122 *             TestType: Positive                                                   *
    123 \**********************************************************************************/
    124 
    125 
    126 ---> TESTPOINT PASSED (psCoord{psSphereTransformApply()} | tst_psCoord.c)
    127 
    128 /***************************** TESTPOINT ******************************************\
    129 *             TestFile: tst_psCoord.c                                              *
    130 *            TestPoint: psCoord{psSphereTransformApply()}                          *
    131 *             TestType: Positive                                                   *
    132 \**********************************************************************************/
    133 
    134 
    135 ---> TESTPOINT PASSED (psCoord{psSphereTransformApply()} | tst_psCoord.c)
    136 
    137 /***************************** TESTPOINT ******************************************\
    138 *             TestFile: tst_psCoord.c                                              *
    139 *            TestPoint: psCoord{psSphereTransformApply()}                          *
    140 *             TestType: Positive                                                   *
    141 \**********************************************************************************/
    142 
    143 
    144 ---> TESTPOINT PASSED (psCoord{psSphereTransformApply()} | tst_psCoord.c)
    145 
    146 /***************************** TESTPOINT ******************************************\
    147 *             TestFile: tst_psCoord.c                                              *
    148 *            TestPoint: psCoord{psSphereTransformApply()}                          *
    149 *             TestType: Positive                                                   *
    150 \**********************************************************************************/
    151 
    152 
    153 ---> TESTPOINT PASSED (psCoord{psSphereTransformApply()} | tst_psCoord.c)
    154 
    155 /***************************** TESTPOINT ******************************************\
    156 *             TestFile: tst_psCoord.c                                              *
    157 *            TestPoint: psCoord{psSphereTransformICRSToEcliptic()}                 *
    158 *             TestType: Positive                                                   *
    159 \**********************************************************************************/
    160 
    161 <DATE><TIME>|<HOST>|I|testSphereTransformICRSToEcliptic
    162     Following should generate an error message
    163 <DATE><TIME>|<HOST>|E|psSphereTransformICRSToEcliptic (FILE:LINENO)
    164     Unallowable operation: time is NULL.
    165 <DATE><TIME>|<HOST>|I|testSphereTransformICRSToEcliptic
    166     Following should generate an error message
    167 <DATE><TIME>|<HOST>|E|psSphereTransformICRSToEcliptic (FILE:LINENO)
    168     Specified time is less than 1900.
    169 
    170 ---> TESTPOINT PASSED (psCoord{psSphereTransformICRSToEcliptic()} | tst_psCoord.c)
    171 
    172 /***************************** TESTPOINT ******************************************\
    173 *             TestFile: tst_psCoord.c                                              *
    174 *            TestPoint: psCoord{psSphereTransformEclipticToICRS()}                 *
    175 *             TestType: Positive                                                   *
    176 \**********************************************************************************/
    177 
    178 <DATE><TIME>|<HOST>|I|testSphereTransformEclipticToICRS
    179     Following should generate an error message
    180 <DATE><TIME>|<HOST>|E|psSphereTransformEclipticToICRS (FILE:LINENO)
    181     Unallowable operation: time is NULL.
    182 <DATE><TIME>|<HOST>|I|testSphereTransformEclipticToICRS
    183     Following should generate an error message
    184 <DATE><TIME>|<HOST>|E|psSphereTransformEclipticToICRS (FILE:LINENO)
    185     Specified time is less than 1900.
    186 
    187 ---> TESTPOINT PASSED (psCoord{psSphereTransformEclipticToICRS()} | tst_psCoord.c)
    188 
    189 /***************************** TESTPOINT ******************************************\
    190 *             TestFile: tst_psCoord.c                                              *
    191 *            TestPoint: psCoord{psSphereTransformICRSToGalactic()}                 *
    192 *             TestType: Positive                                                   *
    193 \**********************************************************************************/
    194 
    195 
    196 ---> TESTPOINT PASSED (psCoord{psSphereTransformICRSToGalactic()} | tst_psCoord.c)
    197 
    198 /***************************** TESTPOINT ******************************************\
    199 *             TestFile: tst_psCoord.c                                              *
    200 *            TestPoint: psCoord{psSphereTransformGalacticToICRS()}                 *
    201 *             TestType: Positive                                                   *
    202 \**********************************************************************************/
    203 
    204 
    205 ---> TESTPOINT PASSED (psCoord{psSphereTransformGalacticToICRS()} | tst_psCoord.c)
    206 
    207 /***************************** TESTPOINT ******************************************\
    208 *             TestFile: tst_psCoord.c                                              *
    209 *            TestPoint: psCoord{psSphereTransformPrecess()}                        *
    210 *             TestType: Positive                                                   *
    211 \**********************************************************************************/
    212 
    213 <DATE><TIME>|<HOST>|I|testSphereTransformPrecess
    214     Following should generate an error message
    215 <DATE><TIME>|<HOST>|E|psSpherePrecess (FILE:LINENO)
    216     Unallowable operation: toTime is NULL.
    217 <DATE><TIME>|<HOST>|I|testSphereTransformPrecess
    218     Following should generate an error message
    219 <DATE><TIME>|<HOST>|E|psSpherePrecess (FILE:LINENO)
    220     Unallowable operation: fromTime is NULL.
    221 <DATE><TIME>|<HOST>|I|testSphereTransformPrecess
    222     Following should generate an error message
    223 <DATE><TIME>|<HOST>|E|psSpherePrecess (FILE:LINENO)
    224     Unallowable operation: coords is NULL.
    225 
    226 ---> TESTPOINT PASSED (psCoord{psSphereTransformPrecess()} | tst_psCoord.c)
    227 
Note: See TracChangeset for help on using the changeset viewer.