IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 13, 2009, 12:47:32 PM (17 years ago)
Author:
giebink
Message:

Account for weight(s) to variance(s) change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/camera/tap_pmFPAMaskW.c

    r21220 r21474  
    6262    readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
    6363    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);
    6565    for (int i = 0 ; i < TEST_NUM_ROWS ; i++) {
    6666        for (int j = 0 ; j < TEST_NUM_COLS ; j++) {
    6767            readout->image->data.F32[i][j] = 32.0;
    6868            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;
    7070        }
    7171    }
     
    108108    cell->hdu->images = psArrayAlloc(NUM_HDUS);
    109109    cell->hdu->masks = psArrayAlloc(NUM_HDUS);
    110     cell->hdu->weights = psArrayAlloc(NUM_HDUS);
     110    cell->hdu->variances = psArrayAlloc(NUM_HDUS);
    111111    for (int k = 0 ; k < NUM_HDUS ; k++) {
    112112        cell->hdu->images->data[k]  = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
    113113        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);
    115115        psImageInit(cell->hdu->images->data[k], (float) (BASE_IMAGE+k));
    116116        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));
    118118    }
    119119
     
    355355
    356356    // ----------------------------------------------------------------------
    357     // pmReadoutSetWeight() tests: NULL inputs
    358     // bool pmReadoutSetWeight(pmReadout *readout, bool poisson)
     357    // pmReadoutSetVariance() tests: NULL inputs
     358    // bool pmReadoutSetVariance(pmReadout *readout, bool poisson)
    359359    if (1) {
    360360        psMemId id = psMemGetId();
     
    366366        bool rc;
    367367
    368         // Set readout == NULL, ensure pmReadoutSetWeight() returnes FALSE, with no seg faults, memory leaks
    369         rc = pmReadoutSetWeight(NULL, false);
    370         ok(!rc, "pmReadoutSetWeight(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");
    371371
    372372
     
    376376        ok(rc, "Set GAIN and READNOISE in cell->concepts successfully");
    377377
    378         // Call pmReadoutSetWeight() and then verify that the mask data was set correctly
    379         rc = pmReadoutSetWeight(readout, false);
    380         ok(rc, "pmReadoutSetWeight(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");
    381381        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++) {
    384384                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) {
    386386                    if (VERBOSE) {
    387387                        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);
    389389                    }
    390390                    errorFlag = true;
     
    392392            }
    393393        }
    394         ok(!errorFlag, "pmReadoutSetWeight() set the weight values correctly (non-Poisson)");
     394        ok(!errorFlag, "pmReadoutSetVariance() set the weight values correctly (non-Poisson)");
    395395
    396396        for (int i = 0 ; i < readout->image->numRows ; i++) {
     
    399399            }
    400400        }
    401         // Call pmReadoutSetWeight() and then verify that the mask data was set correctly
    402         rc = pmReadoutSetWeight(readout, true);
    403         ok(rc, "pmReadoutSetWeight(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");
    404404        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++) {
    407407                psF32 exp = abs(readout->image->data.F32[i][j] / CELL_GAIN);
    408408                if (exp < 1.0) exp = 1.0;
    409409                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) {
    411411                    if (VERBOSE) {
    412412                        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);
    414414                    }
    415415                    errorFlag = true;
Note: See TracChangeset for help on using the changeset viewer.