Changeset 21474 for trunk/psModules/test/camera/tap_pmFPAMaskW.c
- Timestamp:
- Feb 13, 2009, 12:47:32 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/camera/tap_pmFPAMaskW.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/camera/tap_pmFPAMaskW.c
r21220 r21474 62 62 readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 63 63 readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 64 readout-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);64 readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 65 65 for (int i = 0 ; i < TEST_NUM_ROWS ; i++) { 66 66 for (int j = 0 ; j < TEST_NUM_COLS ; j++) { 67 67 readout->image->data.F32[i][j] = 32.0; 68 68 readout->mask->data.U8[i][j] = 0; 69 readout-> weight->data.F32[i][j] = 1.0;69 readout->variance->data.F32[i][j] = 1.0; 70 70 } 71 71 } … … 108 108 cell->hdu->images = psArrayAlloc(NUM_HDUS); 109 109 cell->hdu->masks = psArrayAlloc(NUM_HDUS); 110 cell->hdu-> weights = psArrayAlloc(NUM_HDUS);110 cell->hdu->variances = psArrayAlloc(NUM_HDUS); 111 111 for (int k = 0 ; k < NUM_HDUS ; k++) { 112 112 cell->hdu->images->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 113 113 cell->hdu->masks->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_MASK); 114 cell->hdu-> weights->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);114 cell->hdu->variances->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 115 115 psImageInit(cell->hdu->images->data[k], (float) (BASE_IMAGE+k)); 116 116 psImageInit(cell->hdu->masks->data[k], (psU8) (BASE_MASK+k)); 117 psImageInit(cell->hdu-> weights->data[k], (float) (BASE_WEIGHT+k));117 psImageInit(cell->hdu->variances->data[k], (float) (BASE_WEIGHT+k)); 118 118 } 119 119 … … 355 355 356 356 // ---------------------------------------------------------------------- 357 // pmReadoutSet Weight() tests: NULL inputs358 // bool pmReadoutSet Weight(pmReadout *readout, bool poisson)357 // pmReadoutSetVariance() tests: NULL inputs 358 // bool pmReadoutSetVariance(pmReadout *readout, bool poisson) 359 359 if (1) { 360 360 psMemId id = psMemGetId(); … … 366 366 bool rc; 367 367 368 // Set readout == NULL, ensure pmReadoutSet Weight() returnes FALSE, with no seg faults, memory leaks369 rc = pmReadoutSet Weight(NULL, false);370 ok(!rc, "pmReadoutSet Weight(NULL, false) returned FALSE with null pmReadout input");368 // Set readout == NULL, ensure pmReadoutSetVariance() returnes FALSE, with no seg faults, memory leaks 369 rc = pmReadoutSetVariance(NULL, false); 370 ok(!rc, "pmReadoutSetVariance(NULL, false) returned FALSE with null pmReadout input"); 371 371 372 372 … … 376 376 ok(rc, "Set GAIN and READNOISE in cell->concepts successfully"); 377 377 378 // Call pmReadoutSet Weight() and then verify that the mask data was set correctly379 rc = pmReadoutSet Weight(readout, false);380 ok(rc, "pmReadoutSet Weight(readout, false) returned TRUE with acceptable input data");378 // Call pmReadoutSetVariance() and then verify that the mask data was set correctly 379 rc = pmReadoutSetVariance(readout, false); 380 ok(rc, "pmReadoutSetVariance(readout, false) returned TRUE with acceptable input data"); 381 381 bool errorFlag = false; 382 for (int i = 0 ; i < readout-> weight->numRows ; i++) {383 for (int j = 0 ; j < readout-> weight->numCols ; j++) {382 for (int i = 0 ; i < readout->variance->numRows ; i++) { 383 for (int j = 0 ; j < readout->variance->numCols ; j++) { 384 384 psF32 exp = CELL_READNOISE * CELL_READNOISE / CELL_GAIN / CELL_GAIN; 385 if(abs(readout-> weight->data.F32[i][j] - exp) > 1e-4) {385 if(abs(readout->variance->data.F32[i][j] - exp) > 1e-4) { 386 386 if (VERBOSE) { 387 387 diag("TEST ERROR: weight[%d][%d] is %.2f, should be %.2f\n", 388 i, j, readout-> weight->data.F32[i][j], exp);388 i, j, readout->variance->data.F32[i][j], exp); 389 389 } 390 390 errorFlag = true; … … 392 392 } 393 393 } 394 ok(!errorFlag, "pmReadoutSet Weight() set the weight values correctly (non-Poisson)");394 ok(!errorFlag, "pmReadoutSetVariance() set the weight values correctly (non-Poisson)"); 395 395 396 396 for (int i = 0 ; i < readout->image->numRows ; i++) { … … 399 399 } 400 400 } 401 // Call pmReadoutSet Weight() and then verify that the mask data was set correctly402 rc = pmReadoutSet Weight(readout, true);403 ok(rc, "pmReadoutSet Weight(readout, true) returned TRUE with acceptable input data");401 // Call pmReadoutSetVariance() and then verify that the mask data was set correctly 402 rc = pmReadoutSetVariance(readout, true); 403 ok(rc, "pmReadoutSetVariance(readout, true) returned TRUE with acceptable input data"); 404 404 errorFlag = false; 405 for (int i = 0 ; i < readout-> weight->numRows ; i++) {406 for (int j = 0 ; j < readout-> weight->numCols ; j++) {405 for (int i = 0 ; i < readout->variance->numRows ; i++) { 406 for (int j = 0 ; j < readout->variance->numCols ; j++) { 407 407 psF32 exp = abs(readout->image->data.F32[i][j] / CELL_GAIN); 408 408 if (exp < 1.0) exp = 1.0; 409 409 exp+= CELL_READNOISE * CELL_READNOISE / CELL_GAIN / CELL_GAIN; 410 if(abs(readout-> weight->data.F32[i][j] - exp) > 1e-4) {410 if(abs(readout->variance->data.F32[i][j] - exp) > 1e-4) { 411 411 if (VERBOSE) { 412 412 diag("TEST ERROR: weight[%d][%d] is %.2f, should be %.2f\n", 413 i, j, readout-> weight->data.F32[i][j], exp);413 i, j, readout->variance->data.F32[i][j], exp); 414 414 } 415 415 errorFlag = true;
Note:
See TracChangeset
for help on using the changeset viewer.
