IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14359


Ignore:
Timestamp:
Jul 20, 2007, 5:00:03 PM (19 years ago)
Author:
Paul Price
Message:

Trap non-finite values so the whole thing doesn't crash.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStats/src/ppStatsReadout.c

    r14010 r14359  
    22
    33psExit ppStatsReadout(psMetadata *cellResults, // Metadata holding the chip results
    4                       pmReadout *readout,       // Cell for which to get statistics
    5                       int nReadout,     // readout number
    6                       ppStatsData *data,        // The data
    7                       const pmConfig *config // Configuration
     4                      pmReadout *readout,       // Cell for which to get statistics
     5                      int nReadout,     // readout number
     6                      ppStatsData *data,        // The data
     7                      const pmConfig *config // Configuration
    88    )
    99{
     
    1414
    1515    /*** psphot and psastro put their results on the readout->analysis metadata (PSPHOT.HEADER,
    16         PSASTRO.HEADER).  we need to pull quantities of interest from those locations. to do
    17         this, we need to select the appropriate readout.  ***/
     16        PSASTRO.HEADER).  we need to pull quantities of interest from those locations. to do
     17        this, we need to select the appropriate readout.  ***/
    1818
    1919    // Extract Header and Concept values from the Cell and Readout->analysis level
     
    3131    // Extract Header values
    3232    if (psListLength(data->headers)) {
    33         // extract from data->analysis output MD entries
    34         if (psListLength(data->analysis)) {
    35             p_ppStatsGetAnalysis (readoutResults, data->headers, readout->analysis, data->analysis);
    36         }
     33        // extract from data->analysis output MD entries
     34        if (psListLength(data->analysis)) {
     35            p_ppStatsGetAnalysis (readoutResults, data->headers, readout->analysis, data->analysis);
     36        }
    3737    }
    3838
     
    6262        psVector *sampleValues = psVectorAlloc(numSamples, PS_TYPE_F32); // Vector of samples
    6363        psVector *sampleMask = NULL;  // Corresponding mask
     64        bool warnNonFinite = false;     // Have we warned about non-finite values?
    6465        if (mask) {
    6566            sampleMask = psVectorAlloc(numSamples, PS_TYPE_U8);
     
    7071            int x = j % image->numCols;
    7172            sampleValues->data.F32[i] = image->data.F32[y][x];
     73            if (!isfinite(sampleValues->data.F32[i])) {
     74                if (!warnNonFinite) {
     75                    psWarning("Non-finite value detected at %d,%d", x, y);
     76                    warnNonFinite = true;
     77                }
     78                sampleMask->data.U8[i] = data->maskVal;
     79            }
    7280            if (mask) {
    7381                sampleMask->data.U8[i] = mask->data.U8[y][x];
Note: See TracChangeset for help on using the changeset viewer.