IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2816


Ignore:
Timestamp:
Dec 23, 2004, 2:58:08 PM (22 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmReadoutCombine.c

    r2814 r2816  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-23 23:42:25 $
     7 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-24 00:58:08 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    277277            // XXX: Is this correct?
    278278            // We add the zero vector, if non-NULL.
    279 
    280279            if (zero != NULL) {
    281280                for (int r = 0; r < numInputs ; r++) {
  • trunk/psModules/test/tst_pmReadoutCombine.c

    r2815 r2816  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-23 23:57:32 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-24 00:58:08 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323
    2424#define NUM_READOUTS  10
     25#define INPUT_NUM_ROWS 10
     26#define INPUT_NUM_COLS 10
     27#define VEC_ZERO 1.0
     28#define VEC_SCALE 2.0
     29
     30psS32 VerifyTheOutput(psImage *output, psF32 expect)
     31{
     32    bool testStatus = true;
     33
     34    for (psS32 i = 0 ; i < output->numRows ; i++) {
     35        for (psS32 j = 0 ; j < output->numCols ; j++) {
     36            if (output->data.F32[i][j] != expect) {
     37                printf("ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect);
     38                testStatus = false;
     39            }
     40        }
     41    }
     42    return(testStatus);
     43}
     44
     45
    2546
    2647int main(int argc, char* argv[])
     
    4970    psVector *scale = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32);
    5071    for (i=0;i<NUM_READOUTS;i++) {
    51         zero->data.F32[i] = 1.0;
     72        zero->data.F32[i] = VEC_ZERO;
    5273    }
    5374    for (i=0;i<NUM_READOUTS;i++) {
    54         scale->data.F32[i] = 2.0;
     75        scale->data.F32[i] = VEC_SCALE;
    5576    }
    5677
     
    7394        baseRows[r] = 0;
    7495        baseCols[r] = 0;
    75         numRows[r] = 10;
    76         numCols[r] = 10;
     96        numRows[r] = INPUT_NUM_ROWS;
     97        numCols[r] = INPUT_NUM_COLS;
    7798
    7899        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
    79100        PS_IMAGE_SET_F32(tmpImage, ((float) r));
    80 
    81101        *(int *) (& (tmpImage->row0)) = baseRows[r];
    82102        *(int *) (& (tmpImage->col0)) = baseCols[r];
     
    99119
    100120    output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
    101 
    102     for (int i=output->row0; i < (output->row0 + output->numRows) ; i++) {
    103         for (int j=output->col0; j < (output->col0 + output->numCols) ; j++) {
    104             printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]);
    105         }
    106         printf("\n");
    107     }
     121    psF32 NR = (psF32) NUM_READOUTS;
     122    psF32 expectedPixel = ((((NR-1.0) * (NR/2.0)) / NR) + VEC_ZERO) * VEC_SCALE;
     123    VerifyTheOutput(output, expectedPixel);
    108124
    109125    psFree(params->stats);
     
    132148    return(testStatus);
    133149}
    134 
    135 psS32 VerifyTheOutput(psImage *output)
    136 {
    137     bool testStatus = true;
    138 
    139     for (psS32 i = 0 ; i < output->numRows ; i++) {
    140         for (psS32 j = 0 ; j < output->numCols ; j++) {
    141             if (output->data.F32[i][j] != 45.0) {
    142                 printf("ERROR: output[%d][%d] is %.2f, should be 45.0\n", i, j, output->data.F32[i][j]);
    143                 testStatus = false;
    144             }
    145         }
    146     }
    147     return(testStatus);
    148 }
    149 
    150150
    151151int test01()
     
    196196        baseRows[r] = 0;
    197197        baseCols[r] = 0;
    198         numRows[r] = 10;
    199         numCols[r] = 10;
     198        numRows[r] = INPUT_NUM_ROWS;
     199        numCols[r] = INPUT_NUM_COLS;
    200200
    201201        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
     
    252252    rc = pmReadoutCombine(output, list, params, zeroBig, scale, true, 1.0, 0.0);
    253253    if (rc != NULL) {
    254         if (false == VerifyTheOutput(rc)) {
     254        if (false == VerifyTheOutput(rc, 45.0)) {
    255255            testStatus = false;
    256256        }
     
    292292    rc = pmReadoutCombine(output, list, params, zero, scaleBig, true, 1.0, 0.0);
    293293    if (rc != NULL) {
    294         if (false == VerifyTheOutput(rc)) {
     294        if (false == VerifyTheOutput(rc, 45.0)) {
    295295            testStatus = false;
    296296        }
Note: See TracChangeset for help on using the changeset viewer.