IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2928


Ignore:
Timestamp:
Jan 7, 2005, 10:00:34 AM (22 years ago)
Author:
gusciora
Message:

Fixed a few error conditions.

Location:
trunk/psModules
Files:
5 edited

Legend:

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

    r2916 r2928  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-01-05 23:43:58 $
     7 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-01-07 20:00:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141    psS32 j;
    4242
    43     for (i=0;i<(inputReadout->image)->numRows;i++) {
    44         for (j=0;j<(inputReadout->image)->numCols;j++) {
    45             (inputReadout->image)->data.F32[i][j] = psPolynomial1DEval(input1DPoly, (inputReadout->image)->data.F32[i][j]);
     43    for (i=0;i<inputReadout->image->numRows;i++) {
     44        for (j=0;j<inputReadout->image->numCols;j++) {
     45            inputReadout->image->data.F32[i][j] = psPolynomial1DEval(input1DPoly, inputReadout->image->data.F32[i][j]);
    4646        }
    4747    }
     
    6565    PS_IMAGE_CHECK_TYPE(inputReadout->image, PS_TYPE_F32, NULL);
    6666    PS_PTR_CHECK_NULL(inFlux,NULL);
    67     psS32 tableSize = inFlux->n;
    6867    if (inFlux->n < 2) {
    6968        psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements.  Returning inputReadout image.");
     
    7170    }
    7271    PS_PTR_CHECK_NULL(outFlux,NULL);
     72    psS32 tableSize = inFlux->n;
    7373    if (inFlux->n != outFlux->n) {
    7474        tableSize = PS_MIN(inFlux->n, outFlux->n);
     
    8787
    8888    x.type.type = PS_TYPE_F32;
    89     for (i=0;i<(inputReadout->image)->numRows;i++) {
    90         for (j=0;j<(inputReadout->image)->numCols;j++) {
    91             x.data.F32 = (inputReadout->image)->data.F32[i][j];
    92 
     89    for (i=0;i<inputReadout->image->numRows;i++) {
     90        for (j=0;j<inputReadout->image->numCols;j++) {
     91            x.data.F32 = inputReadout->image->data.F32[i][j];
    9392            binNum = p_psVectorBinDisect((psVector *)inFlux, &x);
    9493
    9594            if (binNum == -2) {
    9695                // We get here if x is below the table lookup range.
    97                 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[0];
     96                inputReadout->image->data.F32[i][j] = outFlux->data.F32[0];
    9897                numPixels++;
    9998
    10099            } else if (binNum == -1) {
    101100                // We get here if x is above the table lookup range.
    102                 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[tableSize-1];
     101                inputReadout->image->data.F32[i][j] = outFlux->data.F32[tableSize-1];
     102                numPixels++;
    103103
    104                 numPixels++;
    105104            } else if (binNum < -2) {
    106105                // We get here if there was some other problem.
     
    112111                slope = (outFlux->data.F32[binNum+1] - outFlux->data.F32[binNum]) /
    113112                        (inFlux->data.F32[binNum+1]  - inFlux->data.F32[binNum]);
    114                 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[binNum] +
    115                                                         ((x.data.F32 - inFlux->data.F32[binNum]) * slope);
     113                inputReadout->image->data.F32[i][j] = outFlux->data.F32[binNum] +
     114                                                      ((x.data.F32 - inFlux->data.F32[binNum]) * slope);
    116115            }
    117116        }
  • trunk/psModules/src/pmReadoutCombine.c

    r2916 r2928  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-01-05 23:43:58 $
     7 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-01-07 20:00:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727    psS32 numBits = 0;
    2828
    29     for (i=0;i<4 * sizeof(psStatsOptions);i++) {
     29    for (i=0;i<8 * sizeof(psStatsOptions);i++) {
    3030        if (0x0001 & tmpData) {
    3131            numBits++;
  • trunk/psModules/src/pmSubtractSky.c

    r2916 r2928  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-01-05 23:43:58 $
     8 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-01-07 20:00:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929    psS32 numBits = 0;
    3030
    31     for (i=0;i<4 * sizeof(psStatsOptions);i++) {
     31    for (i=0;i<8 * sizeof(psStatsOptions);i++) {
    3232        if (0x0001 & tmpData) {
    3333            numBits++;
     
    439439    psStatsOptions statOptions = 0;
    440440
     441    //
    441442    // Return the original input readout if the fit specs are poorly defined.
     443    // No warning or error messages should be generated.
     444    //
    442445    if ((fitSpec == NULL) ||
    443446            ((fit == PM_FIT_NONE) || (fit == PM_FIT_SPLINE))) {
    444         psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined.  Returning in image.\n");
     447        //        psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined.  Returning in image.\n");
    445448        return(in);
    446449    }
  • trunk/psModules/test/tst_pmSubtractBias.c

    r2915 r2928  
    1313 *  @author GLG, MHPCC
    1414 *
    15  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-01-05 23:25:25 $
     15 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-01-07 20:00:34 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    654654    }
    655655
    656     printf("------------------------------------------------------------------\n");
    657     printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE.  Should generate warning.\n");
    658     rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat,
    659                         0, PM_FIT_NONE, myBias);
    660 
    661     for (i=0;i<numRows;i++) {
    662         for (j=0;j<numCols;j++) {
    663             psF32 expect = ((float) (i + j)) - 1.0;
    664             psF32 actual = rc->image->data.F32[i][j];
    665             if (FLT_EPSILON < fabs(expect - actual)) {
    666                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    667                 testStatus = 1;
    668             }
    669 
    670             // Restore myReadout for next test.
    671             myReadout->image->data.F32[i][j] = (float) (i + j);
    672         }
    673     }
     656    /* XXX: This does not seem to be a requirement.
     657        printf("------------------------------------------------------------------\n");
     658        printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE.  Should generate warning.\n");
     659        rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat,
     660                            0, PM_FIT_NONE, myBias);
     661     
     662        for (i=0;i<numRows;i++) {
     663            for (j=0;j<numCols;j++) {
     664                psF32 expect = ((float) (i + j)) - 1.0;
     665                psF32 actual = rc->image->data.F32[i][j];
     666                if (FLT_EPSILON < fabs(expect - actual)) {
     667                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     668                    testStatus = 1;
     669                }
     670     
     671                // Restore myReadout for next test.
     672                myReadout->image->data.F32[i][j] = (float) (i + j);
     673            }
     674        }
     675    */
    674676
    675677    printf("------------------------------------------------------------------\n");
     
    767769
    768770    printf("------------------------------------------------------------------\n");
    769     printf("Calling pmSubtractBias() undersize bias image (short rows).  Should generate Warning.\n");
     771    printf("Calling pmSubtractBias() undersize bias image (short rows).  Should generate Error.\n");
    770772    myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL,
    771773                               0, PM_FIT_NONE, myBiasShortRows);
     
    778780
    779781    printf("------------------------------------------------------------------\n");
    780     printf("Calling pmSubtractBias() undersize bias image (short columns).  Should generate Warning.\n");
     782    printf("Calling pmSubtractBias() undersize bias image (short columns).  Should generate Error.\n");
    781783    myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL,
    782784                               0, PM_FIT_NONE, myBiasShortCols);
  • trunk/psModules/test/tst_pmSubtractSky.c

    r2915 r2928  
    77 *  @author GLG, MHPCC
    88 *
    9  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-01-05 23:25:25 $
     9 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-01-07 20:00:34 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    226226
    227227    printf("----------------------------------------------------------------\n");
    228     printf("Calling pmSubtractSky() with NULL fitSpec.  Should return image, no TEST ERROR, no WARNING.\n\n");
     228    printf("Calling pmSubtractSky() with NULL fitSpec.  Should return image, no ERROR, no WARNING.\n\n");
    229229    rc = pmSubtractSky(myReadout, NULL, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    230230    if (rc != myReadout) {
     
    234234
    235235    printf("----------------------------------------------------------------\n");
    236     printf("Calling pmSubtractSky() with PM_FIT_NONE fit.  Should return image, no TEST ERROR, no WARNING.\n\n");
     236    printf("Calling pmSubtractSky() with PM_FIT_NONE fit.  Should return image, no ERROR, no WARNING.\n\n");
    237237    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_NONE, 1, myStats, 2.0);
    238238    if (rc != myReadout) {
     
    242242
    243243    printf("----------------------------------------------------------------\n");
    244     printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit.  Should return image, no TEST ERROR, no WARNING.\n\n");
     244    printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit.  Should return image, no ERROR, no WARNING.\n\n");
    245245    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_SPLINE, 1, myStats, 2.0);
    246246    if (rc != myReadout) {
Note: See TracChangeset for help on using the changeset viewer.