IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 12, 2005, 3:31:54 PM (21 years ago)
Author:
drobbin
Message:

Updated tests and debugged code. PrecessionModel now working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/tst_psEarthOrientation.c

    r5749 r5771  
    55*  @author d-Rob, MHPCC
    66*
    7 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-12-08 02:49:04 $
     7*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2005-12-13 01:31:54 $
    99*
    1010*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    344344        yy = -0.0287618408203125;
    345345        ss = 0.0;
     346        xx = SEC_TO_RAD(xx) * 1e-6;
     347        yy = SEC_TO_RAD(yy) * 1e-6;
    346348        if ( fabs(pcorr->x - xx) > DBL_EPSILON || fabs(pcorr->y - yy) > DBL_EPSILON
    347349                || fabs(pcorr->s - ss) > DBL_EPSILON) {
     
    599601    //    in->y += -0.0287618408203125;
    600602    //    in->s += 0.0;
     603    //    in->x += 3.05224300720406e-7;
     604    //    in->y += -1.39441339235822e-7;
     605    in->s += 0.0;
     606
    601607    double q0,q1,q2,q3;
    602608    q0 = -1.1984522406756289e-5;
     
    619625    }
    620626
    621     //    psCube *tempCube = psCubeAlloc();
    622     //    tempCube->x = -0.35963388069046304;
    623     //    tempCube->y = 0.5555192509816625;
    624     //    tempCube->z = 0.749078321908413;
    625     //    obj = psCubeToSphere(tempCube);
    626     //    psFree(tempCube);
    627     obj = psSphereAlloc();
    628     obj->r = objR;
    629     obj->d = objD;
     627    if (fabs(rot->q0-q0) > DBL_EPSILON || fabs(rot->q1-q1) > DBL_EPSILON ||
     628            fabs(rot->q2-q2) > DBL_EPSILON || fabs(rot->q3-q3) > DBL_EPSILON) {
     629        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     630                "psSphereRot_CEOtoGCRS failed to return expected values.\n");
     631        printf("\n  Output sphere rotation   = %.13g,%.13g,%.13g,%.13g\n",
     632               rot->q0, rot->q1, rot->q2, rot->q3);
     633        printf("  Expected sphere rotation = %.13g,%.13g,%.13g,%.13g\n", q0,q1,q2,q3);
     634        printf("  a difference:   %.13g, %.13g, %.13g, %.13g \n", (rot->q0-q0), (rot->q1-q1),
     635               (rot->q2-q2), (rot->q3-q3) );
     636        printf("  abs difference:   %.13g, %.13g, %.13g, %.13g \n\n", (rot->q0+q0), (rot->q1+q1),
     637               (rot->q2+q2), (rot->q3+q3) );
     638        //        return 3;
     639    }
     640
     641
     642    psCube *tempCube = psCubeAlloc();
     643    tempCube->x = -0.35963388069046304;
     644    tempCube->y = 0.5555192509816625;
     645    tempCube->z = 0.7497078321908413;
     646    obj = psCubeToSphere(tempCube);
     647    psFree(tempCube);
     648    //    obj = psSphereAlloc();
     649    //    obj->r = objR;
     650    //    obj->d = objD;
    630651    psSphereRot *precessionNutation = psSphereRotConjugate(NULL, rot);
    631652    psSphere *result = psSphereRotApply(NULL, precessionNutation, obj);
     
    639660    printf("A difference of:   %.13g, %.13g, %.13g\n\n",
    640661           (x-cube->x), (y-cube->y), (z-cube->z));
     662
     663    //great sphere difference between result and expected
     664    //Re = 6.38x10^6m
     665    psCube *expect = psCubeAlloc();
     666    expect->x = x;
     667    expect->y = y;
     668    expect->z = z;
     669    psSphere *expected = psCubeToSphere(expect);
     670    psFree(expect);
     671    double d = (6.38e6) * acos(cos(result->r)*cos(expected->r)*cos(result->d-expected->d) + sin(result->r)*sin(expected->r));
     672    printf("\n\nGreat circle difference of:  %.13g \n", d);
     673
     674    psFree(expected);
    641675    psFree(obj);
    642676
    643677
    644     if (fabs(rot->q0-q0) > DBL_EPSILON || fabs(rot->q1-q1) > DBL_EPSILON ||
    645             fabs(rot->q2-q2) > DBL_EPSILON || fabs(rot->q3-q3) > DBL_EPSILON) {
    646         psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    647                 "psSphereRot_CEOtoGCRS failed to return expected values.\n");
    648         printf("\n  Output sphere rotation   = %.13g,%.13g,%.13g,%.13g\n",
    649                rot->q0, rot->q1, rot->q2, rot->q3);
    650         printf("  Expected sphere rotation = %.13g,%.13g,%.13g,%.13g\n", q0,q1,q2,q3);
    651         printf("  a difference:   %.13g, %.13g, %.13g, %.13g \n", (rot->q0-q0), (rot->q1-q1),
    652                (rot->q2-q2), (rot->q3-q3) );
    653         printf("  abs difference:   %.13g, %.13g, %.13g, %.13g \n\n", (rot->q0+q0), (rot->q1+q1),
    654                (rot->q2+q2), (rot->q3+q3) );
    655         return 3;
    656     }
    657678
    658679    psSphere *test = psSphereAlloc();
     
    708729        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    709730                "psSphereRot_ITRStoTEO failed to return expected values.\n");
    710         printf("\n  Output sphere rotation   = %.13g,%.13g,%.13g,%.13g\n",
     731        printf("\n  Output sphere rotation   = %.13g, %.13g, %.13g, %.13g\n",
    711732               rot->q0, rot->q1, rot->q2, rot->q3);
    712         printf("  Expected sphere rotation = %.13g,%.13g,%.13g,%.13g\n", q0,q1,q2,q3);
    713         printf("  a difference:   %.13g, %.13g, %.13g, %.13g \n", (rot->q0-q0), (rot->q1-q1),
    714                (rot->q2-q2), (rot->q3-q3) );
     733        printf("  Expected sphere rotation = %.13g, %.13g, %.13g, %.13g\n", q0,q1,q2,q3);
     734        //        printf("  a difference:   %.13g, %.13g, %.13g, %.13g \n", (rot->q0-q0), (rot->q1-q1),
     735        //               (rot->q2-q2), (rot->q3-q3) );
    715736        return 3;
    716737    }
Note: See TracChangeset for help on using the changeset viewer.