IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2838


Ignore:
Timestamp:
Dec 28, 2004, 9:04:30 AM (22 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psModules
Files:
3 edited

Legend:

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

    r2777 r2838  
    66 *  @author George Gusciora, MHPCC
    77 *
    8  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-12-21 20:41:29 $
     8 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-28 19:04:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    233233    psSpline1D *mySpline;
    234234    int nBin;
    235     //
     235    //  XXX: This comment isn't right?
    236236    //  Determine if multiple options are specified in stat.
    237237    //
     
    241241
    242242    if (overScanAxis == PM_OVERSCAN_NONE) {
     243        if (fit != PM_FIT_NONE) {
     244            psLogMsg(__func__, PS_LOG_WARN,
     245                     "WARNING: pmSubtractBias.(): overScanAxis equals NONE, and fit does not equal NONE\n");
     246        }
     247
    243248        if (overscans != NULL) {
    244249            psLogMsg(__func__, PS_LOG_WARN,
     
    248253    }
    249254
    250     if (((overScanAxis == PM_OVERSCAN_NONE) ||
    251             (overScanAxis == PM_OVERSCAN_ALL)) &&
    252             (fit == PM_FIT_NONE)) {
     255    if ((overScanAxis == PM_OVERSCAN_ALL) && (fit != PM_FIT_NONE)) {
    253256        psLogMsg(__func__, PS_LOG_WARN,
    254                  "WARNING: pmSubtractBias.(): overScanAxis equals NONE or ALL, and fit equals NONE\n");
     257                 "WARNING: pmSubtractBias.(): overScanAxis equals ALL, and fit does not equal NONE\n");
    255258    }
    256259
  • trunk/psModules/src/pmSubtractSky.c

    r2812 r2838  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-12-23 23:16:36 $
     8 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-28 19:04:29 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    202202 
    203203XXX: Use a psImage for the p_psPolySums data structure?
    204 XXX: Check for positive x- and y-Order.
    205204XXX: Use variable size arrays for p_psPolySums[][].
    206 XXX" Must initialize p_psPolySums[][]?
     205XXX: Must initialize p_psPolySums[][]?
    207206 *****************************************************************************/
    208207#define PS_MAX_POLYNOMIAL_ORDER 20
  • trunk/psModules/test/tst_pmSubtractBias.c

    r2756 r2838  
    1313 *  @author GLG, MHPCC
    1414 *
    15  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2004-12-18 02:27:55 $
     15 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2004-12-28 19:04:30 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626static int test02(void);
    2727static int test03(void);
     28static int test04(void);
    2829testDescription tests[] = {
    29                               {test00, 000, "pmSubtractBias", 0, false},
    30                               {test01, 000, "pmSubtractBias", 0, false},
    31                               {test02, 000, "pmSubtractBias", 0, false},
    32                               {test03, 000, "pmSubtractBias", 0, false},
     30                              /*
     31                                                            {test00, 000, "pmSubtractBias", 0, false},
     32                                                            {test01, 000, "pmSubtractBias", 0, false},
     33                                                            {test02, 000, "pmSubtractBias", 0, false},
     34                                                            {test03, 000, "pmSubtractBias", 0, false},
     35                              */
     36                              {test04, 000, "pmSubtractBias", 0, false},
    3337                              {NULL}
    3438                          };
     
    294298
    295299
    296 
    297 
    298 
    299 
    300 
    301 
    302 
     300int doSubtractOverscansTestInputCases(int numCols, int numRows)
     301{
     302    int i;
     303    int j;
     304    int testStatus = 0;
     305    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     306    psImage *tmpImage2 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     307    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     308    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     309    psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImage1);
     310    psReadout *rc = NULL;
     311    psList *list;
     312    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     313    psImage *tmpImage5 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     314    psReadout *myBias = psReadoutAlloc(numCols, numRows, tmpImage5);
     315
     316    for (i=0;i<numRows;i++) {
     317        for (j=0;j<numCols;j++) {
     318            myReadout->image->data.F32[i][j] = (float) (i + j);
     319            tmpImage2->data.F32[i][j] = 3.0;
     320            tmpImage3->data.F32[i][j] = 4.0;
     321            tmpImage4->data.F32[i][j] = 5.0;
     322            myBias->image->data.F32[i][j] = 1.0;
     323        }
     324    }
     325    list = psListAlloc(tmpImage2);
     326    psListAdd(list, PS_LIST_HEAD, tmpImage3);
     327    psListAdd(list, PS_LIST_HEAD, tmpImage4);
     328
     329    printf("------------------------------------------------------------------\n");
     330    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_ALL.  Should generate error.\n");
     331    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ALL, stat, 0, PM_FIT_NONE, NULL);
     332    if (rc != myReadout) {
     333        printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     334        testStatus = false;
     335    }
     336
     337    printf("------------------------------------------------------------------\n");
     338    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_ROWS.  Should generate error.\n");
     339    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ROWS, stat, 0, PM_FIT_NONE, NULL);
     340    if (rc != myReadout) {
     341        printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     342        testStatus = false;
     343        psFree(rc);
     344    }
     345
     346    printf("------------------------------------------------------------------\n");
     347    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_COLUMNS.  Should generate error.\n");
     348    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_COLUMNS, stat, 0, PM_FIT_NONE, NULL);
     349    if (rc != myReadout) {
     350        printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     351        testStatus = false;
     352        psFree(rc);
     353    }
     354
     355    printf("------------------------------------------------------------------\n");
     356    printf("Calling pmSubtractBias() with non-NULL overscan list and PM_OVERSCAN_NONE.  Should generate warning.\n");
     357    rc = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_NONE, stat,
     358                        0, PM_FIT_NONE, myBias);
     359
     360    for (i=0;i<numRows;i++) {
     361        for (j=0;j<numCols;j++) {
     362            psF32 expect = ((float) (i + j)) - 1.0;
     363            psF32 actual = rc->image->data.F32[i][j];
     364            if (FLT_EPSILON < fabs(expect - actual)) {
     365                printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     366                testStatus = 1;
     367            }
     368
     369            // Restore myReadout for next test.
     370            myReadout->image->data.F32[i][j] = (float) (i + j);
     371        }
     372    }
     373
     374    printf("------------------------------------------------------------------\n");
     375    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE.  Should generate warning.\n");
     376    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat,
     377                        0, PM_FIT_NONE, myBias);
     378
     379    for (i=0;i<numRows;i++) {
     380        for (j=0;j<numCols;j++) {
     381            psF32 expect = ((float) (i + j)) - 1.0;
     382            psF32 actual = rc->image->data.F32[i][j];
     383            if (FLT_EPSILON < fabs(expect - actual)) {
     384                printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     385                testStatus = 1;
     386            }
     387
     388            // Restore myReadout for next test.
     389            myReadout->image->data.F32[i][j] = (float) (i + j);
     390        }
     391    }
     392
     393    printf("------------------------------------------------------------------\n");
     394    printf("Calling pmSubtractBias() with PM_OVERSCAN_NONE and PM_FIT_POLYNOMIAL.  Should generate Warning.\n");
     395    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_POLYNOMIAL, myBias);
     396    for (i=0;i<numRows;i++) {
     397        for (j=0;j<numCols;j++) {
     398            psF32 expect = ((float) (i + j)) - 1.0;
     399            psF32 actual = rc->image->data.F32[i][j];
     400            if (FLT_EPSILON < fabs(expect - actual)) {
     401                printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     402                testStatus = 1;
     403            }
     404
     405            // Restore myReadout for next test.
     406            myReadout->image->data.F32[i][j] = (float) (i + j);
     407        }
     408    }
     409
     410
     411    printf("------------------------------------------------------------------\n");
     412    printf("Calling pmSubtractBias() with PM_OVERSCAN_ALL and PM_FIT_SPLINE.  Should generate Warning.\n");
     413    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_SPLINE, myBias);
     414    if (rc != myReadout) {
     415        printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     416        testStatus = false;
     417        psFree(rc);
     418    }
     419
     420    for (i=0;i<numRows;i++) {
     421        for (j=0;j<numCols;j++) {
     422            psF32 expect = ((float) (i + j)) - 1.0;
     423            psF32 actual = rc->image->data.F32[i][j];
     424            if (FLT_EPSILON < fabs(expect - actual)) {
     425                printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     426                testStatus = 1;
     427            }
     428
     429            // Restore myReadout for next test.
     430            myReadout->image->data.F32[i][j] = (float) (i + j);
     431        }
     432    }
     433
     434
     435
     436    printf("------------------------------------------------------------------\n");
     437    psFree(myReadout);
     438    psFree(tmpImage2);
     439    psFree(tmpImage3);
     440    psFree(tmpImage4);
     441    psFree(myBias);
     442    psFree(stat);
     443    psFree(list);
     444
     445    return(testStatus);
     446}
     447
     448int test04( void )
     449{
     450    int testStatus = 0;
     451
     452    testStatus |= doSubtractOverscansTestInputCases(NUM_COLS, NUM_ROWS);
     453    return(testStatus);
     454}
     455
     456
     457//This code will ...
Note: See TracChangeset for help on using the changeset viewer.