IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4541


Ignore:
Timestamp:
Jul 12, 2005, 9:27:28 AM (21 years ago)
Author:
desonia
Message:

Massive code restructuring.

Location:
trunk/psLib
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/Makefile.am

    r3682 r4541  
    11SUBDIRS = $(SUBDIR)
    22
    3 bin_SCRIPTS = pslib-config
     3bin_SCRIPTS = pslib-config psParseErrorCodes
    44
    55pkgconfigdir = $(libdir)/pkgconfig
  • trunk/psLib/configure.ac

    r4209 r4541  
    1313
    1414SUBDIR="etc src test" dnl don't include 'swig', as it is optional
     15
     16SRCDIRS="sys astro db fft fits imageops math mathtypes types xml"
    1517
    1618AC_DISABLE_STATIC
     
    7072AC_FUNC_VPRINTF
    7173AC_CHECK_FUNCS([floor gethostname gettimeofday memmove memset mkdir pow regcomp sqrt strchr strcspn strerror strrchr strstr strtol strtoul strtoull])
     74
     75dnl Add the src directories to the include path
     76SRCPATH="`pwd`/src"
     77SRCINC=`echo "${SRCDIRS=}" | sed "s|\(\\w\+\)|-I\${SRCPATH=}/\1|g"`
     78SRCSUBLIBS=`echo "${SRCDIRS=}" | sed "s|\(\\w\+\)|\1/libpslib\1.la|g"`
     79AC_SUBST(SRCSUBLIBS,${SRCSUBLIBS=})
     80CFLAGS="${CFLAGS=} -I${SRCPATH=} ${SRCINC=}"
     81AC_SUBST(SRCINC,${SRCINC=})
     82
    7283
    7384dnl ----------------- MYSQL options --------------------
     
    238249
    239250AC_SUBST(SUBDIR,[$SUBDIR])
     251AC_SUBST(SRCDIRS,[$SRCDIRS])
    240252AC_SUBST(PSLIB_LIBS,[$PSLIB_LIBS])
    241253AC_SUBST(PSLIB_CFLAGS,[$PSLIB_CFLAGS])
     254
     255AC_SUBST(LANG,[en])
    242256
    243257AC_CONFIG_FILES([
    244258  Makefile
    245259  src/Makefile
    246   src/astronomy/Makefile
    247   src/collections/Makefile
    248   src/dataManip/Makefile
    249   src/dataIO/Makefile
    250   src/image/Makefile
    251   src/sysUtils/Makefile
     260  src/astro/Makefile
     261  src/db/Makefile
     262  src/fft/Makefile
     263  src/fits/Makefile
     264  src/imageops/Makefile
     265  src/math/Makefile
     266  src/mathtypes/Makefile
     267  src/sys/Makefile
     268  src/types/Makefile
     269  src/xml/Makefile
    252270  test/FullUnitTest
    253271  test/Makefile
  • trunk/psLib/src/sys/psErrorCodes.c

    r4540 r4541  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-12 19:12:01 $
     9 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-07-12 19:27:27 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/swig/Makefile.am

    r3937 r4541  
    66
    77SRCDIR = $(shell cd $(top_srcdir) && pwd)
    8 INCLUDES = -I$(SRCDIR)/src \
    9         -I$(SRCDIR)/src/astronomy \
    10         -I$(SRCDIR)/src/collections \
    11         -I$(SRCDIR)/src/dataManip \
    12         -I$(SRCDIR)/src/dataIO \
    13         -I$(SRCDIR)/src/image \
    14         -I$(SRCDIR)/src/sysUtils \
    15         -I/usr/include \
    16         -I/usr/local/include
    178
    189####################################################
     
    2718psLibModule/setup.txt:
    2819        if [ ! -d psLibModule ]; then mkdir psLibModule; fi
    29         echo "includes=$(INCLUDES)" > psLibModule/setup.txt
     20        echo "includes=$(SRCINC)" > psLibModule/setup.txt
    3021        echo "ldflags=-L$(top_builddir)/src $(PSLIB_LIBS)" >> psLibModule/setup.txt
    3122        echo "cflags=$(CFLAGS) -std=c99 -Wno-unused -Wno-strict-aliasing" >> psLibModule/setup.txt
     
    3324psLibModule/pslib_wrap.c: $(srcdir)/pslib.i
    3425        if [ ! -d psLibModule ]; then mkdir psLibModule; fi
    35         $(SWIG) -perl $(INCLUDES) -w451 -o $@ $(srcdir)/pslib.i
     26        $(SWIG) -perl $(SRCINC) -w451 -o $@ $(srcdir)/pslib.i
    3627
    3728psLibModule/Makefile:psLibModule/Makefile.PL psLibModule/setup.txt
  • trunk/psLib/swig/pslib.i

    r3684 r4541  
    22
    33%{
    4 #define PS_ALLOW_MALLOC 
     4#define PS_ALLOW_MALLOC
    55#define SWIG
    66#include "pslib.h"
    77
    88/* SWIG uses malloc/free - make it use the pslib memory functions instead. */
    9 /* 
     9/*
    1010#define malloc(S)    psAlloc(S)
    1111#define realloc(P,S) psRealloc(P,S)
     
    3636#if defined(SWIGPERL)
    3737   if (!SvOK($input)) {
    38       $1 = NULL;     
     38      $1 = NULL;
    3939   } else {
    4040      $1 = PerlIO_findFILE(IoIFP(sv_2io($input)));
     
    5858
    5959/* the actual including of headers are found in each of the directories. */
    60 %include "sysUtils.i"
    61 %include "image.i"
    62 %include "dataIO.i"
    63 %include "dataManip.i"
    64 %include "collections.i"
    65 %include "astronomy.i"
     60%include "astro.i"
     61%include "db.i"
     62%include "fft.i"
     63%include "fits.i"
     64%include "imageops.i"
     65%include "math.i"
     66%include "mathtypes.i"
     67%include "sys.i"
     68%include "types.i"
     69%include "xml.i"
  • trunk/psLib/test/astronomy/tst_psCoord.c

    r4422 r4541  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-06-29 00:43:46 $
     8*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-07-12 19:27:28 $
    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 testSphereTransformAlloc(void);
     16static psS32 testSphereRotAlloc(void);
    1717static psS32 testPlaneTransformAlloc(void);
    1818static psS32 testPlaneDistortAlloc(void);
    1919static psS32 testPlaneTransformApply(void);
    2020static psS32 testPlaneDistortApply(void);
    21 static psS32 testSphereTransformApply1(void);
    22 static psS32 testSphereTransformApply2(void);
    23 static psS32 testSphereTransformApply3(void);
    24 static psS32 testSphereTransformApply4(void);
    25 static psS32 testSphereTransformApply5(void);
    26 static psS32 testSphereTransformICRSToEcliptic(void);
    27 static psS32 testSphereTransformEclipticToICRS(void);
    28 static psS32 testSphereTransformICRSToGalactic(void);
    29 static psS32 testSphereTransformGalacticToICRS(void);
    30 static psS32 testSphereTransformPrecess(void);
     21static psS32 testSphereRotApply1(void);
     22static psS32 testSphereRotApply2(void);
     23static psS32 testSphereRotApply3(void);
     24static psS32 testSphereRotApply4(void);
     25static psS32 testSphereRotApply5(void);
     26static psS32 testSphereRotICRSToEcliptic(void);
     27static psS32 testSphereRotEclipticToICRS(void);
     28static psS32 testSphereRotICRSToGalactic(void);
     29static psS32 testSphereRotGalacticToICRS(void);
     30static psS32 testSphereRotPrecess(void);
    3131testDescription tests[] = {
    32                               {testSphereTransformAlloc, 819, "psSphereTransformAlloc()", 0, false},
     32                              {testSphereRotAlloc, 819, "psSphereRotAlloc()", 0, false},
    3333                              {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false},
    3434                              {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false},
    3535                              {testPlaneTransformApply, 831, "psPlaneTransformApply()", 0, false},
    3636                              {testPlaneDistortApply, 832, "psPlaneDistortApply()", 0, false},
    37                               {testSphereTransformApply1, 820, "psSphereTransformApply()", 0, false},
    38                               {testSphereTransformApply2, 820, "psSphereTransformApply()", 0, false},
    39                               {testSphereTransformApply3, 820, "psSphereTransformApply()", 0, false},
    40                               {testSphereTransformApply4, 820, "psSphereTransformApply()", 0, false},
    41                               {testSphereTransformApply5, 820, "psSphereTransformApply()", 0, false},
    42                               {testSphereTransformICRSToEcliptic, 821, "psSphereTransformICRSToEcliptic()", 0, false},
    43                               {testSphereTransformEclipticToICRS, 822, "psSphereTransformEclipticToICRS()", 0, false},
    44                               {testSphereTransformICRSToGalactic, 824, "psSphereTransformICRSToGalactic()", 0, false},
    45                               {testSphereTransformGalacticToICRS, 823, "psSphereTransformGalacticToICRS()", 0, false},
    46                               {testSphereTransformPrecess, 825, "psSphereTransformPrecess()", 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},
    4747                              {NULL}
    4848                          };
     
    6767#define PHI_P 3.0
    6868
    69 psS32 testSphereTransformAlloc( void )
     69psS32 testSphereRotAlloc( void )
    7070{
    7171    // Allocate data structure
    72     psSphereTransform *myST = psSphereTransformAlloc(ALPHA_P, DELTA_P, PHI_P);
     72    psSphereRot* myST = psSphereRotAlloc(ALPHA_P, DELTA_P, PHI_P);
     73
    7374    // Verify null not returned
    7475    if(myST == NULL) {
     
    7778    }
    7879    // Verify sin member is updated
    79     psF32 sinDeltaP = sin(DELTA_P);
    80     if (FLT_EPSILON < fabs(sinDeltaP - myST->sinDeltaP)) {
    81         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sinDeltaP);
     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);
    8290        return 2;
    8391    }
    84     // Verify cos member is update
    85     psF32 cosDeltaP = cos(DELTA_P);
    86     if (FLT_EPSILON < fabs(cosDeltaP - myST->cosDeltaP)) {
    87         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cosDeltaP);
     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);
    8894        return 3;
    8995    }
    90     // Verify alpha is updated
    91     if (FLT_EPSILON < fabs(ALPHA_P - myST->alphaP)) {
    92         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f\n", myST->alphaP, ALPHA_P);
     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);
    9398        return 4;
    9499    }
    95     // Verify phi is updated
    96     if (FLT_EPSILON < fabs(PHI_P - myST->phiP)) {
    97         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f\n", myST->phiP, PHI_P);
     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);
    98102        return 5;
    99103    }
     104
    100105    // Free data structure
    101106    psFree(myST);
     
    441446
    442447// We do a simple identity transformation on a few RA, DEC pairs.
    443 psS32 testSphereTransformApply1( void )
     448psS32 testSphereRotApply1( void )
    444449{
    445450    psSphere *in = psSphereAlloc();
     
    447452    psSphere *temp = NULL;
    448453    psSphere *rc = NULL;
    449     psSphereTransform *myST = psSphereTransformAlloc(0.0, 0.0, 0.0);
     454    psSphereRot *myST = psSphereRotAlloc(0.0, 0.0, 0.0);
    450455
    451456    for (float r=0.0;r<180.0;r+=DEG_INC) {
     
    456461            in->dErr = 0.0;
    457462
    458             if(psSphereTransformApply(out, myST, in) != out) {
     463            if(psSphereRotApply(out, myST, in) != out) {
    459464                psError(PS_ERR_UNKNOWN,true,"Did not return output pointer.");
    460465                return 1;
     
    472477
    473478    // Verify new sphere object is created if out parameter NULL
    474     temp = psSphereTransformApply(NULL, myST, in);
     479    temp = psSphereRotApply(NULL, myST, in);
    475480    if ( temp == NULL) {
    476481        psError(PS_ERR_UNKNOWN,true,"Returned NULL when out parameter was null");
     
    481486    // Verify NULL returned if transform structure null
    482487    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
    483     rc = psSphereTransformApply(NULL, NULL, in);
     488    rc = psSphereRotApply(NULL, NULL, in);
    484489    if (rc != NULL) {
    485         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL.");
     490        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply() did not return NULL.");
    486491        return 5;
    487492    }
     
    489494    // Verify NULL returned when input sphere is NULL
    490495    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
    491     rc = psSphereTransformApply(NULL, myST, NULL);
     496    rc = psSphereRotApply(NULL, myST, NULL);
    492497    if (rc != NULL) {
    493         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL");
     498        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply() did not return NULL");
    494499        return 6;
    495500    }
     
    503508
    504509/******************************************************************************
    505 testSphereTransformApply2(): This test verifies that psSphereTransformApply()
    506 works properly.  We create two psSphereTransforms: a forward transform and a
     510testSphereRotApply2(): This test verifies that psSphereRotApply()
     511works properly.  We create two psSphereRots: a forward transform and a
    507512reverse transform (which is the mathematical inverse of the forward transform).
    508513We apply both transforms to several spherical coordinates and ensure that the
     
    512517test them both concurrently failed.  Determine why this is.  Are the following
    513518spherical transforms not mathematical inverses?
    514     psSphereTransformAlloc(X, Y, 0.0)
    515     psSphereTransformAlloc(-X, -Y, 0.0)
     519    psSphereRotAlloc(X, Y, 0.0)
     520    psSphereRotAlloc(-X, -Y, 0.0)
    516521 *****************************************************************************/
    517522#define ERROR_PERCENT 0.01
    518 psS32 testSphereTransformApply2( void )
     523psS32 testSphereRotApply2( void )
    519524{
    520525    psS32 testStatus = 0;
     
    522527    psSphere out;
    523528    psSphere out2;
    524     psSphereTransform *mySphereTransformForward = NULL;
    525     psSphereTransform *mySphereTransformReverse = NULL;
    526 
    527 
    528     mySphereTransformForward = psSphereTransformAlloc(DEG_TO_RAD(22.0),
    529                                0.0,
    530                                0.0);
    531     mySphereTransformReverse = psSphereTransformAlloc(DEG_TO_RAD(-22.0),
    532                                0.0,
    533                                0.0);
     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);
    534539
    535540    for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
     
    540545            in.dErr = 0.0;
    541546
    542             psSphereTransformApply(&out, mySphereTransformForward, &in);
    543             psSphereTransformApply(&out2, mySphereTransformReverse, &out);
     547            psSphereRotApply(&out, mySphereRotForward, &in);
     548            psSphereRotApply(&out2, mySphereRotReverse, &out);
    544549
    545550            if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
     
    552557        }
    553558    }
    554     psFree(mySphereTransformForward);
    555     psFree(mySphereTransformReverse);
    556 
    557     mySphereTransformForward = psSphereTransformAlloc(0.0,
    558                                DEG_TO_RAD(33.0),
    559                                0.0);
    560     mySphereTransformReverse = psSphereTransformAlloc(0.0,
    561                                DEG_TO_RAD(-33.0),
    562                                0.0);
     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);
    563568    for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
    564569        for (float d=0.1;d<90.0;d+=(DEG_INC/5.0)) {
     
    568573            in.dErr = 0.0;
    569574
    570             psSphereTransformApply(&out, mySphereTransformForward, &in);
    571             psSphereTransformApply(&out2, mySphereTransformReverse, &out);
     575            psSphereRotApply(&out, mySphereRotForward, &in);
     576            psSphereRotApply(&out2, mySphereRotReverse, &out);
    572577
    573578            if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
     
    580585        }
    581586    }
    582     psFree(mySphereTransformForward);
    583     psFree(mySphereTransformReverse);
     587    psFree(mySphereRotForward);
     588    psFree(mySphereRotReverse);
    584589
    585590    return(testStatus);
     
    613618#define SPHERE_COORD_TP3_INVERSE_D       0.523599       // 30.0       degrees
    614619
    615 psS32 testSphereTransformApply3( void)
    616 {
    617 
    618     psSphereTransform*  testTransform;
     620psS32 testSphereRotApply3( void)
     621{
     622
     623    psSphereRot*  testTransform;
    619624    psSphere*           inputCoord = psSphereAlloc();
    620625    psSphere*           outputCoord = NULL;
     
    630635
    631636    // Create transform ICRS to Galactic
    632     testTransform = psSphereTransformICRSToGalactic();
     637    testTransform = psSphereRotICRSToGalactic();
    633638
    634639    // Perform transform from ICRS to Galactic
    635     outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
     640    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    636641    // Verify output not NULL and member values set correctly
    637642    if(outputCoord == NULL) {
    638         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     643        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    639644        return 1;
    640645    }
    641646    if(fabs(outputCoord->r - SPHERE_COORD_TP1_GAL_R) > ERROR_TOL) {
    642         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     647        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    643648                outputCoord->r, SPHERE_COORD_TP1_GAL_R);
    644649        return 2;
    645650    }
    646651    if(fabs(outputCoord->d - SPHERE_COORD_TP1_GAL_D) > ERROR_TOL) {
    647         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     652        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    648653                outputCoord->d, SPHERE_COORD_TP1_GAL_D);
    649654        return 3;
     
    652657
    653658    // Create inverse transform Galactic to ICRS
    654     testTransform = psSphereTransformGalacticToICRS();
     659    testTransform = psSphereRotGalacticToICRS();
    655660
    656661    // Perform transform from Galactic to ICRS
    657     inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
     662    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    658663    // Verify output not NULL and member values set correctly
    659664    if(inverseOutputCoord == NULL) {
    660         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     665        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    661666        return 4;
    662667    }
    663668
    664669    if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP1_INVERSE_R) > ERROR_TOL) {
    665         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     670        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    666671                inverseOutputCoord->r, SPHERE_COORD_TP1_INVERSE_R);
    667672        return 5;
    668673    }
    669674    if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP1_INVERSE_D) > ERROR_TOL) {
    670         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     675        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    671676                inverseOutputCoord->d, SPHERE_COORD_TP1_INVERSE_D);
    672677        return 6;
     
    675680
    676681    // Create transform ICRS to Ecliptic
    677     testTransform = psSphereTransformICRSToEcliptic(testDateTime);
     682    testTransform = psSphereRotICRSToEcliptic(testDateTime);
    678683
    679684    // Perform transform from ICRS to Ecliptic
    680     outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
     685    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    681686    // Verify output not NULL and member values set correctly
    682687    if(outputCoord == NULL) {
    683         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     688        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    684689        return 7;
    685690    }
    686691    if(fabs(outputCoord->r - SPHERE_COORD_TP1_ECL_R) > ERROR_TOL) {
    687         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     692        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    688693                outputCoord->r, SPHERE_COORD_TP1_ECL_R);
    689694        return 8;
    690695    }
    691696    if(fabs(outputCoord->d - SPHERE_COORD_TP1_ECL_D) > ERROR_TOL) {
    692         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     697        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    693698                outputCoord->d, SPHERE_COORD_TP1_ECL_D);
    694699        return 9;
     
    697702
    698703    // Create inverse transform Ecliptic to ICRS
    699     testTransform = psSphereTransformEclipticToICRS(testDateTime);
     704    testTransform = psSphereRotEclipticToICRS(testDateTime);
    700705
    701706    // Perform transform from Ecliptic to ICRS
    702     inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
     707    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    703708    // Verify output not NULL and member values set correctly
    704709    if(inverseOutputCoord == NULL) {
    705         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     710        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    706711        return 10;
    707712    }
    708713    if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP1_INVERSE_R) > ERROR_TOL) {
    709         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     714        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    710715                inverseOutputCoord->r, SPHERE_COORD_TP1_INVERSE_R);
    711716        return 11;
    712717    }
    713718    if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP1_INVERSE_D) > ERROR_TOL) {
    714         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     719        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    715720                inverseOutputCoord->d, SPHERE_COORD_TP1_INVERSE_D);
    716721        return 12;
     
    726731}
    727732
    728 psS32 testSphereTransformApply4( void)
    729 {
    730 
    731     psSphereTransform*  testTransform;
     733psS32 testSphereRotApply4( void)
     734{
     735
     736    psSphereRot*  testTransform;
    732737    psSphere*           inputCoord = psSphereAlloc();
    733738    psSphere*           outputCoord = NULL;
     
    743748
    744749    // Create transform ICRS to Galactic
    745     testTransform = psSphereTransformICRSToGalactic();
     750    testTransform = psSphereRotICRSToGalactic();
    746751
    747752    // Perform transform from ICRS to Galactic
    748     outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
     753    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    749754    // Verify output not NULL and member values set correctly
    750755    if(outputCoord == NULL) {
    751         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     756        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    752757        return 1;
    753758    }
    754759    if(fabs(outputCoord->r - SPHERE_COORD_TP2_GAL_R) > ERROR_TOL) {
    755         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     760        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    756761                outputCoord->r, SPHERE_COORD_TP2_GAL_R);
    757762        return 2;
    758763    }
    759764    if(fabs(outputCoord->d - SPHERE_COORD_TP2_GAL_D) > ERROR_TOL) {
    760         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     765        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    761766                outputCoord->d, SPHERE_COORD_TP2_GAL_D);
    762767        return 3;
     
    765770
    766771    // Create inverse transform Galactic to ICRS
    767     testTransform = psSphereTransformGalacticToICRS();
     772    testTransform = psSphereRotGalacticToICRS();
    768773
    769774    // Perform transform from Galactic to ICRS
    770     inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
     775    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    771776    // Verify output not NULL and member values set correctly
    772777    if(inverseOutputCoord == NULL) {
    773         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     778        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    774779        return 4;
    775780    }
    776781    // atan2 function introduces some error with y close to zero, increased error tolerance
    777782    if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP2_INVERSE_R) > ERROR_TOL+0.1) {
    778         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     783        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    779784                inverseOutputCoord->r, SPHERE_COORD_TP2_INVERSE_R);
    780785        return 5;
    781786    }
    782787    if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP2_INVERSE_D) > ERROR_TOL) {
    783         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     788        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    784789                inverseOutputCoord->d, SPHERE_COORD_TP2_INVERSE_D);
    785790        return 6;
     
    788793
    789794    // Create transform ICRS to Ecliptic
    790     testTransform = psSphereTransformICRSToEcliptic(testDateTime);
     795    testTransform = psSphereRotICRSToEcliptic(testDateTime);
    791796
    792797    // Perform transform from ICRS to Ecliptic
    793     outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
     798    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    794799    // Verify output not NULL and member values set correctly
    795800    if(outputCoord == NULL) {
    796         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     801        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    797802        return 7;
    798803    }
    799804    if(fabs(outputCoord->r - SPHERE_COORD_TP2_ECL_R) > ERROR_TOL) {
    800         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     805        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    801806                outputCoord->r, SPHERE_COORD_TP2_ECL_R);
    802807        return 8;
    803808    }
    804809    if(fabs(outputCoord->d - SPHERE_COORD_TP2_ECL_D) > ERROR_TOL) {
    805         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     810        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    806811                outputCoord->d, SPHERE_COORD_TP2_ECL_D);
    807812        return 9;
     
    810815
    811816    // Create inverse transform Ecliptic to ICRS
    812     testTransform = psSphereTransformEclipticToICRS(testDateTime);
     817    testTransform = psSphereRotEclipticToICRS(testDateTime);
    813818
    814819    // Perform transform from Ecliptic to ICRS
    815     inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
     820    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    816821    // Verify output not NULL and member values set correctly
    817822    if(inverseOutputCoord == NULL) {
    818         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     823        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    819824        return 10;
    820825    }
    821826    if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP2_INVERSE_R) > ERROR_TOL) {
    822         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     827        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    823828                inverseOutputCoord->r, SPHERE_COORD_TP2_INVERSE_R);
    824829        return 11;
    825830    }
    826831    if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP2_INVERSE_D) > ERROR_TOL) {
    827         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     832        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    828833                inverseOutputCoord->d, SPHERE_COORD_TP2_INVERSE_D);
    829834        return 12;
     
    839844}
    840845
    841 psS32 testSphereTransformApply5( void)
    842 {
    843     psSphereTransform*  testTransform;
     846psS32 testSphereRotApply5( void)
     847{
     848    psSphereRot*  testTransform;
    844849    psSphere*           inputCoord = psSphereAlloc();
    845850    psSphere*           outputCoord = NULL;
     
    855860
    856861    // Create transform ICRS to Galactic
    857     testTransform = psSphereTransformICRSToGalactic();
     862    testTransform = psSphereRotICRSToGalactic();
    858863
    859864    // Perform transform from ICRS to Galactic
    860     outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
     865    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    861866    // Verify output not NULL and member values set correctly
    862867    if(outputCoord == NULL) {
    863         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     868        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    864869        return 1;
    865870    }
    866871    if(fabs(outputCoord->r - SPHERE_COORD_TP3_GAL_R) > ERROR_TOL) {
    867         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     872        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    868873                outputCoord->r, SPHERE_COORD_TP3_GAL_R);
    869874        return 2;
    870875    }
    871876    if(fabs(outputCoord->d - SPHERE_COORD_TP3_GAL_D) > ERROR_TOL) {
    872         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     877        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    873878                outputCoord->d, SPHERE_COORD_TP3_GAL_D);
    874879        return 3;
     
    877882
    878883    // Create inverse transform Galactic to ICRS
    879     testTransform = psSphereTransformGalacticToICRS();
     884    testTransform = psSphereRotGalacticToICRS();
    880885
    881886    // Perform transform from Galactic to ICRS
    882     inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
     887    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    883888    // Verify output not NULL and member values set correctly
    884889    if(inverseOutputCoord == NULL) {
    885         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     890        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    886891        return 4;
    887892    }
    888893    if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP3_INVERSE_R) > ERROR_TOL+0.1) {
    889         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     894        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    890895                inverseOutputCoord->r, SPHERE_COORD_TP3_INVERSE_R);
    891896        return 5;
    892897    }
    893898    if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP3_INVERSE_D) > ERROR_TOL) {
    894         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     899        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    895900                inverseOutputCoord->d, SPHERE_COORD_TP3_INVERSE_D);
    896901        return 6;
     
    899904
    900905    // Create transform ICRS to Ecliptic
    901     testTransform = psSphereTransformICRSToEcliptic(testDateTime);
     906    testTransform = psSphereRotICRSToEcliptic(testDateTime);
    902907
    903908    // Perform transform from ICRS to Ecliptic
    904     outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
     909    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
    905910    // Verify output not NULL and member values set correctly
    906911    if(outputCoord == NULL) {
    907         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     912        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    908913        return 7;
    909914    }
    910915    if(fabs(outputCoord->r - SPHERE_COORD_TP3_ECL_R) > ERROR_TOL) {
    911         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     916        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    912917                outputCoord->r, SPHERE_COORD_TP3_ECL_R);
    913918        return 8;
    914919    }
    915920    if(fabs(outputCoord->d - SPHERE_COORD_TP3_ECL_D) > ERROR_TOL) {
    916         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     921        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    917922                outputCoord->d, SPHERE_COORD_TP3_ECL_D);
    918923        return 9;
     
    921926
    922927    // Create inverse transform Ecliptic to ICRS
    923     testTransform = psSphereTransformEclipticToICRS(testDateTime);
     928    testTransform = psSphereRotEclipticToICRS(testDateTime);
    924929
    925930    // Perform transform from Ecliptic to ICRS
    926     inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
     931    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
    927932    // Verify output not NULL and member values set correctly
    928933    if(inverseOutputCoord == NULL) {
    929         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
     934        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
    930935        return 10;
    931936    }
    932937    if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP3_INVERSE_R) > ERROR_TOL) {
    933         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
     938        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
    934939                inverseOutputCoord->r, SPHERE_COORD_TP3_INVERSE_R);
    935940        return 11;
    936941    }
    937942    if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP3_INVERSE_D) > ERROR_TOL) {
    938         psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
     943        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
    939944                inverseOutputCoord->d, SPHERE_COORD_TP3_INVERSE_D);
    940945        return 12;
     
    963968#define SPHERE_PRECESS_TP3_EXPECT_D     0.543024          //   31.113     degrees
    964969
    965 psS32 testSphereTransformPrecess( void )
     970psS32 testSphereRotPrecess( void )
    966971{
    967972    psSphere*     inputCoord  = psSphereAlloc();
     
    10801085}
    10811086
    1082 // Thes values calculated from ADD-09 equations
    1083 #define EXPECT_COS_DELTAP_2000    0.917482
    1084 #define EXPECT_SIN_DELTAP_2000    0.397777
    1085 #define EXPECT_COS_DELTAP_2100    0.917572
    1086 #define EXPECT_SIN_DELTAP_2100    0.397567
    1087 
    1088 psS32 testSphereTransformICRSToEcliptic( void )
     1087psS32 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
     1177psS32 testSphereRotEclipticToICRS( void )
    10891178{
    10901179    psF64  expectedPhiP = 0.0;
    10911180    psF64  expectedAlphaP = 0.0;
    1092     psF64  expectedCosDeltaP = EXPECT_COS_DELTAP_2000;
    1093     psF64  expectedSinDeltaP = EXPECT_SIN_DELTAP_2000;
     1181    psF64  expectedCosDeltaP = 0.0;
     1182    psF64  expectedSinDeltaP = 0.0;
    10941183
    10951184    // Set test date time to 1/1/2000 00:00:00
    10961185    psTime* testDateTime = psTimeFromMJD(MJD_2000);
    10971186
    1098     // Invoke function to set psSphereTransforma objec
    1099     psSphereTransform *myST = psSphereTransformICRSToEcliptic(testDateTime);
     1187    // Invoke function to set psSphereRota object
     1188    psSphereRot *myST = psSphereRotEclipticToICRS(testDateTime);
    11001189
    11011190    // Verify expected values for the specified time
     
    11241213
    11251214    expectedCosDeltaP = EXPECT_COS_DELTAP_2100;
    1126     expectedSinDeltaP = EXPECT_SIN_DELTAP_2100;
     1215    expectedSinDeltaP = -EXPECT_SIN_DELTAP_2100;
    11271216
    11281217    // Set test date time to 1/1/2100 00:00:00
    11291218    testDateTime = psTimeFromMJD(MJD_2100);
    11301219
    1131     // Invoke function to set psSphereTransforma objec
    1132     myST = psSphereTransformICRSToEcliptic(testDateTime);
     1220    // Invoke function to set psSphereRota objec
     1221    myST = psSphereRotEclipticToICRS(testDateTime);
    11331222
    11341223    // Verify expected values for the specified time
     
    11581247    // Verify if argument psTime is NULL, function returns NULL and error message generated
    11591248    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1160     myST = psSphereTransformICRSToEcliptic(NULL);
     1249    myST = psSphereRotEclipticToICRS(NULL);
    11611250    if (myST != NULL) {
    1162         psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL.");
     1251        psError(PS_ERR_UNKNOWN,true,"psSphereRotEclipticICRS() did not return NULL.");
    11631252        return 9;
    11641253    }
     
    11671256    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    11681257    testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
    1169     myST = psSphereTransformICRSToEcliptic(testDateTime);
     1258    myST = psSphereRotEclipticToICRS(testDateTime);
    11701259    if (myST != NULL) {
    1171         psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL.");
    1172         return 10;
    1173     }
    1174     psFree(testDateTime);
    1175 
    1176     return 0;
    1177 }
    1178 
    1179 
    1180 psS32 testSphereTransformEclipticToICRS( void )
    1181 {
    1182     psF64  expectedPhiP = 0.0;
    1183     psF64  expectedAlphaP = 0.0;
    1184     psF64  expectedCosDeltaP = EXPECT_COS_DELTAP_2000;
    1185     psF64  expectedSinDeltaP = -EXPECT_SIN_DELTAP_2000;
    1186 
    1187     // Set test date time to 1/1/2000 00:00:00
    1188     psTime* testDateTime = psTimeFromMJD(MJD_2000);
    1189 
    1190     // Invoke function to set psSphereTransforma object
    1191     psSphereTransform *myST = psSphereTransformEclipticToICRS(testDateTime);
    1192 
    1193     // Verify expected values for the specified time
    1194     if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
    1195         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
    1196                 myST->sinDeltaP, expectedSinDeltaP);
    1197         return 1;
    1198     }
    1199     if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
    1200         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
    1201                 myST->cosDeltaP, expectedCosDeltaP);
    1202         return 2;
    1203     }
    1204     if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
    1205         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
    1206                 myST->alphaP, expectedAlphaP);
    1207         return 3;
    1208     }
    1209     if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
    1210         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
    1211                 myST->phiP, expectedPhiP);
    1212         return 4;
    1213     }
    1214     psFree(myST);
    1215     psFree(testDateTime);
    1216 
    1217     expectedCosDeltaP = EXPECT_COS_DELTAP_2100;
    1218     expectedSinDeltaP = -EXPECT_SIN_DELTAP_2100;
    1219 
    1220     // Set test date time to 1/1/2100 00:00:00
    1221     testDateTime = psTimeFromMJD(MJD_2100);
    1222 
    1223     // Invoke function to set psSphereTransforma objec
    1224     myST = psSphereTransformEclipticToICRS(testDateTime);
    1225 
    1226     // Verify expected values for the specified time
    1227     if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
    1228         psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
    1229                 myST->sinDeltaP, expectedSinDeltaP);
    1230         return 5;
    1231     }
    1232     if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
    1233         psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
    1234                 myST->cosDeltaP, expectedCosDeltaP);
    1235         return 6;
    1236     }
    1237     if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
    1238         psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
    1239                 myST->alphaP, expectedAlphaP);
    1240         return 7;
    1241     }
    1242     if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
    1243         psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
    1244                 myST->phiP, expectedPhiP);
    1245         return 8;
    1246     }
    1247     psFree(myST);
    1248     psFree(testDateTime);
    1249 
    1250     // Verify if argument psTime is NULL, function returns NULL and error message generated
    1251     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1252     myST = psSphereTransformEclipticToICRS(NULL);
    1253     if (myST != NULL) {
    1254         psError(PS_ERR_UNKNOWN,true,"psSphereTransformEclipticICRS() did not return NULL.");
    1255         return 9;
    1256     }
    1257 
    1258     // Verify if argument psTime is less than 1900, function return NULL and error msg generated
    1259     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
    1260     testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
    1261     myST = psSphereTransformEclipticToICRS(testDateTime);
    1262     if (myST != NULL) {
    1263         psError(PS_ERR_UNKNOWN,true,"psSphereTransformEclipticToICRS() did not return NULL.");
     1260        psError(PS_ERR_UNKNOWN,true,"psSphereRotEclipticToICRS() did not return NULL.");
    12641261        return 10;
    12651262    }
     
    12741271#define ITG_EXPECT_PHIP        0.57477
    12751272
    1276 psS32 testSphereTransformICRSToGalactic( void )
     1273psS32 testSphereRotICRSToGalactic( void )
    12771274{
    12781275    // Invoke function
    1279     psSphereTransform *myST = psSphereTransformICRSToGalactic();
     1276    psSphereRot *myST = psSphereRotICRSToGalactic();
    12801277
    12811278    // Verify did not return NULL
    12821279    if(myST == NULL) {
    1283         psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToGalactic returned NULL");
     1280        psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToGalactic returned NULL");
    12841281        return 1;
    12851282    }
     
    13161313#define GTI_EXPECT_ALPHAP      0.57477
    13171314
    1318 psS32 testSphereTransformGalacticToICRS( void )
     1315psS32 testSphereRotGalacticToICRS( void )
    13191316{
    13201317    // Invoke function
    1321     psSphereTransform *myST = psSphereTransformGalacticToICRS();
     1318    psSphereRot *myST = psSphereRotGalacticToICRS();
    13221319
    13231320    // Verify did not return NULL
    13241321    if(myST == NULL) {
    1325         psError(PS_ERR_UNKNOWN,true,"psSphereTransformGalacticToICRS returned NULL");
     1322        psError(PS_ERR_UNKNOWN,true,"psSphereRotGalacticToICRS returned NULL");
    13261323        return 1;
    13271324    }
  • trunk/psLib/test/image/tst_psImageGeomManip.c

    r4308 r4541  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-06-17 23:44:22 $
     8 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-07-12 19:27:28 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10851085
    10861086    psImage* in = psImageAlloc(cols,rows,PS_TYPE_F32);
     1087    psImage* mask = psImageAlloc(cols,rows,PS_TYPE_MASK);
    10871088    for (psS32 row=0;row<rows;row++) {
    10881089        psF32* inRow = in->data.F32[row];
     1090        psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row];
    10891091        for (psS32 col=0;col<cols;col++) {
    10901092            inRow[col] = (psF32)row+(psF32)col/1000.0f;
    1091         }
    1092     }
     1093            maskRow[col] = 0;
     1094        }
     1095    }
     1096
     1097
     1098    // ********** check psImageTransform with minimum specified inputs.
    10931099
    10941100    psImage* out = psImageTransform(NULL,
     
    11381144    }
    11391145
     1146    // zero out buffer
     1147    memset(out->rawDataBuffer, 0, sizeof(psF32)*out->numRows*out->numCols);
     1148
     1149    psPixels* blanks = psPixelsAlloc(10);
     1150    psPixels* mask = psPixelsAlloc(10);
     1151
     1152    // perform the same transform, but this time, supply a psImage to recycle and a mask
     1153    out = psImageTransform(out,
     1154                           blanks,
     1155                           in,
     1156                           mask,
     1157                           1,
     1158                           trans,
     1159                           psRegionSet(0,0,0,0),
     1160                           NULL,
     1161                           PS_INTERPOLATE_FLAT,
     1162                           -1);
     1163
     1164    if (out == NULL) {
     1165        psError(PS_ERR_UNKNOWN, false,
     1166                "out == NULL");
     1167        return 1;
     1168    }
     1169    if (out->type.type != PS_TYPE_F32) {
     1170        psError(PS_ERR_UNKNOWN, false,
     1171                "out->type.type != PS_TYPE_F32, out->type.type == %d",
     1172                out->type.type);
     1173        return 2;
     1174    }
     1175    if (out->numRows != rows*2 || out->numCols != cols*2) {
     1176        psError(PS_ERR_UNKNOWN, false,
     1177                "out size is %dx%d, not %dx%d",
     1178                out->numCols, out->numRows, cols*2, rows);
     1179        return 3;
     1180    }
     1181
     1182    for (psS32 row=0;row<out->numRows;row++) {
     1183        psF32* outRow = out->data.F32[row];
     1184        for (psS32 col=0;col<cols;col++) {
     1185            float inValue = p_psImagePixelInterpolateFLAT_F32(in,
     1186                            col*trans->x->coeff[1][0]+trans->x->coeff[0][0],
     1187                            row*trans->y->coeff[0][1]+trans->y->coeff[0][0],
     1188                            NULL, 0,
     1189                            -1);
     1190            if (fabsf(outRow[col] - inValue) > FLT_EPSILON*10) {
     1191                psError(PS_ERR_UNKNOWN, false,
     1192                        "out at %d,%d was %g, expected %g",
     1193                        col,row,outRow[col], inValue);
     1194                return 4;
     1195            }
     1196        }
     1197    }
     1198
     1199
    11401200    psFree(out);
    11411201    psFree(in);
Note: See TracChangeset for help on using the changeset viewer.