Changeset 2842
- Timestamp:
- Dec 28, 2004, 4:52:51 PM (22 years ago)
- Location:
- trunk/psModules
- Files:
-
- 2 edited
-
src/pmSubtractBias.c (modified) (1 diff)
-
test/tst_pmSubtractBias.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmSubtractBias.c
r2841 r2842 6 6 * @author George Gusciora, MHPCC 7 7 * 8 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12-29 02:52: 28$8 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-29 02:52:51 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psModules/test/tst_pmSubtractBias.c
r2838 r2842 13 13 * @author GLG, MHPCC 14 14 * 15 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-12-2 8 19:04:30$15 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-12-29 02:52:28 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 307 307 psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 308 308 psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 309 psImage *tmpImage2Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32); 310 psImage *tmpImage3Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32); 311 psImage *tmpImage4Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32); 309 312 psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImage1); 310 313 psReadout *rc = NULL; 311 314 psList *list; 315 psList *listShort; 312 316 psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 313 317 psImage *tmpImage5 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 314 318 psReadout *myBias = psReadoutAlloc(numCols, numRows, tmpImage5); 319 psImage *tmpImage5ShortRows = psImageAlloc(numCols, numRows-1, PS_TYPE_F32); 320 psReadout *myBiasShortRows = psReadoutAlloc(numCols, numRows-1, tmpImage5ShortRows); 321 psImage *tmpImage5ShortCols = psImageAlloc(numCols-1, numRows, PS_TYPE_F32); 322 psReadout *myBiasShortCols = psReadoutAlloc(numCols-1, numRows, tmpImage5ShortCols); 315 323 316 324 for (i=0;i<numRows;i++) { … … 326 334 psListAdd(list, PS_LIST_HEAD, tmpImage3); 327 335 psListAdd(list, PS_LIST_HEAD, tmpImage4); 336 337 for (i=0;i<numRows-1;i++) { 338 for (j=0;j<numCols-1;j++) { 339 tmpImage2Short->data.F32[i][j] = 3.0; 340 tmpImage3Short->data.F32[i][j] = 4.0; 341 tmpImage4Short->data.F32[i][j] = 5.0; 342 } 343 } 344 listShort = psListAlloc(tmpImage2Short); 345 psListAdd(listShort, PS_LIST_HEAD, tmpImage3Short); 346 psListAdd(listShort, PS_LIST_HEAD, tmpImage4Short); 347 for (i=0;i<numRows-1;i++) { 348 for (j=0;j<numCols;j++) { 349 myBiasShortRows->image->data.F32[i][j] = 1.0; 350 } 351 } 352 for (i=0;i<numRows;i++) { 353 for (j=0;j<numCols-1;j++) { 354 myBiasShortCols->image->data.F32[i][j] = 1.0; 355 } 356 } 357 328 358 329 359 printf("------------------------------------------------------------------\n"); … … 433 463 434 464 465 printf("------------------------------------------------------------------\n"); 466 printf("Calling pmSubtractBias() with multiple stats->options. Should generate Warning.\n"); 467 stat->options|= PS_STAT_SAMPLE_MEDIAN; 468 myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_ALL, stat, 469 0, PM_FIT_NONE, NULL); 470 for (i=0;i<numRows;i++) { 471 for (j=0;j<numCols;j++) { 472 psF32 expect = ((float) (i + j)) - 12.0; 473 psF32 actual = rc->image->data.F32[i][j]; 474 if (FLT_EPSILON < fabs(expect - actual)) { 475 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 476 testStatus = 1; 477 } 478 } 479 } 480 stat->options = PS_STAT_SAMPLE_MEAN; 481 482 printf("------------------------------------------------------------------\n"); 483 printf("Calling pmSubtractBias() undersize overscans (PM_OVERSCAN_ROWS). Should generate Warning.\n"); 484 myReadout = pmSubtractBias(myReadout, NULL, listShort, PM_OVERSCAN_ROWS, stat, 485 0, PM_FIT_NONE, NULL); 486 /* 487 for (i=0;i<numRows;i++) { 488 for (j=0;j<numCols;j++) { 489 psF32 expect = ((float) (i + j)) - 12.0; 490 psF32 actual = rc->image->data.F32[i][j]; 491 if (FLT_EPSILON < fabs(expect - actual)) { 492 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 493 testStatus = 1; 494 } 495 } 496 } 497 */ 498 499 printf("------------------------------------------------------------------\n"); 500 printf("Calling pmSubtractBias() undersize overscans (PM_OVERSCAN_COLUMNS). Should generate Warning.\n"); 501 myReadout = pmSubtractBias(myReadout, NULL, listShort, PM_OVERSCAN_COLUMNS, stat, 502 0, PM_FIT_NONE, NULL); 503 /* 504 for (i=0;i<numRows;i++) { 505 for (j=0;j<numCols;j++) { 506 psF32 expect = ((float) (i + j)) - 12.0; 507 psF32 actual = rc->image->data.F32[i][j]; 508 if (FLT_EPSILON < fabs(expect - actual)) { 509 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 510 testStatus = 1; 511 } 512 } 513 } 514 */ 515 516 printf("------------------------------------------------------------------\n"); 517 printf("Calling pmSubtractBias() undersize bias image (short rows). Should generate Warning.\n"); 518 myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL, 519 0, PM_FIT_NONE, myBiasShortRows); 520 if (rc != myReadout) { 521 printf("ERROR: pmSubtractBias() did not return input psReadout.\n"); 522 testStatus = false; 523 psFree(rc); 524 } 525 526 527 printf("------------------------------------------------------------------\n"); 528 printf("Calling pmSubtractBias() undersize bias image (short columns). Should generate Warning.\n"); 529 myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL, 530 0, PM_FIT_NONE, myBiasShortCols); 531 if (rc != myReadout) { 532 printf("ERROR: pmSubtractBias() did not return input psReadout.\n"); 533 testStatus = false; 534 psFree(rc); 535 } 536 435 537 436 538 printf("------------------------------------------------------------------\n"); … … 439 541 psFree(tmpImage3); 440 542 psFree(tmpImage4); 543 psFree(tmpImage2Short); 544 psFree(tmpImage3Short); 545 psFree(tmpImage4Short); 441 546 psFree(myBias); 547 psFree(myBiasShortRows); 548 psFree(myBiasShortCols); 442 549 psFree(stat); 443 550 psFree(list); 551 psFree(listShort); 444 552 445 553 return(testStatus);
Note:
See TracChangeset
for help on using the changeset viewer.
