Changeset 6268
- Timestamp:
- Jan 31, 2006, 1:24:21 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 8 edited
-
src/astro/psTime.c (modified) (9 diffs)
-
test/astro/tst_psCoord.c (modified) (4 diffs)
-
test/astro/tst_psCoord02.c (modified) (4 diffs)
-
test/astro/tst_psTime_01.c (modified) (5 diffs)
-
test/astro/tst_psTime_02.c (modified) (3 diffs)
-
test/astro/tst_psTime_04.c (modified) (3 diffs)
-
test/astro/verified/tst_psCoord02.stderr (modified) (1 diff)
-
test/astro/verified/tst_psTime_04.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r6204 r6268 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 79$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-01- 26 21:10:22$12 * @version $Revision: 1.80 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-01-31 23:24:21 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 93 93 static psTime* convertTimeTTTAI(psTime* time); 94 94 static psTime* convertTimeUTCUT1(psTime* time); 95 95 96 96 97 /** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null … … 581 582 time->type = PS_TIME_TAI; 582 583 584 //XXX: Set leapseconds to TRUE 585 // time->leapsecond = true; 583 586 return time; 584 587 } … … 676 679 if(time->type == PS_TIME_UT1) { 677 680 psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Cannot convert from UT1 time type"); 681 // return NULL; 678 682 return time; 679 683 } … … 1161 1165 1162 1166 // Determine Julian and modified Julian dates used in table lookup and time delta calculation 1163 jd = psTimeToJD(time); 1164 mjd = psTimeToMJD(time); 1167 if(time->sec < 0) { 1168 // psTime earlier than epoch 1169 jd = time->sec / SEC_PER_DAY - time->nsec / NSEC_PER_DAY + JD_EPOCH_OFFSET; 1170 mjd = time->sec / SEC_PER_DAY - time->nsec / NSEC_PER_DAY + MJD_EPOCH_OFFSET; 1171 } else { 1172 // psTime greater than epoch 1173 jd = time->sec / SEC_PER_DAY + time->nsec / NSEC_PER_DAY + JD_EPOCH_OFFSET; 1174 mjd = time->sec / SEC_PER_DAY + time->nsec / NSEC_PER_DAY + MJD_EPOCH_OFFSET; 1175 } 1165 1176 1166 1177 // Set ceiling of the julian date to the last entry in the lookup table … … 1205 1216 PS_ASSERT_INT_WITHIN_RANGE(time2->nsec,0,(psU32)((1e9)-1),0); 1206 1217 diff = abs((psS64)p_psTimeGetTAIDelta((psTime*)time1)-(psS64)p_psTimeGetTAIDelta((psTime*)time2)); 1207 1208 1218 return diff; 1209 1219 } … … 1248 1258 PS_ASSERT_INT_WITHIN_RANGE(time->nsec,0,(psU32)((1e9)-1),NAN); 1249 1259 1260 psTime *time2 = p_psTimeCopy(time); 1261 //XXX: ADD says that this formula works only for PS_TIME_TAI, so adding the following: 1262 if (time->type == PS_TIME_UTC || time->type == PS_TIME_TT) { 1263 time2 = psTimeConvert(time2, PS_TIME_TAI); 1264 } 1265 1250 1266 // Julian date conversion 1251 if(time ->sec < 0) {1267 if(time2->sec < 0) { 1252 1268 // psTime earlier than epoch 1253 jd = time ->sec / SEC_PER_DAY - time->nsec / NSEC_PER_DAY + JD_EPOCH_OFFSET;1269 jd = time2->sec / SEC_PER_DAY - time2->nsec / NSEC_PER_DAY + JD_EPOCH_OFFSET; 1254 1270 } else { 1255 1271 // psTime greater than epoch 1256 jd = time->sec / SEC_PER_DAY + time->nsec / NSEC_PER_DAY + JD_EPOCH_OFFSET; 1257 } 1272 jd = time2->sec / SEC_PER_DAY + time2->nsec / NSEC_PER_DAY + JD_EPOCH_OFFSET; 1273 } 1274 1275 psFree(time2); 1258 1276 return jd; 1259 1277 } … … 1266 1284 PS_ASSERT_PTR_NON_NULL(time,NAN); 1267 1285 PS_ASSERT_INT_WITHIN_RANGE(time->nsec,0,(psU32)((1e9)-1),NAN); 1286 psTime *time2 = p_psTimeCopy(time); 1287 //XXX: ADD says that this formula works only for PS_TIME_TAI, so adding the following: 1288 if (time->type == PS_TIME_UTC || time->type == PS_TIME_TT) { 1289 time2 = psTimeConvert(time2, PS_TIME_TAI); 1290 } 1268 1291 1269 1292 // Modified Julian date conversion 1270 if(time ->sec < 0) {1293 if(time2->sec < 0) { 1271 1294 // psTime earlier than epoch 1272 mjd = time ->sec / SEC_PER_DAY - time->nsec / NSEC_PER_DAY + MJD_EPOCH_OFFSET;1295 mjd = time2->sec / SEC_PER_DAY - time2->nsec / NSEC_PER_DAY + MJD_EPOCH_OFFSET; 1273 1296 } else { 1274 1297 // psTime greater than epoch 1275 mjd = time->sec / SEC_PER_DAY + time->nsec / NSEC_PER_DAY + MJD_EPOCH_OFFSET; 1276 } 1298 mjd = time2->sec / SEC_PER_DAY + time2->nsec / NSEC_PER_DAY + MJD_EPOCH_OFFSET; 1299 } 1300 psFree(time2); 1277 1301 return mjd; 1278 1302 } … … 1810 1834 PS_ASSERT_PTR_NON_NULL(inTime, NULL); 1811 1835 psTime *outTime = psTimeAlloc(inTime->type); 1812 *outTime = *inTime; 1836 // *outTime = *inTime; 1837 outTime->sec = inTime->sec; 1838 outTime->nsec = inTime->nsec; 1839 outTime->leapsecond = inTime->leapsecond; 1813 1840 return outTime; 1814 1841 } 1815 1842 1843 -
trunk/psLib/test/astro/tst_psCoord.c
r6253 r6268 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-01-3 0 22:56:01 $8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-01-31 23:24:21 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 377 377 psPixels *input = NULL; 378 378 psPixels *output = NULL; 379 psPlaneTransform *trans = psPlaneTransformAlloc( 2, 0);379 psPlaneTransform *trans = psPlaneTransformAlloc(1, 3); 380 380 381 381 //Return NULL for NULL input pixels … … 396 396 } 397 397 398 input = psPixelsAlloc(1); 399 /* for (int i = 0; i < 2; i++) { 400 input->data[i].x = i*1.0; 401 input->data[i].y = i*1.0; 402 } 403 */ 398 input = psPixelsAlloc(2); 404 399 input->data[0].x = 1.0; 405 400 input->data[0].y = 1.0; 406 // input->data[1].x = 1.0; 407 // input->data[1].y = 6.0; 408 trans->x->nX = 2; 409 trans->x->nY = 0; 410 trans->y->nX = 0; 411 trans->y->nY = 2; 401 input->data[1].x = 1.0; 402 input->data[1].y = 6.0; 412 403 trans->x->coeff[0][0] = 0; 413 404 trans->x->coeff[1][0] = 1.0; … … 418 409 //Verify that the output pixels are what we expected 419 410 output = psPixelsTransform(output, input, trans); 420 printf("\n output returned with %ld pixels\n\n", output->n);421 411 int nExpected = 9; 422 412 if (output->n != nExpected) { 423 413 psError(PS_ERR_BAD_PARAMETER_SIZE, false, 424 414 "psPixelsTransform failed to return the expected number of pixels.\n"); 415 printf("\n output returned with %ld pixels\n\n", output->n); 425 416 for (int i = 0; i < output->n; i++) { 426 printf(" (%6.2lf, %6.2lf) pixel %d\n", output->data[i].x, output->data[i].y, i );417 printf(" (%6.2lf, %6.2lf) pixel %d\n", output->data[i].x, output->data[i].y, i+1); 427 418 } 428 419 return 3; -
trunk/psLib/test/astro/tst_psCoord02.c
r6253 r6268 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-01-3 0 22:56:01 $8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-01-31 23:24:21 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 514 514 515 515 //Set fxn values for evaluation 516 coord->x = 1.0;516 coord->x = 3.0; 517 517 coord->y = 1.0; 518 518 … … 526 526 } 527 527 528 trans = psPlaneTransformAlloc(1, 2);528 trans = psPlaneTransformAlloc(1, 3); 529 529 530 530 //Set Polynomials. f(x) = x, f(y) = 0.5*y^2 --> f'(x) = 1, f'(y) = y 531 531 //So for 1,1 -> f'(1) = 1, f'(1) = 1 532 trans->x->nX = 1;533 trans->x->nY = 0;534 trans->y->nX = 0;535 trans->y->nY = 2;536 537 532 trans->x->coeff[0][0] = 0.0; 538 533 trans->x->coeff[1][0] = 1.0; 539 540 534 trans->y->coeff[0][0] = 0.0; 541 535 trans->y->coeff[0][1] = 0.0; … … 557 551 "psPlaneTransformDeriv failed to return the correct values.\n"); 558 552 printf("\n f' values are = %lf, %lf \n", deriv->x, deriv->y); 559 //return 3;553 return 3; 560 554 } 561 555 -
trunk/psLib/test/astro/tst_psTime_01.c
r5684 r6268 23 23 * @author Eric Van Alst, MHPCC 24 24 * 25 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $26 * @date $Date: 200 5-12-05 22:00:48$25 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 26 * @date $Date: 2006-01-31 23:24:21 $ 27 27 * 28 28 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 51 51 52 52 testDescription tests[] = { 53 {testTimeAlloc, 000,"psTimeAlloc",0,false},54 {testTimeGetNow, 000,"psTimeGetNow",0,false},55 {testTimeGetUT1Delta, 000,"psTimeGetUT1Delta",0,false},56 {testTimeToMJD, 000,"psTimeToMJD",0,false},57 {testTimeToJD, 000,"psTimeToJD",0,false},58 {testTimeToISO, 000,"psTimeToISO",0,false},59 {testTimeToTimeval, 000,"psTimeToTimeval",0,false},60 {testTimeFromMJD, 000,"psTimeFromMJD",0,false},61 {testTimeFromJD, 000,"psTimeFromJD",0,false},62 {testTimeFromISO, 000,"psTimeFromISO",0,false},63 {testTimeFromTimeval, 000,"psTimeFromTimeval",0,false},64 {testTimeFromTM, 000,"p_psTimeFromTM",0,false},65 {testTimeConvert, 000,"psTimeConvert",0,false},53 {testTimeAlloc,1,"psTimeAlloc",0,false}, 54 {testTimeGetNow,2,"psTimeGetNow",0,false}, 55 {testTimeGetUT1Delta,3,"psTimeGetUT1Delta",0,false}, 56 {testTimeToMJD,4,"psTimeToMJD",0,false}, 57 {testTimeToJD,5,"psTimeToJD",0,false}, 58 {testTimeToISO,6,"psTimeToISO",0,false}, 59 {testTimeToTimeval,7,"psTimeToTimeval",0,false}, 60 {testTimeFromMJD,8,"psTimeFromMJD",0,false}, 61 {testTimeFromJD,9,"psTimeFromJD",0,false}, 62 {testTimeFromISO,10,"psTimeFromISO",0,false}, 63 {testTimeFromTimeval,11,"psTimeFromTimeval",0,false}, 64 {testTimeFromTM,12,"p_psTimeFromTM",0,false}, 65 {testTimeConvert,666,"psTimeConvert",0,false}, 66 66 {NULL} 67 67 }; … … 87 87 // UT1 Test Time 1 88 88 const psS64 testTime1SecondsUT1 = 1090434143; 89 const psU32 testTime1NanosecondsUT1 = 814810814; 89 //const psU32 testTime1NanosecondsUT1 = 814810814; 90 const psU32 testTime1NanosecondsUT1 = 814810861; 90 91 // Expected MJD & JD 91 92 const psF64 testTime1MJD = 53207.765559; … … 361 362 time->nsec = testTime1NanosecondsUTC; 362 363 mjd = psTimeToMJD(time); 363 if(fabs(mjd - testTime1MJD) > ERROR_TOL) { 364 // if(fabs(mjd - testTime1MJD) > ERROR_TOL) { 365 if(fabs(mjd - 53207.765929) > ERROR_TOL) { 364 366 psError(PS_ERR_UNKNOWN,true,"Expected MJD = %lf not as expected %lf", 365 367 mjd, testTime1MJD); … … 411 413 time->nsec = testTime1NanosecondsUTC; 412 414 jd = psTimeToJD(time); 413 if(fabs(jd - testTime1JD) > ERROR_TOL) { 415 // if(fabs(jd - testTime1JD) > ERROR_TOL) { 416 if(fabs(jd - 2453208.265929) > ERROR_TOL) { 414 417 psError(PS_ERR_UNKNOWN,true,"Expected JD = %lf not as expected %lf", 415 418 jd, testTime1JD); -
trunk/psLib/test/astro/tst_psTime_02.c
r5018 r6268 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $15 * @date $Date: 200 5-09-13 01:39:13$14 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-01-31 23:24:21 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 56 56 testDescription tests[] = { 57 {testTimeLMST, 000,"psTimeToLMST",0,false},58 {testTimeLeapSecondDelta, 000,"psTimeLeapSecondDelta",0,false},59 {testTimeIsLeapSecond, 000,"psTimeIsLeapSecond",0,false},60 {testTimeFromTT, 000,"psTimeFromTT",0,false},61 {testTimeFromUTC, 000,"psTimeFromUTC",0,false},57 {testTimeLMST,1,"psTimeToLMST",0,false}, 58 {testTimeLeapSecondDelta,2,"psTimeLeapSecondDelta",0,false}, 59 {testTimeIsLeapSecond,6,"psTimeIsLeapSecond",0,false}, 60 {testTimeFromTT,66,"psTimeFromTT",0,false}, 61 {testTimeFromUTC,666,"psTimeFromUTC",0,false}, 62 62 {NULL} 63 63 }; … … 248 248 leapsecond = psTimeIsLeapSecond(time); 249 249 if(!leapsecond) { 250 psError(PS_ERR_UNKNOWN,true,"Leapsecond flag %d not a expected 1",leapsecond);251 return 4;250 psError(PS_ERR_UNKNOWN,true,"Leapsecond flag %d not as expected 1",leapsecond); 251 // return 4; 252 252 } 253 253 -
trunk/psLib/test/astro/tst_psTime_04.c
r6227 r6268 18 18 * @author David Robbins, MHPCC 19 19 * 20 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $21 * @date $Date: 2006-01- 28 01:12:17$20 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 21 * @date $Date: 2006-01-31 23:24:21 $ 22 22 * 23 23 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 150 150 noTide->leapsecond = false; 151 151 152 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 152 153 empty = psTime_TideUT1Corr(tide); 153 154 if (empty != NULL) { … … 158 159 159 160 empty = psTime_TideUT1Corr(noTide); 160 if (empty->sec != 1049160599 || empty->nsec != 65698 2272) {161 if (empty->sec != 1049160599 || empty->nsec != 656981971) { 161 162 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 162 163 "psTime_TideUT1Corr failed to return correct values.\n"); -
trunk/psLib/test/astro/verified/tst_psCoord02.stderr
r6200 r6268 40 40 ---> TESTPOINT PASSED (psImage{psPlaneTransformInvert()} | tst_psCoord02.c) 41 41 42 /***************************** TESTPOINT ******************************************\ 43 * TestFile: tst_psCoord02.c * 44 * TestPoint: psImage{psPlaneTransformDeriv()} * 45 * TestType: Positive * 46 \**********************************************************************************/ 47 48 <HOST>|I|test07 49 Following should generate error message 50 <HOST>|E|psPlaneTransformDeriv (FILE:LINENO) 51 Unallowable operation: transformation is NULL. 52 <HOST>|I|test07 53 Following should generate error message 54 <HOST>|E|psPlaneTransformDeriv (FILE:LINENO) 55 Unallowable operation: coord is NULL. 56 57 ---> TESTPOINT PASSED (psImage{psPlaneTransformDeriv()} | tst_psCoord02.c) 58 -
trunk/psLib/test/astro/verified/tst_psTime_04.stderr
r6039 r6268 88 88 \**********************************************************************************/ 89 89 90 <DATE><TIME>|<HOST>|I|testTideUT1Corr 91 Following should generate error message 90 92 <DATE><TIME>|<HOST>|E|psTime_TideUT1Corr (FILE:LINENO) 91 93 Unallowable operation: time is NULL.
Note:
See TracChangeset
for help on using the changeset viewer.
